diff options
| author | Jimmy Kwa <[email protected]> | 2010-10-28 12:07:29 -0800 |
|---|---|---|
| committer | Jimmy Kwa <[email protected]> | 2010-10-28 12:07:29 -0800 |
| commit | 0586c55d7688f492d5264cb9299cf00ff73d3df7 (patch) | |
| tree | ef1ecc58933398e333f16dc56915bdffc64ef422 /decuda_to_ptxplus/decuda_to_ptxplus.cc | |
| parent | 0efd3c00f5611bfa82b01d87d175122388d621cc (diff) | |
used p4 integrate to copy decuda_to_ptxplus into the distribtion folder. Edited baseline_ptxplus.config so the ptxplus regression runs properly.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 7942]
Diffstat (limited to 'decuda_to_ptxplus/decuda_to_ptxplus.cc')
| -rw-r--r-- | decuda_to_ptxplus/decuda_to_ptxplus.cc | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/decuda_to_ptxplus/decuda_to_ptxplus.cc b/decuda_to_ptxplus/decuda_to_ptxplus.cc new file mode 100644 index 0000000..b7d7132 --- /dev/null +++ b/decuda_to_ptxplus/decuda_to_ptxplus.cc @@ -0,0 +1,87 @@ +#include <iostream> +#include "decudaInstList.h" +#include <stdio.h> +#include<fstream> + +using namespace std; + +decudaInstList *g_instList = new decudaInstList(); +decudaInstList *g_headerList = new decudaInstList(); + +int yyparse(); +extern "C" FILE *yyin; + +int ptx_parse(); +extern "C" FILE *ptx_in; + +FILE *bin_in; +FILE *ptxplus_out; + +void output(const char * text) +{ + fprintf(ptxplus_out, text); +} + +std::string fileToString(const char * fileName) { + ifstream fileStream(fileName, ios::in); + string text, line; + while(getline(fileStream,line)) { + text += (line + "\n"); + } + fileStream.close(); + return text; +} + +int main(int argc, char* argv[]) +{ + if(argc != 5) + { + cout << "Usage: decuda_to_ptxplus [decuda filename] [ptx filename] [bin filename] [ptxplus output filename]\n"; + return 0; + } + + const char *decudaFilename = argv[1]; + const char *ptxFilename = argv[2]; + const char *binFilename = argv[3]; + const char *ptxplusFilename = argv[4]; + + //header_in = fopen( ptxFilename, "r" ); + ptx_in = fopen( ptxFilename, "r" ); + yyin = fopen( decudaFilename, "r" ); + bin_in = fopen( binFilename, "r" ); + ptxplus_out = fopen( ptxplusFilename, "w" ); + + + fileToString(binFilename); + + printf("RUNNING decuda2ptxplus ...\n"); + + // Parse original ptx + ptx_parse(); + + // Copy real tex list from ptx to ptxplus instruction list + g_instList->setRealTexList(g_headerList->getRealTexList()); + + // Insert constant memory from bin file + g_instList->readConstMemoryFromBinFile(fileToString(binFilename)); + + // Insert global memory from bin file + g_instList->readGlobalMemoryFromBinFile(fileToString(binFilename)); + + // Parse decuda output + yyparse(); + printf("END RUN\n"); + + // Print ptxplus + g_headerList->printHeaderInstList(); + g_instList->printNewPtxList(g_headerList); + + fclose(ptx_in); + fclose(yyin); + fclose(bin_in); + fclose(ptxplus_out); + + printf("DONE. \n"); + + return 0; +} |
