Maybe have imperasDV linux simulation merged into wally.do

This commit is contained in:
Rose Thompson 2024-05-14 12:38:19 -05:00
parent e8f5545076
commit 30bea18dec

View File

@ -18,6 +18,8 @@
# vsim -do wally-batch.do -c # vsim -do wally-batch.do -c
# (omit the "-c" to see the GUI while running from the shell) # (omit the "-c" to see the GUI while running from the shell)
set DEBUG 0
onbreak {resume} onbreak {resume}
onerror {quit -f} onerror {quit -f}
@ -42,6 +44,22 @@ set coverage 0
set CoverageVoptArg "" set CoverageVoptArg ""
set CoverageVsimArg "" set CoverageVsimArg ""
set lockstep 0
# ok this is annoying. vlog, vopt, and vsim are very picky about how arguments are passed.
# unforunately it won't allow these to be grouped as one argument per command so they are broken
# apart.
set lockstepvoptstring ""
set SVLib ""
set SVLibPath ""
set OtherFlags ""
set ImperasPubInc ""
set ImperasPrivInc ""
set rvviFiles ""
set idvFiles ""
set GUI 0
set accFlag ""
# Need to be able to pass arguments to vopt. Unforunately argv does not work because # 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 # 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 # if the do file isd called from questa sim directly. This chunk of code uses the $4 through $n
@ -50,10 +68,9 @@ set tbArgs ""
set from 4 set from 4
set step 1 set step 1
set lst {} set lst {}
set GUI 0
set PlusArgs {} set PlusArgs {}
set ParamArgs {} set ParamArgs {}
set accFlag ""
for {set i 0} true {incr i} { for {set i 0} true {incr i} {
set x [expr {$i*$step + $from}] set x [expr {$i*$step + $from}]
if {$x > $argc} break if {$x > $argc} break
@ -61,66 +78,77 @@ for {set i 0} true {incr i} {
lappend lst $arg lappend lst $arg
} }
if {$argc >= 3} { echo "number of args = $argc"
echo "got at least 3 args" echo "lst = $lst"
set AccPosition [lsearch $lst "+acc"]
echo $AccPosition
if {$AccPosition != -1} {
set GUI 1
set accFlag "+acc"
set tbArgs [lreplace $lst $AccPosition $AccPosition]
} else {
set tbArgs $lst
}
set tbArgsLst [split $tbArgs " "]
set index [lsearch -exact $tbArgsLst "-coverage"] # if +acc found set flag and remove from list
if {$index >= 0} { set AccIndex [lsearch -exact $lst "+acc"]
set coverage 1 if {$AccIndex >= 0} {
set CoverageVoptArg "+cover=sbecf" set GUI 1
set CoverageVsimArg "-coverage" set accFlag "+acc"
echo $tbArgsLst set lst [lreplace $lst $AccIndex $AccIndex]
set tbArgsLst [lreplace $tbArgsLst $index $index ] }
#echo "help help help !!!!!!!!!!!!!!!!!!!!!!!!!!!"
#echo $tbArgsLst # if +coverage found set flag and remove from list
#echo "help help help !!!!!!!!!!!!!!!!!!!!!!!!!!!" set CoverageIndex [lsearch -exact $lst "--coverage"]
} if {$CoverageIndex >= 0} {
set coverage 1
# separate the +args from the -G parameters set CoverageVoptArg "+cover=sbecf"
foreach otherArg $tbArgsLst { set CoverageVsimArg "-coverage"
if {[string index $otherArg 0] eq "+"} { set lst [lreplace $lst $CoverageIndex $CoverageIndex]
lappend PlusArgs $otherArg }
} else {
lappend ParamArgs $otherArg set LockStepIndex [lsearch -exact $lst "--lockstep"]
} if {$LockStepIndex >= 0} {
set lockstep 1
set lockstepvoptstring "+define+USE_IMPERAS_DV"
set ImperasPubInc +incdir+$env(IMPERAS_HOME)/ImpPublic/include/host
set ImperasPrivInc +incdir+$env(IMPERAS_HOME)/ImpProprietary/include/host
set rvviFiles $env(IMPERAS_HOME)/ImpPublic/source/host/rvvi/*.sv
set idvFiles $env(IMPERAS_HOME)/ImpProprietary/source/host/idv/*.sv
set SVLib "-sv_lib"
set SVLibPath $env(IMPERAS_HOME)/lib/Linux64/ImperasLib/imperas.com/verification/riscv/1.0/model
set OtherFlags $env(OTHERFLAGS)
set lst [lreplace $lst $LockStepIndex $LockStepIndex]
}
# separate the +args from the -G parameters
foreach otherArg $lst {
if {[string index $otherArg 0] eq "+"} {
lappend PlusArgs $otherArg
} else {
lappend ParamArgs $otherArg
} }
} }
# helpful debug code remove later
#echo "help me!!!!!!! GUI =" if {$DEBUG > 0} {
#echo $GUI echo "GUI = $GUI"
#echo "help me!!!!!!! lst =" echo "coverage = $coverage"
#echo $lst echo "lockstep = $lockstep"
#echo "help me!!!!!!! = accFlag =" echo "remaining list = \'$lst\'"
#echo $accFlag echo "Extra +args = \'$PlusArgs\'"
#echo "help me!!!!!!! PlusArgs =" echo "Extra -args = \'$ParamArgs\'"
#echo $PlusArgs }
#echo "help me!!!!!!! ParamArgs ="
#echo $ParamArgs
#echo "help me!!!!!!!"
# compile source files # compile source files
# suppress spurious warnngs about # suppress spurious warnngs about
# "Extra checking for conflicts with always_comb done at vopt time" # "Extra checking for conflicts with always_comb done at vopt time"
# because vsim will run vopt # because vsim will run vopt
vlog -lint -work ${WKDIR} +incdir+${CONFIG}/${CFG} +incdir+${CONFIG}/deriv/${CFG} +incdir+${CONFIG}/shared ${SRC}/cvw.sv ${TB}/${TESTBENCH}.sv ${TB}/common/*.sv ${SRC}/*/*.sv ${SRC}/*/*/*.sv -suppress 2583 -suppress 7063,2596,13286 echo $lockstepvoptstring
vlog -lint -work ${WKDIR} +incdir+${CONFIG}/${CFG} +incdir+${CONFIG}/deriv/${CFG} ${lockstepvoptstring} ${ImperasPubInc} ${ImperasPrivInc} +incdir+${CONFIG}/shared ${rvviFiles} ${idvFiles} ${SRC}/cvw.sv ${TB}/${TESTBENCH}.sv ${TB}/common/*.sv ${SRC}/*/*.sv ${SRC}/*/*/*.sv -suppress 2583 -suppress 7063,2596,13286
# start and run simulation # start and run simulation
# remove +acc flag for faster sim during regressions if there is no need to access internal signals # remove +acc flag for faster sim during regressions if there is no need to access internal signals
vopt $accFlag wkdir/${CFG}_${TESTSUITE}.${TESTBENCH} -work ${WKDIR} ${tbArgsLst} -o testbenchopt ${CoverageVoptArg} vopt $accFlag wkdir/${CFG}_${TESTSUITE}.${TESTBENCH} -work ${WKDIR} ${lst} -o testbenchopt ${CoverageVoptArg}
# *** tbArgs producees a warning that TEST not found in design when running sim-testfloat-batch. Need to separate -G and + arguments to pass separately to vopt and vsim # *** tbArgs producees a warning that TEST not found in design when running sim-testfloat-batch. Need to separate -G and + arguments to pass separately to vopt and vsim
vsim -lib ${WKDIR} testbenchopt +TEST=${TESTSUITE} ${PlusArgs} -fatal 7 -suppress 3829 ${CoverageVsimArg} vsim -lib ${WKDIR} testbenchopt +TEST=${TESTSUITE} ${PlusArgs} -fatal 7 ${SVLib} ${SVLibPath} ${OtherFlags} -suppress 3829 ${CoverageVsimArg}
# -sv_lib $env(IMPERAS_HOME)/lib/Linux64/ImperasLib/imperas.com/verification/riscv/1.0/model \
$env(OTHERFLAGS)
# vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829 # vsim -lib wkdir/work_${1}_${2} testbenchopt -fatal 7 -suppress 3829
# power add generates the logging necessary for said generation. # power add generates the logging necessary for said generation.
@ -137,7 +165,6 @@ if { ${GUI} } {
run -all run -all
# power off -r /dut/core/* # power off -r /dut/core/*
if {$coverage} { if {$coverage} {
set UCDB cov/${CFG}_${TESTSUITE}.ucdb set UCDB cov/${CFG}_${TESTSUITE}.ucdb
echo "Saving coverage to ${UCDB}" echo "Saving coverage to ${UCDB}"