mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
More functional coverage refactoring
This commit is contained in:
parent
98ef85128c
commit
2fe3686a24
@ -320,7 +320,7 @@ def addTestsByDir(testDir, config, sim, coverStr, configs, lockstepMode=0, breke
|
|||||||
# fcov/ccov only runs on WALLY-COV-ALL.elf files; other lockstep runs on all files
|
# fcov/ccov only runs on WALLY-COV-ALL.elf files; other lockstep runs on all files
|
||||||
fileEnd = "ALL.elf" if "cvw-arch-verif/tests" in testDir and "priv" not in testDir and (coverStr == "--fcov" or coverStr == "--ccov") else ".elf"
|
fileEnd = "ALL.elf" if "cvw-arch-verif/tests" in testDir and "priv" not in testDir and (coverStr == "--fcov" or coverStr == "--ccov") else ".elf"
|
||||||
if lockstepMode or coverStr == "--fcov":
|
if lockstepMode or coverStr == "--fcov":
|
||||||
gs = "Mismatches : 0"
|
gs = "** Note: $finish"
|
||||||
elif brekerMode:
|
elif brekerMode:
|
||||||
gs="# trek: info: summary: Test PASSED"
|
gs="# trek: info: summary: Test PASSED"
|
||||||
else:
|
else:
|
||||||
|
4
bin/wsim
4
bin/wsim
@ -101,13 +101,11 @@ def prepSim(args, ElfFile):
|
|||||||
flagsList.append("--ccov")
|
flagsList.append("--ccov")
|
||||||
if args.fcov:
|
if args.fcov:
|
||||||
flagsList.append("--fcov")
|
flagsList.append("--fcov")
|
||||||
defineList.extend(["+define+ENABLE_RVVI_TRACE", "+define+INCLUDE_TRACE2COV", "+define+IDV_INCLUDE_TRACE2COV", "+define+COVER_BASE_RV32I"]) # COVER_BASE_RV32I is just needed to keep riscvISACOV happy, but does not affect tests
|
defineList.extend(["+define+ENABLE_RVVI_TRACE", "+define+FCOV"])
|
||||||
argsList.extend(["+TRACE2COV_ENABLE=1", "+IDV_TRACE2COV=1"])
|
|
||||||
if args.gui:
|
if args.gui:
|
||||||
flagsList.append("--gui")
|
flagsList.append("--gui")
|
||||||
if args.lockstep or args.lockstepverbose:
|
if args.lockstep or args.lockstepverbose:
|
||||||
flagsList.append("--lockstep")
|
flagsList.append("--lockstep")
|
||||||
if args.lockstep or args.lockstepverbose:
|
|
||||||
prefix = lockstepSetup(args)
|
prefix = lockstepSetup(args)
|
||||||
defineList.extend(["+define+USE_IMPERAS_DV", "+define+ENABLE_RVVI_TRACE"])
|
defineList.extend(["+define+USE_IMPERAS_DV", "+define+ENABLE_RVVI_TRACE"])
|
||||||
if args.config == "breker": # Requires a license for the breker tool. See tests/breker/README.md for details
|
if args.config == "breker": # Requires a license for the breker tool. See tests/breker/README.md for details
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# Add Imperas simulator application instruction tracing
|
# Add Imperas simulator application instruction tracing
|
||||||
--verbose --trace --tracechange --traceshowicount --tracemode -tracemem ASX --monitornetschange # --traceafter 300000000
|
--verbose --trace --tracechange --traceshowicount --tracemode --tracemem XSL --monitornetschange # --traceafter 300000000
|
||||||
--override cpu/debugflags=6 --override cpu/verbose=1
|
--override cpu/debugflags=6 --override cpu/verbose=1
|
||||||
--override cpu/show_c_prefix=T
|
|
||||||
|
@ -113,16 +113,11 @@ if {[lcheck lst "--ccov"]} {
|
|||||||
if {[lcheck lst "--fcov"]} {
|
if {[lcheck lst "--fcov"]} {
|
||||||
set IMPERAS_HOME $::env(IMPERAS_HOME)
|
set IMPERAS_HOME $::env(IMPERAS_HOME)
|
||||||
set FunctCoverage 1
|
set FunctCoverage 1
|
||||||
# ImpProprietary is needed for trace2cov for now
|
|
||||||
set FCvlog "+incdir+${FCRVVI}/unpriv \
|
set FCvlog "+incdir+${FCRVVI}/unpriv \
|
||||||
+incdir+${FCRVVI}/priv +incdir+${FCRVVI}/rv64_priv +incdir+${FCRVVI}/rv32_priv \
|
+incdir+${FCRVVI}/priv +incdir+${FCRVVI}/rv64_priv +incdir+${FCRVVI}/rv32_priv \
|
||||||
+incdir+${FCRVVI}/common +incdir+${FCRVVI} \
|
+incdir+${FCRVVI}/common +incdir+${FCRVVI} \
|
||||||
+incdir+$env(WALLY)/addins/cvw-arch-verif/riscvISACOV/source \
|
+incdir+$env(WALLY)/addins/cvw-arch-verif/riscvISACOV/source \
|
||||||
+incdir+${IMPERAS_HOME}/ImpPublic/include/host \
|
${FCRVVI}/*.sv"
|
||||||
+incdir+${IMPERAS_HOME}/ImpProprietary/include/host \
|
|
||||||
${IMPERAS_HOME}/ImpPublic/source/host/rvvi/*.sv \
|
|
||||||
${IMPERAS_HOME}/ImpProprietary/source/host/idv/*.sv"
|
|
||||||
set SVLib " -sv_lib ${IMPERAS_HOME}/lib/Linux64/ImperasLib/imperas.com/verification/riscv/1.0/model "
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# if --lockstep found set flag and remove from list
|
# if --lockstep found set flag and remove from list
|
||||||
|
25
testbench/common/trace2riscvISACOV.sv
Normal file
25
testbench/common/trace2riscvISACOV.sv
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// trace2riscvISACOV.sv
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||||
|
|
||||||
|
`include "RISCV_coverage.svh"
|
||||||
|
|
||||||
|
module trace2riscvISACOV(rvviTrace rvvi);
|
||||||
|
// Connect coverage class to RVVI trace interface
|
||||||
|
coverage #(rvvi.ILEN, rvvi.XLEN, rvvi.FLEN, rvvi.VLEN, rvvi.NHART, rvvi.RETIRE) riscvISACOV;
|
||||||
|
initial begin
|
||||||
|
riscvISACOV = new(rvvi);
|
||||||
|
$display("trace2riscvISACOV: coverage initialized");
|
||||||
|
end
|
||||||
|
|
||||||
|
// Dissassemble instruction from RVVI trace for processing by coverage model
|
||||||
|
string disass;
|
||||||
|
dissassembler #(rvvi.XLEN) dissassembler(rvvi.insn[0][0], disass);
|
||||||
|
|
||||||
|
// Invoke the riscvISACOV sample function on each clock edge for the current Instruction
|
||||||
|
// If RVVI accepts more than one instruction or hart, iterate over all of them in the
|
||||||
|
// correct order of retirement (TODO: multiple instructions/harts not implemented)
|
||||||
|
always_ff @(posedge rvvi.clk) begin
|
||||||
|
riscvISACOV.sample(rvvi.trap[0][0], 0, 0, {$sformatf("%h ", rvvi.insn[0][0]), disass});
|
||||||
|
$display("trace2riscvISACOV: sample taken for instruction %h: %s", rvvi.insn[0][0], disass);
|
||||||
|
end
|
||||||
|
endmodule
|
@ -742,6 +742,7 @@ module wallyTracer import cvw::*; #(parameter cvw_t P) (rvviTrace rvvi);
|
|||||||
end
|
end
|
||||||
|
|
||||||
always_ff @(posedge clk) begin
|
always_ff @(posedge clk) begin
|
||||||
|
$display("wallyTracer: %b", rvvi.insn[0][0]);
|
||||||
if(valid) begin
|
if(valid) begin
|
||||||
if(`STD_LOG) begin
|
if(`STD_LOG) begin
|
||||||
$fwrite(file, "%016x, %08x, %s\t\t", rvvi.pc_rdata[0][0], rvvi.insn[0][0], instrWName);
|
$fwrite(file, "%016x, %08x, %s\t\t", rvvi.pc_rdata[0][0], rvvi.insn[0][0], instrWName);
|
||||||
|
@ -738,8 +738,8 @@ end
|
|||||||
`endif
|
`endif
|
||||||
|
|
||||||
// Functional coverage
|
// Functional coverage
|
||||||
`ifdef INCLUDE_TRACE2COV
|
`ifdef FCOV
|
||||||
trace2cov idv_trace2cov(rvvi); // needed for fcov as of now
|
trace2riscvISACOV trace2riscvISACOV(rvvi);
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -756,8 +756,6 @@ end
|
|||||||
.CMP_CSR (1)
|
.CMP_CSR (1)
|
||||||
) idv_trace2api(rvvi);
|
) idv_trace2api(rvvi);
|
||||||
|
|
||||||
// trace2log idv_trace2log(rvvi); // currently not used
|
|
||||||
|
|
||||||
string filename;
|
string filename;
|
||||||
initial begin
|
initial begin
|
||||||
// imperasDV requires the elffile be defined at the begining of the simulation.
|
// imperasDV requires the elffile be defined at the begining of the simulation.
|
||||||
|
Loading…
Reference in New Issue
Block a user