On Tue, Jul 2, 2013 at 11:59 PM, Olof Kindgren <[email protected]>wrote:
> > > On Mon, Jul 1, 2013 at 1:21 PM, Olof Kindgren <[email protected]>wrote: > >> >> >> On Mon, Jul 1, 2013 at 10:53 AM, Julius Baxter <[email protected]>wrote: >> >>> On Fri, Jun 28, 2013 at 10:31 PM, Olof Kindgren <[email protected]> >>> wrote: >>> > Two small patches in one to make or1200-monitor more useful outside of >>> > orpsocv2: >>> > >>> > - Setting log path with a parameter allows more flexible directory >>> layout >>> > - By setting TEST_NAME_STRING with a parameter we can get rid of >>> `include >>> > test-defines in or1200_monitor.v >>> > >>> > Index: verilog/or1200_monitor.v >>> > =================================================================== >>> > --- verilog/or1200_monitor.v (revision 860) >>> > +++ verilog/or1200_monitor.v (working copy) >>> > @@ -38,11 +38,13 @@ >>> > `include "timescale.v" >>> > `include "or1200_defines.v" >>> > `include "or1200_monitor_defines.v" >>> > -`include "test-defines.v" >>> > >>> > >>> > module or1200_monitor; >>> > >>> > + parameter TEST_NAME_STRING = "unnamed"; >>> > + parameter LOG_DIR = "."; >>> > + >>> > integer fexe; >>> > integer finsn; >>> > >>> > @@ -64,18 +66,18 @@ >>> > initial begin >>> > ref = 0; >>> > `ifdef OR1200_MONITOR_EXEC_STATE >>> > - fexe = $fopen({"../out/",`TEST_NAME_STRING,"-executed.log"}); >>> > + fexe = $fopen({LOG_DIR, "/", TEST_NAME_STRING,"-executed.log"}); >>> > `endif >>> > `ifdef OR1200_MONITOR_EXEC_LOG_DISASSEMBLY >>> > finsn = fexe; >>> > `endif >>> > $timeformat (-9, 2, " ns", 12); >>> > `ifdef OR1200_MONITOR_SPRS >>> > - fspr = $fopen({"../out/",`TEST_NAME_STRING,"-sprs.log"}); >>> > + fspr = $fopen({LOG_DIR, "/", TEST_NAME_STRING,"-sprs.log"}); >>> > `endif >>> > - fgeneral = $fopen({"../out/",`TEST_NAME_STRING,"-general.log"}); >>> > + fgeneral = $fopen({LOG_DIR, "/", >>> TEST_NAME_STRING,"-general.log"}); >>> > `ifdef OR1200_MONITOR_LOOKUP >>> > - flookup = $fopen({"../out/",`TEST_NAME_STRING,"-lookup.log"}); >>> > + flookup = $fopen({LOG_DIR, "/", >>> TEST_NAME_STRING,"-lookup.log"}); >>> > `endif >>> > insns = 0; >>> > >>> > Index: verilog/orpsoc_testbench.v >>> > =================================================================== >>> > --- verilog/orpsoc_testbench.v (revision 859) >>> > +++ verilog/orpsoc_testbench.v (working copy) >>> > @@ -91,7 +91,10 @@ >>> > // >>> > // Instantiate OR1200 monitor >>> > // >>> > - or1200_monitor monitor(); >>> > + or1200_monitor >>> > + #(.TEST_NAME_STRING (`TEST_NAME_STRING), >>> > + .LOG_DIR("../out")) >>> > + monitor(); >>> > >>> > `ifndef SIM_QUIET >>> > `define CPU_ic_top or1200_ic_top >>> > >>> > //Olof >>> > >>> >>> Hey Olof >>> >>> Yeah, that looks good. But what about plusargs? Is that more useful? >>> Might be nice to have the single simulation executable and just vary >>> plusargs to set up things like this? Just a thought, I don't mind >>> either way. >>> >>> Cheers >>> >>> Julius >>> >> >> Yes, plusargs is a better solution. I'll cook up a new patch right away. >> We could still use this patch though, and just optionally override the >> values if the plusargs are set. That would be less intrusive for orpsocv2 >> as it is right now. >> >> //Olof >> > > Patch version 2 > > > Two small patches in one to make or1200-monitor more useful outside of > orpsocv2: > > - Setting log path with a parameter allows more flexible directory layout > - if The plusarg "testcase" is set at runtime, this is used to set a > unique prefix for the log files. Plusargs are currently not used in > orpsocv2, so if it is not set, the name falls back to the value of the > parameter TEST_NAME_STRING. The value of the parameter is set to the define > `TEST_NAME_STRING in the test bench top levele to avoid any changes to the > orpsocv2 scripts. With this, we can get rid of `include test-defines in > or1200_monitor.v > > > Index: verilog/or1200_monitor.v > =================================================================== > --- verilog/or1200_monitor.v (revision 860) > +++ verilog/or1200_monitor.v (working copy) > @@ -38,11 +38,13 @@ > `include "timescale.v" > `include "or1200_defines.v" > `include "or1200_monitor_defines.v" > -`include "test-defines.v" > > > module or1200_monitor; > > + parameter TEST_NAME_STRING = "unnamed"; > + parameter LOG_DIR = "."; > + > integer fexe; > integer finsn; > > @@ -57,25 +59,45 @@ > integer r3; > 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 > // > + reg [64*8-1:0] testcase; //Maximum 64 characters > + > initial begin > ref = 0; > + if(!$value$plusargs("testcase=%s", testcase)) > + testcase = TEST_NAME_STRING; > > + > `ifdef OR1200_MONITOR_EXEC_STATE > - fexe = $fopen({"../out/",`TEST_NAME_STRING,"-executed.log"}); > + fexe = $fopen(trim({LOG_DIR, "/", testcase, "-executed.log"})); > > `endif > `ifdef OR1200_MONITOR_EXEC_LOG_DISASSEMBLY > finsn = fexe; > `endif > $timeformat (-9, 2, " ns", 12); > `ifdef OR1200_MONITOR_SPRS > - fspr = $fopen({"../out/",`TEST_NAME_STRING,"-sprs.log"}); > + fspr = $fopen(trim({LOG_DIR, "/", testcase, "-sprs.log"})); > > `endif > - fgeneral = $fopen({"../out/",`TEST_NAME_STRING,"-general.log"}); > + fgeneral = $fopen(trim({LOG_DIR, "/", testcase, "-general.log"})); > > `ifdef OR1200_MONITOR_LOOKUP > - flookup = $fopen({"../out/",`TEST_NAME_STRING,"-lookup.log"}); > + flookup = $fopen(trim({LOG_DIR, "/", testcase, "-lookup.log"})); > > `endif > insns = 0; > > Index: verilog/orpsoc_testbench.v > =================================================================== > --- verilog/orpsoc_testbench.v (revision 859) > +++ verilog/orpsoc_testbench.v (working copy) > @@ -91,7 +91,10 @@ > // > // Instantiate OR1200 monitor > // > - or1200_monitor monitor(); > + or1200_monitor > + #(.TEST_NAME_STRING (`TEST_NAME_STRING), > + .LOG_DIR("../out")) > + monitor(); > > `ifndef SIM_QUIET > `define CPU_ic_top or1200_ic_top > > No one was opposing, so this was pushed as svn revision 863 //Olof
_______________________________________________ OpenRISC mailing list [email protected] http://lists.openrisc.net/listinfo/openrisc
