From 7f3877f0765e17df29fe1aad2999d80cf4375c35 Mon Sep 17 00:00:00 2001 From: Rose Thompson Date: Wed, 7 Feb 2024 11:23:46 -0600 Subject: [PATCH] Finally have buildroot running in the main testbench! --- sim/wally-batch.do | 26 +++++++++++++++----------- testbench/testbench.sv | 4 ++-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/sim/wally-batch.do b/sim/wally-batch.do index 9bf3877b4..977fda6d7 100644 --- a/sim/wally-batch.do +++ b/sim/wally-batch.do @@ -36,23 +36,27 @@ if {$2 eq "configOptions"} { # Create directory for coverage data mkdir -p cov -# Check if measuring coverage +# Need to be able to pass arguments to vopt. Unforunately argv does not work because +# it takes on different values if vsim and the do file are called from the command line or +# if the do file isd called from questa sim directly. This chunk of code uses the $4 through $n +# variables and compacts into a single list for passing to vopt. set coverage 0 set configOptions "" -puts "ARGUMENTS START" -puts $argc -puts $argv -puts "ARGUMENTS END" +set from 4 +set step 1 +set lst {} +for {set i 0} true {incr i} { + set x [expr {$i*$step + $from}] + if {$x > $argc} break + set arg [expr "$$x"] + lappend lst $arg +} if {$argc >= 3} { if {$3 eq "-coverage" || ($argc >= 7 && $7 eq "-coverage")} { set coverage 1 } elseif {$3 eq "configOptions"} { - set Arguments [lrange $argv 2 2] - set ArgumentsTrim [string range $Arguments 1 end-1] - set tokens [regexp -all -inline {\S+} $ArgumentsTrim] - set params [lrange $tokens 5 end] - set configOptions $params - puts $params + set configOptions $lst + puts $configOptions } } diff --git a/testbench/testbench.sv b/testbench/testbench.sv index c762b48c5..3d1836613 100644 --- a/testbench/testbench.sv +++ b/testbench/testbench.sv @@ -540,11 +540,11 @@ module testbench; DCacheFlushFSM #(P) DCacheFlushFSM(.clk(clk), .reset(reset), .start(DCacheFlushStart), .done(DCacheFlushDone)); - if(P.ZICSR_SUPPORTED) begin + if(P.ZICSR_SUPPORTED & INSTR_LIMIT != 0) begin logic [P.XLEN-1:0] Minstret; assign Minstret = testbench.dut.core.priv.priv.csr.counters.counters.HPMCOUNTER_REGW[2]; always @(negedge clk) begin - if((Minstret != 0) && (Minstret % 'd100000 == 0)) $display("Reached %d", Minstret); + if((Minstret != 0) && (Minstret % 'd100000 == 0)) $display("Reached %d instructions", Minstret); if((Minstret == INSTR_LIMIT) & (INSTR_LIMIT!=0)) begin $stop; $stop; end end end