mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Merge a61ad1c649
into 077c13c8b4
This commit is contained in:
commit
0ca5a088da
@ -321,7 +321,7 @@ def addTestsByDir(testDir, config, sim, coverStr, configs, lockstepMode=0, breke
|
||||
fileStart = "WALLY-COV-ALL" if "cvw-arch-verif/tests" in testDir and "priv" not in testDir and (coverStr == "--fcov" or coverStr == "--ccov") else ""
|
||||
fileEnd = ".elf"
|
||||
if lockstepMode or coverStr == "--fcov":
|
||||
gs = "Mismatches : 0"
|
||||
gs = "** Note: $finish"
|
||||
elif brekerMode:
|
||||
gs="# trek: info: summary: Test PASSED"
|
||||
else:
|
||||
|
9
bin/wsim
9
bin/wsim
@ -27,7 +27,7 @@ def parseArgs():
|
||||
parser.add_argument("--tb", "-t", help="Testbench", choices=["testbench", "testbench_fp"], default="testbench")
|
||||
parser.add_argument("--gui", "-g", help="Simulate with GUI", action="store_true")
|
||||
parser.add_argument("--ccov", "-c", help="Code Coverage", action="store_true")
|
||||
parser.add_argument("--fcov", "-f", help="Functional Coverage with cvw-arch-verif, implies lockstep", action="store_true")
|
||||
parser.add_argument("--fcov", "-f", help="Functional Coverage with cvw-arch-verif", action="store_true")
|
||||
parser.add_argument("--args", "-a", help="Optional arguments passed to simulator via $value$plusargs", default="")
|
||||
parser.add_argument("--params", "-p", help="Optional top-level parameter overrides of the form param=value", default="")
|
||||
parser.add_argument("--define", "-d", help="Optional define macros passed to simulator", default="")
|
||||
@ -101,15 +101,13 @@ def prepSim(args, ElfFile):
|
||||
flagsList.append("--ccov")
|
||||
if args.fcov:
|
||||
flagsList.append("--fcov")
|
||||
defineList.extend(["+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
|
||||
argsList.extend(["+TRACE2COV_ENABLE=1", "+IDV_TRACE2COV=1"])
|
||||
defineList.extend(["+define+ENABLE_RVVI_TRACE", "+define+FCOV"])
|
||||
if args.gui:
|
||||
flagsList.append("--gui")
|
||||
if args.lockstep or args.lockstepverbose:
|
||||
flagsList.append("--lockstep")
|
||||
if args.lockstep or args.lockstepverbose or args.fcov:
|
||||
prefix = lockstepSetup(args)
|
||||
defineList.append("+define+USE_IMPERAS_DV")
|
||||
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
|
||||
ElfFileNoExtension = os.path.splitext(ElfFile)[0]
|
||||
flagsList.append("--breker")
|
||||
@ -154,7 +152,6 @@ def runQuesta(args, flags, prefix):
|
||||
args.params = fr'--params \"{args.params}\"'
|
||||
if args.define:
|
||||
args.define = fr'--define \"{args.define}\"'
|
||||
# fcov implies lockstep
|
||||
cmd = f"do wally.do {args.config} {args.testsuite} {args.tb} {args.args} {args.params} {args.define} {flags}"
|
||||
cmd = f'cd $WALLY/sim/questa; {prefix} vsim {"-c" if not args.gui else ""} -do "{cmd}"'
|
||||
print(f"Running Questa with command: {cmd}")
|
||||
|
@ -6,60 +6,60 @@
|
||||
// It defines which extensions are enabled for that config.
|
||||
|
||||
// Define XLEN, used in covergroups
|
||||
`define XLEN32 1
|
||||
`define XLEN32
|
||||
|
||||
// Define relevant addresses
|
||||
`define ACCESS_FAULT_ADDRESS 32'h0000
|
||||
`define CLINT_BASE 64'h02000000
|
||||
|
||||
// Unprivileged extensions
|
||||
`include "I_coverage.svh"
|
||||
`include "M_coverage.svh"
|
||||
`include "F_coverage.svh"
|
||||
`include "D_coverage.svh"
|
||||
`include "Zba_coverage.svh"
|
||||
`include "Zbb_coverage.svh"
|
||||
`include "Zbc_coverage.svh"
|
||||
`include "Zbs_coverage.svh"
|
||||
`include "ZfaF_coverage.svh"
|
||||
`include "ZfaD_coverage.svh"
|
||||
`include "ZfaZfh_coverage.svh"
|
||||
`include "Zfh_coverage.svh"
|
||||
`include "ZfhD_coverage.svh"
|
||||
`define I_COVERAGE
|
||||
`define M_COVERAGE
|
||||
`define F_COVERAGE
|
||||
`define D_COVERAGE
|
||||
`define ZBA_COVERAGE
|
||||
`define ZBB_COVERAGE
|
||||
`define ZBC_COVERAGE
|
||||
`define ZBS_COVERAGE
|
||||
`define ZFA_F_COVERAGE
|
||||
`define ZFA_D_COVERAGE
|
||||
`define ZFA_ZFH_COVERAGE
|
||||
`define ZFA_ZFH_D_COVERAGE
|
||||
`define ZFH_COVERAGE
|
||||
`define ZFH_D_COVERAGE
|
||||
// Note: Zfhmin is a subset of Zfh, so usually only one or the other would be used. When Zfhmin and D are supported, ZfhD should also be enabled
|
||||
`include "Zfhmin_coverage.svh"
|
||||
`define ZFHMIN_coverage
|
||||
`define ZFHMIN_D_COVERAGE
|
||||
// Note: Zmmul is a subset of M, so usually only one or the other would be used.
|
||||
`include "Zmmul_coverage.svh"
|
||||
`include "Zicond_coverage.svh"
|
||||
`include "Zca_coverage.svh"
|
||||
`include "Zcb_coverage.svh"
|
||||
`include "ZcbM_coverage.svh"
|
||||
`include "ZcbZbb_coverage.svh"
|
||||
`include "Zcf_coverage.svh"
|
||||
`include "Zcd_coverage.svh"
|
||||
`include "Zicsr_coverage.svh"
|
||||
`include "Zbkb_coverage.svh"
|
||||
`include "Zbkc_coverage.svh"
|
||||
`include "Zbkx_coverage.svh"
|
||||
`include "Zknd_coverage.svh"
|
||||
`include "Zkne_coverage.svh"
|
||||
`include "Zknh_coverage.svh"
|
||||
`include "Zaamo_coverage.svh"
|
||||
`include "Zalrsc_coverage.svh"
|
||||
`define ZMMUL_COVERAGE
|
||||
`define ZICOND_COVERAGE
|
||||
`define ZCA_COVERAGE
|
||||
`define ZCB_COVERAGE
|
||||
`define ZCB_M_COVERAGE
|
||||
`define ZCB_ZBB_COVERAGE
|
||||
`define ZCF_COVERAGE
|
||||
`define ZCD_COVERAGE
|
||||
`define ZICSR_COVERAGE
|
||||
`define ZBKB_COVERAGE
|
||||
`define ZBKC_COVERAGE
|
||||
`define ZBKX_COVERAGE
|
||||
`define ZKND_COVERAGE
|
||||
`define ZKNE_COVERAGE
|
||||
`define ZKNH_COVERAGE
|
||||
`define ZAAMO_COVERAGE
|
||||
`define ZALRSC_COVERAGE
|
||||
|
||||
// Privileged extensions
|
||||
`include "ZicsrM_coverage.svh"
|
||||
`include "ZicsrF_coverage.svh"
|
||||
`include "ZicsrU_coverage.svh"
|
||||
`include "RV32VM_coverage.svh"
|
||||
`include "RV32VM_PMP_coverage.svh"
|
||||
`include "EndianU_coverage.svh"
|
||||
`include "EndianM_coverage.svh"
|
||||
`include "EndianS_coverage.svh"
|
||||
`include "ExceptionsM_coverage.svh"
|
||||
`include "ExceptionsZc_coverage.svh"
|
||||
`include "ZicntrU_coverage.svh"
|
||||
`include "ZicntrS_coverage.svh"
|
||||
`include "ZicntrM_coverage.svh"
|
||||
`include "ZfaZfhD_coverage.svh"
|
||||
`include "ZfhminD_coverage.svh"
|
||||
`define RV32VM_COVERAGE
|
||||
`define RV32VM_PMP_coverage
|
||||
`define ZICSRM_COVERAGE
|
||||
`define ZICSRF_COVERAGE
|
||||
`define ZICSRU_COVERAGE
|
||||
`define ENDIANU_COVERAGE
|
||||
`define ENDIANS_COVERAGE
|
||||
`define ENDIANM_COVERAGE
|
||||
`define EXCEPTIONSM_COVERAGE
|
||||
`define EXCEPTIONSZC_COVERAGE
|
||||
`define ZICNTRU_COVERAGE
|
||||
`define ZICNTRS_COVERAGE
|
||||
`define ZICNTRM_COVERAGE
|
||||
|
@ -6,63 +6,63 @@
|
||||
// It defines which extensions are enabled for that config.
|
||||
|
||||
// Define XLEN, used in covergroups
|
||||
`define XLEN64 1
|
||||
`define XLEN64
|
||||
|
||||
// Define relevant addresses
|
||||
`define ACCESS_FAULT_ADDRESS 64'h00000000
|
||||
`define CLINT_BASE 64'h02000000
|
||||
|
||||
// Unprivileged extensions
|
||||
`include "I_coverage.svh"
|
||||
`include "M_coverage.svh"
|
||||
`include "F_coverage.svh"
|
||||
`include "D_coverage.svh"
|
||||
`include "Zba_coverage.svh"
|
||||
`include "Zbb_coverage.svh"
|
||||
`include "Zbc_coverage.svh"
|
||||
`include "Zbs_coverage.svh"
|
||||
`include "ZfaF_coverage.svh"
|
||||
`include "ZfaD_coverage.svh"
|
||||
`include "ZfaZfh_coverage.svh"
|
||||
`include "ZfhD_coverage.svh"
|
||||
`include "Zfh_coverage.svh"
|
||||
`define I_COVERAGE
|
||||
`define M_COVERAGE
|
||||
`define F_COVERAGE
|
||||
`define D_COVERAGE
|
||||
`define ZBA_COVERAGE
|
||||
`define ZBB_COVERAGE
|
||||
`define ZBC_COVERAGE
|
||||
`define ZBS_COVERAGE
|
||||
`define ZFA_F_COVERAGE
|
||||
`define ZFA_D_COVERAGE
|
||||
`define ZFA_ZFH_COVERAGE
|
||||
`define ZFA_ZFH_D_COVERAGE
|
||||
`define ZFH_COVERAGE
|
||||
`define ZFH_D_COVERAGE
|
||||
// Note: Zfhmin is a subset of Zfh, so usually only one or the other would be used. When Zfhmin and D are supported, ZfhD should also be enabled
|
||||
`include "Zfhmin_coverage.svh"
|
||||
`define ZFHMIN_coverage
|
||||
`define ZFHMIN_D_COVERAGE
|
||||
// Note: Zmmul is a subset of M, so usually only one or the other would be used.
|
||||
`include "Zmmul_coverage.svh"
|
||||
`include "Zicond_coverage.svh"
|
||||
`include "Zca_coverage.svh"
|
||||
`include "Zcb_coverage.svh"
|
||||
`include "ZcbM_coverage.svh"
|
||||
`include "ZcbZbb_coverage.svh"
|
||||
`include "ZcbZba_coverage.svh"
|
||||
`include "Zcd_coverage.svh"
|
||||
`include "Zicsr_coverage.svh"
|
||||
`include "Zbkb_coverage.svh"
|
||||
`include "Zbkc_coverage.svh"
|
||||
`include "Zbkx_coverage.svh"
|
||||
`include "Zknd_coverage.svh"
|
||||
`include "Zkne_coverage.svh"
|
||||
`include "Zknh_coverage.svh"
|
||||
`include "Zaamo_coverage.svh"
|
||||
`include "Zalrsc_coverage.svh"
|
||||
`define ZMMUL_COVERAGE
|
||||
`define ZICOND_COVERAGE
|
||||
`define ZCA_COVERAGE
|
||||
`define ZCB_COVERAGE
|
||||
`define ZCB_M_COVERAGE
|
||||
`define ZCB_ZBB_COVERAGE
|
||||
`define ZCB_ZBA_COVERAGE
|
||||
`define ZCD_COVERAGE
|
||||
`define ZICSR_COVERAGE
|
||||
`define ZBKB_COVERAGE
|
||||
`define ZBKC_COVERAGE
|
||||
`define ZBKX_COVERAGE
|
||||
`define ZKND_COVERAGE
|
||||
`define ZKNE_COVERAGE
|
||||
`define ZKNH_COVERAGE
|
||||
`define ZAAMO_COVERAGE
|
||||
`define ZALRSC_COVERAGE
|
||||
|
||||
// Privileged extensions
|
||||
`include "RV64VM_coverage.svh"
|
||||
`include "ZicsrM_coverage.svh"
|
||||
`include "ZicsrF_coverage.svh"
|
||||
`include "ZicsrU_coverage.svh"
|
||||
`include "EndianU_coverage.svh"
|
||||
`include "EndianM_coverage.svh"
|
||||
`include "EndianS_coverage.svh"
|
||||
`include "ExceptionsM_coverage.svh"
|
||||
`include "ExceptionsZc_coverage.svh"
|
||||
`include "ZicntrU_coverage.svh"
|
||||
`include "ZicntrS_coverage.svh"
|
||||
`include "ZicntrM_coverage.svh"
|
||||
`include "ZfaZfhD_coverage.svh"
|
||||
`include "ZfhminD_coverage.svh"
|
||||
`define RV64VM_COVERAGE
|
||||
`define ZICSRM_COVERAGE
|
||||
`define ZICSRF_COVERAGE
|
||||
`define ZICSRU_COVERAGE
|
||||
`define ENDIANU_COVERAGE
|
||||
`define ENDIANS_COVERAGE
|
||||
`define ENDIANM_COVERAGE
|
||||
`define EXCEPTIONSM_COVERAGE
|
||||
`define EXCEPTIONSZC_COVERAGE
|
||||
`define ZICNTRU_COVERAGE
|
||||
`define ZICNTRS_COVERAGE
|
||||
`define ZICNTRM_COVERAGE
|
||||
|
||||
// `include "RV64VM_PMP_coverage.svh"
|
||||
// `include "RV64CBO_VM_coverage.svh"
|
||||
// `include "RV64CBO_PMP_coverage.svh"
|
||||
// `define RV64VM_PMP_COVERAGE
|
||||
// `define RV64CBO_VM_COVERAGE
|
||||
// `define RV64CBO_PMP_COVERAGE
|
||||
|
@ -1,4 +1,3 @@
|
||||
# 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/show_c_prefix=T
|
||||
|
@ -111,15 +111,17 @@ if {[lcheck lst "--ccov"]} {
|
||||
|
||||
# if --fcov found set flag and remove from list
|
||||
if {[lcheck lst "--fcov"]} {
|
||||
set IMPERAS_HOME $::env(IMPERAS_HOME)
|
||||
set FunctCoverage 1
|
||||
set FCvlog "+incdir+${FCRVVI}/unpriv \
|
||||
+incdir+${FCRVVI}/priv +incdir+${FCRVVI}/rv64_priv +incdir+${FCRVVI}/rv32_priv \
|
||||
+incdir+${FCRVVI}/common +incdir+${FCRVVI} \
|
||||
+incdir+$env(WALLY)/addins/cvw-arch-verif/riscvISACOV/source"
|
||||
+incdir+$env(WALLY)/addins/cvw-arch-verif/riscvISACOV/source \
|
||||
${FCRVVI}/*.sv"
|
||||
}
|
||||
|
||||
# if --lockstep or --fcov found set flag and remove from list
|
||||
if {[lcheck lst "--lockstep"] || $FunctCoverage == 1} {
|
||||
# if --lockstep found set flag and remove from list
|
||||
if {[lcheck lst "--lockstep"]} {
|
||||
set IMPERAS_HOME $::env(IMPERAS_HOME)
|
||||
set lockstep 1
|
||||
set lockstepvlog "+incdir+${IMPERAS_HOME}/ImpPublic/include/host \
|
||||
|
31
testbench/common/trace2riscvISACOV.sv
Normal file
31
testbench/common/trace2riscvISACOV.sv
Normal file
@ -0,0 +1,31 @@
|
||||
// trace2riscvISACOV.sv
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
||||
|
||||
// Load which extensions are supported in this configuration (from $WALLY/config/<config>/coverage.svh)
|
||||
`include "coverage.svh"
|
||||
`include "disassemble.svh"
|
||||
|
||||
// Load the coverage classes
|
||||
`include "RISCV_coverage.svh"
|
||||
|
||||
module trace2riscvISACOV(rvviTrace rvvi);
|
||||
string disass;
|
||||
// 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
|
||||
|
||||
// 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
|
||||
if (rvvi.valid[0][0] == 1) begin
|
||||
disass = disassemble(rvvi.insn[0][0]);
|
||||
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);
|
||||
$display("0x%h: %s", rvvi.insn[0][0], disass);
|
||||
end
|
||||
end
|
||||
endmodule
|
@ -742,6 +742,7 @@ module wallyTracer import cvw::*; #(parameter cvw_t P) (rvviTrace rvvi);
|
||||
end
|
||||
|
||||
always_ff @(posedge clk) begin
|
||||
$display("wallyTracer: %b", rvvi.insn[0][0]);
|
||||
if(valid) begin
|
||||
if(`STD_LOG) begin
|
||||
$fwrite(file, "%016x, %08x, %s\t\t", rvvi.pc_rdata[0][0], rvvi.insn[0][0], instrWName);
|
||||
|
@ -731,17 +731,22 @@ module testbench;
|
||||
end
|
||||
end
|
||||
|
||||
// RVVI trace for functional coverage and lockstep
|
||||
`ifdef ENABLE_RVVI_TRACE
|
||||
rvviTrace #(.XLEN(P.XLEN), .FLEN(P.FLEN)) rvvi();
|
||||
wallyTracer #(P) wallyTracer(rvvi);
|
||||
`endif
|
||||
|
||||
// Functional coverage
|
||||
`ifdef FCOV
|
||||
trace2riscvISACOV trace2riscvISACOV(rvvi);
|
||||
`endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ImperasDV Co-simulator hooks
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
`ifdef USE_IMPERAS_DV
|
||||
|
||||
rvviTrace #(.XLEN(P.XLEN), .FLEN(P.FLEN)) rvvi();
|
||||
wallyTracer #(P) wallyTracer(rvvi);
|
||||
|
||||
trace2log idv_trace2log(rvvi);
|
||||
trace2cov idv_trace2cov(rvvi);
|
||||
|
||||
// enabling of comparison types
|
||||
trace2api #(.CMP_PC (1),
|
||||
.CMP_INS (1),
|
||||
|
Loading…
Reference in New Issue
Block a user