mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
added support for embench post processing to testbench.sv
This commit is contained in:
parent
ee7070c5b6
commit
d28b4cf602
@ -128,7 +128,8 @@ logic [3:0] dummy;
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
string signame, memfilename, pathname, objdumpfilename, adrstr;
|
string signame, memfilename, pathname, objdumpfilename, adrstr, outputfile;
|
||||||
|
integer outputFilePointer;
|
||||||
|
|
||||||
logic [31:0] GPIOPinsIn, GPIOPinsOut, GPIOPinsEn;
|
logic [31:0] GPIOPinsIn, GPIOPinsOut, GPIOPinsEn;
|
||||||
logic UARTSin, UARTSout;
|
logic UARTSin, UARTSout;
|
||||||
@ -213,14 +214,32 @@ logic [3:0] dummy;
|
|||||||
$display("Benchmark: coremark is done.");
|
$display("Benchmark: coremark is done.");
|
||||||
$stop;
|
$stop;
|
||||||
end
|
end
|
||||||
|
// Termination condition (i.e. we finished running current test)
|
||||||
if (DCacheFlushDone) begin
|
if (DCacheFlushDone) begin
|
||||||
|
// Gets the memory location of begin_signature
|
||||||
|
testadr = (`RAM_BASE+tests[test+1].atohex())/(`XLEN/8);
|
||||||
|
testadrNoBase = (tests[test+1].atohex())/(`XLEN/8);
|
||||||
#600; // give time for instructions in pipeline to finish
|
#600; // give time for instructions in pipeline to finish
|
||||||
|
if (TEST == "embench") begin
|
||||||
|
// Writes contents of begin_signature to .sim.output file
|
||||||
|
// this contains instret and cycles for start and end of test run, used by embench python speed script to calculate embench speed score
|
||||||
|
// also begin_signature contains the results of the self checking mechanism, which will be read by the python script for error checking
|
||||||
|
$display("Embench Benchmark: %s is done.", tests[test]);
|
||||||
|
outputfile = {pathname, tests[test], ".sim.output"};
|
||||||
|
outputFilePointer = $fopen(outputfile);
|
||||||
|
i = 0;
|
||||||
|
while ($unsigned(i) < $unsigned(5'd5)) begin
|
||||||
|
$fdisplayh(outputFilePointer, DCacheFlushFSM.ShadowRAM[testadr+i]);
|
||||||
|
i = i + 1;
|
||||||
|
end
|
||||||
|
$fclose(outputFilePointer);
|
||||||
|
$display("Embench Benchmark: created output file: %s", outputfile);
|
||||||
|
end else begin
|
||||||
|
// for tests with no self checking mechanism, read .signature.output file and compare to check for errors
|
||||||
// clear signature to prevent contamination from previous tests
|
// clear signature to prevent contamination from previous tests
|
||||||
for(i=0; i<SIGNATURESIZE; i=i+1) begin
|
for(i=0; i<SIGNATURESIZE; i=i+1) begin
|
||||||
sig32[i] = 'bx;
|
sig32[i] = 'bx;
|
||||||
end
|
end
|
||||||
|
|
||||||
// read signature, reformat in 64 bits if necessary
|
// read signature, reformat in 64 bits if necessary
|
||||||
signame = {pathname, tests[test], ".signature.output"};
|
signame = {pathname, tests[test], ".signature.output"};
|
||||||
$readmemh(signame, sig32);
|
$readmemh(signame, sig32);
|
||||||
@ -244,8 +263,6 @@ logic [3:0] dummy;
|
|||||||
// Check errors
|
// Check errors
|
||||||
errors = (i == SIGNATURESIZE+1); // error if file is empty
|
errors = (i == SIGNATURESIZE+1); // error if file is empty
|
||||||
i = 0;
|
i = 0;
|
||||||
testadr = (`RAM_BASE+tests[test+1].atohex())/(`XLEN/8);
|
|
||||||
testadrNoBase = (tests[test+1].atohex())/(`XLEN/8);
|
|
||||||
/* verilator lint_off INFINITELOOP */
|
/* verilator lint_off INFINITELOOP */
|
||||||
while (signature[i] !== 'bx) begin
|
while (signature[i] !== 'bx) begin
|
||||||
logic [`XLEN-1:0] sig;
|
logic [`XLEN-1:0] sig;
|
||||||
@ -277,6 +294,8 @@ logic [3:0] dummy;
|
|||||||
$display("%s failed with %d errors. :(", tests[test], errors);
|
$display("%s failed with %d errors. :(", tests[test], errors);
|
||||||
totalerrors = totalerrors+1;
|
totalerrors = totalerrors+1;
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
// move onto the next test, check to see if we're done
|
||||||
test = test + 2;
|
test = test + 2;
|
||||||
if (test == tests.size()) begin
|
if (test == tests.size()) begin
|
||||||
if (totalerrors == 0) $display("SUCCESS! All tests ran without failures.");
|
if (totalerrors == 0) $display("SUCCESS! All tests ran without failures.");
|
||||||
@ -284,6 +303,7 @@ logic [3:0] dummy;
|
|||||||
$stop;
|
$stop;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
|
// If there are still additional tests to run, read in information for the next test
|
||||||
//pathname = tvpaths[tests[0]];
|
//pathname = tvpaths[tests[0]];
|
||||||
memfilename = {pathname, tests[test], ".elf.memfile"};
|
memfilename = {pathname, tests[test], ".elf.memfile"};
|
||||||
//$readmemh(memfilename, dut.uncore.ram.ram.memory.RAM);
|
//$readmemh(memfilename, dut.uncore.ram.ram.memory.RAM);
|
||||||
|
Loading…
Reference in New Issue
Block a user