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
# (omit the "-c" to see the GUI while running from the shell)
set DEBUG 0
onbreak {resume}
onerror {quit -f}
@ -42,6 +44,22 @@ set coverage 0
set CoverageVoptArg ""
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
# 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
@ -50,10 +68,9 @@ set tbArgs ""
set from 4
set step 1
set lst {}
set GUI 0
set PlusArgs {}
set ParamArgs {}
set accFlag ""
for {set i 0} true {incr i} {
set x [expr {$i*$step + $from}]
if {$x > $argc} break
@ -61,66 +78,77 @@ for {set i 0} true {incr i} {
lappend lst $arg
}
if {$argc >= 3} {
echo "got at least 3 args"
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 " "]
echo "number of args = $argc"
echo "lst = $lst"
set index [lsearch -exact $tbArgsLst "-coverage"]
if {$index >= 0} {
set coverage 1
set CoverageVoptArg "+cover=sbecf"
set CoverageVsimArg "-coverage"
echo $tbArgsLst
set tbArgsLst [lreplace $tbArgsLst $index $index ]
#echo "help help help !!!!!!!!!!!!!!!!!!!!!!!!!!!"
#echo $tbArgsLst
#echo "help help help !!!!!!!!!!!!!!!!!!!!!!!!!!!"
}
# separate the +args from the -G parameters
foreach otherArg $tbArgsLst {
if {[string index $otherArg 0] eq "+"} {
lappend PlusArgs $otherArg
} else {
lappend ParamArgs $otherArg
}
# if +acc found set flag and remove from list
set AccIndex [lsearch -exact $lst "+acc"]
if {$AccIndex >= 0} {
set GUI 1
set accFlag "+acc"
set lst [lreplace $lst $AccIndex $AccIndex]
}
# if +coverage found set flag and remove from list
set CoverageIndex [lsearch -exact $lst "--coverage"]
if {$CoverageIndex >= 0} {
set coverage 1
set CoverageVoptArg "+cover=sbecf"
set CoverageVsimArg "-coverage"
set lst [lreplace $lst $CoverageIndex $CoverageIndex]
}
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 ="
#echo $GUI
#echo "help me!!!!!!! lst ="
#echo $lst
#echo "help me!!!!!!! = accFlag ="
#echo $accFlag
#echo "help me!!!!!!! PlusArgs ="
#echo $PlusArgs
#echo "help me!!!!!!! ParamArgs ="
#echo $ParamArgs
#echo "help me!!!!!!!"
if {$DEBUG > 0} {
echo "GUI = $GUI"
echo "coverage = $coverage"
echo "lockstep = $lockstep"
echo "remaining list = \'$lst\'"
echo "Extra +args = \'$PlusArgs\'"
echo "Extra -args = \'$ParamArgs\'"
}
# compile source files
# suppress spurious warnngs about
# "Extra checking for conflicts with always_comb done at vopt time"
# 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
# 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
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
# power add generates the logging necessary for said generation.
@ -137,7 +165,6 @@ if { ${GUI} } {
run -all
# power off -r /dut/core/*
if {$coverage} {
set UCDB cov/${CFG}_${TESTSUITE}.ucdb
echo "Saving coverage to ${UCDB}"