Finally have buildroot running in the main testbench!

This commit is contained in:
Rose Thompson 2024-02-07 11:23:46 -06:00
parent 662e848ad8
commit 7f3877f076
2 changed files with 17 additions and 13 deletions

View File

@ -36,23 +36,27 @@ if {$2 eq "configOptions"} {
# Create directory for coverage data # Create directory for coverage data
mkdir -p cov 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 coverage 0
set configOptions "" set configOptions ""
puts "ARGUMENTS START" set from 4
puts $argc set step 1
puts $argv set lst {}
puts "ARGUMENTS END" 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 {$argc >= 3} {
if {$3 eq "-coverage" || ($argc >= 7 && $7 eq "-coverage")} { if {$3 eq "-coverage" || ($argc >= 7 && $7 eq "-coverage")} {
set coverage 1 set coverage 1
} elseif {$3 eq "configOptions"} { } elseif {$3 eq "configOptions"} {
set Arguments [lrange $argv 2 2] set configOptions $lst
set ArgumentsTrim [string range $Arguments 1 end-1] puts $configOptions
set tokens [regexp -all -inline {\S+} $ArgumentsTrim]
set params [lrange $tokens 5 end]
set configOptions $params
puts $params
} }
} }

View File

@ -540,11 +540,11 @@ module testbench;
DCacheFlushFSM #(P) DCacheFlushFSM(.clk(clk), .reset(reset), .start(DCacheFlushStart), .done(DCacheFlushDone)); 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; logic [P.XLEN-1:0] Minstret;
assign Minstret = testbench.dut.core.priv.priv.csr.counters.counters.HPMCOUNTER_REGW[2]; assign Minstret = testbench.dut.core.priv.priv.csr.counters.counters.HPMCOUNTER_REGW[2];
always @(negedge clk) begin 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 if((Minstret == INSTR_LIMIT) & (INSTR_LIMIT!=0)) begin $stop; $stop; end
end end
end end