Closed Paebbels closed 2 years ago
+cover=
enables coverage collection
AnalyzeCovTypes
is a sequence of character for each coverage type like statement, branch, expression, ...
The changes for VHDL and Verilog are identical.
proc vendor_analyze_vhdl {LibraryName FileName OptionalCommands} {
variable VhdlVersion
- puts "vcom -${VhdlVersion} -work ${LibraryName} ${FileName} "
- vcom -${VhdlVersion} -work ${LibraryName} ${FileName}
+ global AnalyzeCov
+ global AnalyzeCovTypes
+ if {$AnalyzeCov == "On"} then {
+ # with coverage options
+ puts "vcom -${VhdlVersion} +cover=${AnalyzeCovTypes} -work ${LibraryName} ${FileName} "
+ vcom -${VhdlVersion} +cover=${AnalyzeCovTypes} -work ${LibraryName} ${FileName}
+ } else {
+ # without coverage options (OSVVM defaults)
+ puts "vcom -${VhdlVersion} -work ${LibraryName} ${FileName} "
+ vcom -${VhdlVersion} -work ${LibraryName} ${FileName}
+ };
}
-coverage
enables coverage collection
AnalyzeCovTypes
is a sequence of character for each coverage type like statement, branch, expression, ...
Coverage characters:
s
: statementb
: branchf
: functionale
: expressionc
: conditiont
: togglea
: assertionp
: pathm
: FSMExample:
set AnalyzeCovTypes "sbecapm"
The changes for VHDL and Verilog are identical.
proc vendor_analyze_vhdl {LibraryName FileName OptionalCommands} {
variable VhdlVersion
- echo vcom -${VhdlVersion} -dbg -relax -work ${LibraryName} ${FileName}
- vcom -${VhdlVersion} -dbg -relax -work ${LibraryName} ${FileName}
+ global AnalyzeCov
+ global AnalyzeCovTypes
+
+ if {$AnalyzeCov == "On"} then {
+ # with coverage options
+ echo vcom -${VhdlVersion} -dbg -relax -coverage ${AnalyzeCovTypes} -work ${LibraryName} ${FileName}
+ vcom -${VhdlVersion} -dbg -relax -coverage ${AnalyzeCovTypes} -work ${LibraryName} ${FileName}
+ } else {
+ # without coverage options (OSVVM defaults)
+ echo vcom -${VhdlVersion} -dbg -relax -work ${LibraryName} ${FileName}
+ vcom -${VhdlVersion} -dbg -relax -work ${LibraryName} ${FileName}
+ };
}
A common -coverage
switch is needed to enable a run with code coverage collection. Afterwards a coverage save
is needed.
- puts "vsim -voptargs='+acc' -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands} -suppress 8683 -suppress 8684"
-# eval vsim -voptargs="+acc" -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands} -suppress 8683 -suppress 8684
- eval vsim -voptargs="+acc" -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands} -suppress 8683 -suppress 8684
+ global SimCov
+ global SimCovTypes
+
+ if {$SimCov == "On"} then {
+ # with coverage options
+ puts "vsim -voptargs='+acc' -coverage -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands} -suppress 8683 -suppress 8684"
+ eval vsim -voptargs="+acc" -coverage -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands} -suppress 8683 -suppress 8684
+
+ # save coverage database
+ coverage save -onexit -code ${SimCovTypes} ${LibraryUnit}.ucdb
+ } else {
+ # without coverage options (OSVVM defaults)
+ puts "vsim -voptargs='+acc' -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands} -suppress 8683 -suppress 8684"
+ eval vsim -voptargs="+acc" -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands} -suppress 8683 -suppress 8684
+ };
Riviera-PRO needs:
Setting coverage characters for simulation:
set SimCovTypes "sbfectapm"
Needed simulation coverage options are:
set SimCovOptions "-acdb -acdb_cov";
- puts "vsim -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands}"
- eval vsim -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands}
+ global SimCov
+ global SimCovOptions
+ global SimCovLibUnitList
+ global SimCovTypes
+ global SimMPSoC
+
+ if {$SimCov == "On"} then {
+ # with coverage options
+ puts "vsim ${SimCovOptions} ${SimCovTypes} -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${SimCovLibUnitList} ${OptionalCommands}"
+ eval vsim ${SimCovOptions} ${SimCovTypes} -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${SimCovLibUnitList} ${OptionalCommands}
+
+ if {[file exists ${LibraryName}.acdb]} {
+ file copy -force ${LibraryName}.acdb ${LibraryUnit}.acdb
+ };
+ } else {
+ # without coverage options (OSVVM defaults)
+ puts "vsim -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands}"
+ eval vsim -t $SIMULATE_TIME_UNITS -lib ${LibraryName} ${LibraryUnit} ${OptionalCommands}
+ };
For each design unit, the ACDB file needs processing:
eval acdb enable -cov $SimCovTypes -verbose -du lib.spi_master
eval acdb include -cov $SimCovTypes -verbose -du lib.spi_master
Finally, merge all ACDB files:
eval acdb merge -verbose -cov $SimCovTypes -i *.acdb -o coverage_merged.acdb
Report merged ACDB as HTML report:
eval acdb report -verbose -cov $SimCovTypes -html -show files -i coverage_merged.acdb -o
Report merged ACDB as TXT report:
coverage.html
eval acdb report -verbose -cov $SimCovTypes -txt -i coverage_merged.acdb -o coverage.txt
To address this, 2022.02 adds the following (this part already in Dev),
SetCoverageAnalyzeOptions "String Value"
GetCoverageAnalyzeOptions
SetCoverageAnalyzeEnable TRUE/FALSE
GetCoverageAnalyzeEnable
SetCoverageSimulateOptions "String Value"
GetCoverageSimulateOptions
SetCoverageSimulateEnable TRUE/FALSE
GetCoverageSimulateEnable
This is meant to be layered into the scripting. To add coverage to OSVVM tests that collects coverage on everything in the OSVVM library, but not the testbenches, do the following in a .pro file:
SetCoverageAnalyzeEnable true
include ../OsvvmLibraries
SetCoverageAnalyzeEnable false
SetCoverageSimulateEnable true
include ../OsvvmLibraries/RunAllTests.pro
# SimulateEnable needs to remain on as build finishes:
#SetCoverageSimulateEnable false
Released as part of 2022.02
For many verification projects, the collection of (code) coverage information is essential.
Such a feature would complement OSVVM's latest feature on exporting and visualizing function coverage.
Commercials simulators like Riviera-PRO allow the collection of various coverage metrics like:
OSVVM's scripting should offer a generic approach to enable code coverage collection. Collected coverage might need a "merge" step after testcase execution.
A basic example for Riviera-PRO can be offered upon request.