Line 36... |
Line 36... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
|
`include "timescale.v"
|
`include "timescale.v"
|
`include "or1200_defines.v"
|
`include "or1200_defines.v"
|
`include "or1200_monitor_defines.v"
|
`include "or1200_monitor_defines.v"
|
`include "test-defines.v"
|
|
|
|
|
|
module or1200_monitor;
|
module or1200_monitor;
|
|
|
|
parameter TEST_NAME_STRING = "unnamed";
|
|
parameter LOG_DIR = ".";
|
|
|
integer fexe;
|
integer fexe;
|
integer finsn;
|
integer finsn;
|
|
|
reg [23:0] ref;
|
reg [23:0] ref;
|
`ifdef OR1200_MONITOR_SPRS
|
`ifdef OR1200_MONITOR_SPRS
|
Line 55... |
Line 57... |
integer flookup;
|
integer flookup;
|
`endif
|
`endif
|
integer r3;
|
integer r3;
|
integer insns;
|
integer insns;
|
|
|
|
//Trim \0 characters from str and return a right-adjusted string
|
|
function [128*8-1:0] trim;
|
|
input [128*8-1:0] str;
|
|
integer wpos;
|
|
integer rpos;
|
|
begin
|
|
trim = 0;
|
|
wpos = 0;
|
|
for(rpos=0;rpos<=128*8;rpos=rpos+8)
|
|
if(str[rpos+:8] != 0) begin
|
|
trim[wpos+:8] = str[rpos+:8];
|
|
wpos = wpos +8;
|
|
end
|
|
end
|
|
endfunction
|
|
|
//
|
//
|
// Initialization
|
// Initialization
|
//
|
//
|
|
reg [64*8-1:0] testcase; //Maximum 64 characters
|
|
|
initial begin
|
initial begin
|
ref = 0;
|
ref = 0;
|
|
if(!$value$plusargs("testcase=%s", testcase))
|
|
testcase = TEST_NAME_STRING;
|
|
|
`ifdef OR1200_MONITOR_EXEC_STATE
|
`ifdef OR1200_MONITOR_EXEC_STATE
|
fexe = $fopen({"../out/",`TEST_NAME_STRING,"-executed.log"});
|
fexe = $fopen(trim({LOG_DIR, "/", testcase, "-executed.log"}));
|
`endif
|
`endif
|
`ifdef OR1200_MONITOR_EXEC_LOG_DISASSEMBLY
|
`ifdef OR1200_MONITOR_EXEC_LOG_DISASSEMBLY
|
finsn = fexe;
|
finsn = fexe;
|
`endif
|
`endif
|
$timeformat (-9, 2, " ns", 12);
|
$timeformat (-9, 2, " ns", 12);
|
`ifdef OR1200_MONITOR_SPRS
|
`ifdef OR1200_MONITOR_SPRS
|
fspr = $fopen({"../out/",`TEST_NAME_STRING,"-sprs.log"});
|
fspr = $fopen(trim({LOG_DIR, "/", testcase, "-sprs.log"}));
|
`endif
|
`endif
|
fgeneral = $fopen({"../out/",`TEST_NAME_STRING,"-general.log"});
|
fgeneral = $fopen(trim({LOG_DIR, "/", testcase, "-general.log"}));
|
`ifdef OR1200_MONITOR_LOOKUP
|
`ifdef OR1200_MONITOR_LOOKUP
|
flookup = $fopen({"../out/",`TEST_NAME_STRING,"-lookup.log"});
|
flookup = $fopen(trim({LOG_DIR, "/", testcase, "-lookup.log"}));
|
`endif
|
`endif
|
insns = 0;
|
insns = 0;
|
|
|
end
|
end
|
|
|