Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
82587cd
Add RVA23 coverage and test generators
Apr 18, 2026
66fcf07
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 18, 2026
078953b
Merge branch 'act4' into RVA23-clean
Ammarahwakeel Apr 21, 2026
ab035c5
Required changes in Ssuu64xl
Apr 21, 2026
4c6713b
Merge branch 'RVA23-clean' of https://github.com/Ammarahwakeel/riscv-…
Apr 21, 2026
b898ef9
Required changes in zic64bzicboz
Apr 21, 2026
fe9b349
Added required changs in za64rs
Apr 21, 2026
b362c9a
Merge branch 'act4' into RVA23-clean
Ammarahwakeel Apr 22, 2026
ebacd87
Required changes in S
Apr 22, 2026
98760dd
Merge branch 'RVA23-clean' of https://github.com/Ammarahwakeel/riscv-…
Apr 22, 2026
7ed0f52
Added Sm1p13 coverage and tests
Apr 22, 2026
17a22fe
Excluded Za64rs for spike and qemu metrices
Apr 22, 2026
9c2ac8d
Removed trailing space
Apr 22, 2026
17bc6b3
Excluded Za64rs from runnning on cvw matrix
Apr 22, 2026
3c01518
Added indentation in S coverage
Apr 22, 2026
2e951b1
Fixed indentations and seperated out misa_b and misa_v bits
Apr 22, 2026
6b70bbf
Added interrupt latency macro for Sm1p13
Apr 22, 2026
d94b75d
Added macro
Apr 22, 2026
de95c39
Merge branch 'act4' into RVA23-clean
Ammarahwakeel Apr 23, 2026
f22523d
Required changes for ss1p13
Apr 24, 2026
87af4c9
Required changes in sm1p13
Apr 24, 2026
dac2692
Required changes in Ssu64xl
Apr 24, 2026
eff5af0
Applied range for coveing offsets
Apr 24, 2026
ba16006
Fixed coverage init file
Apr 24, 2026
74e06c8
Added the read back scenerio of uxl bits in ss1p13
Apr 24, 2026
ce80f5c
Added documentation
Apr 24, 2026
77dc469
Added requested changes in coverage of ss1p13, sm1p13
Apr 24, 2026
7d36395
fixed minor typos in python generators
Apr 24, 2026
d2064ed
Merge branch 'act4' into RVA23-clean
Ammarahwakeel Apr 24, 2026
4e66927
Aded RVMODEL_MSIP_ADDRESS macro in config files
Apr 24, 2026
f71c313
Merge branch 'act4' into RVA23-clean
Ammarahwakeel Apr 25, 2026
8b04dcf
Merge branch 'act4' into RVA23-clean
Ammarahwakeel Apr 25, 2026
d34f7b9
Merge branch 'act4' into RVA23-clean
davidharrishmc Apr 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/cores/cvw/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Requires Verilator and the CVW repository

ci_enabled: true
exclude_extensions: "Sm,S,InterruptsU,PMPSm,ExceptionsZalrsc,ExceptionsZaamo"
exclude_extensions: "Sm,S,InterruptsU,PMPSm,ExceptionsZalrsc,ExceptionsZaamo,Za64rs"
Comment thread
Ammarahwakeel marked this conversation as resolved.
Comment thread
Ammarahwakeel marked this conversation as resolved.
apt_packages: "autoconf flex bison help2man libfl-dev ccache"
install_script: ".github/scripts/install-cvw.sh"
setup_script: ".github/scripts/setup-cvw.sh"
2 changes: 1 addition & 1 deletion config/qemu/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

ci_enabled: true
# TODO: Priv tests mismatch due to config issues. Atomics failure still needs to be diagnosed.
exclude_extensions: "Sm,S,Zalrsc,Zacas,ZacasZabha,InterruptsSm,PMPSm,PMPmisaligned,ExceptionsZalrsc,ExceptionsZicboU,ExceptionsZicboS,Svadu,SvaduPMP,Svnapot,Svpbmt,SvZicbo,ExceptionsZaamo"
exclude_extensions: "Sm,S,Zalrsc,Zacas,ZacasZabha,InterruptsSm,PMPSm,PMPmisaligned,ExceptionsZalrsc,ExceptionsZicboU,ExceptionsZicboS,Svadu,SvaduPMP,Svnapot,Svpbmt,SvZicbo,ExceptionsZaamo,Za64rs"
install_script: ".github/scripts/install-qemu.sh"
apt_packages: "libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev ninja-build"
2 changes: 1 addition & 1 deletion config/spike/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

ci_enabled: true
# TODO: Priv tests mismatch due to config issues. Atomics failure still needs to be diagnosed.
exclude_extensions: "Sm,ExceptionsZc,S,InterruptsSm,PMPmisaligned,ExceptionsZalrsc,Svadu,SvaduPMP,Svnapot,Svpbmt,SvZicbo,ExceptionsZaamo"
exclude_extensions: "Sm,ExceptionsZc,S,InterruptsSm,PMPmisaligned,ExceptionsZalrsc,Svadu,SvaduPMP,Svnapot,Svpbmt,SvZicbo,ExceptionsZaamo,Za64rs"
install_script: ".github/scripts/install-spike.sh"
apt_packages: "device-tree-compiler libboost-regex-dev libboost-system-dev"
12 changes: 12 additions & 0 deletions coverpoints/coverage/RISCV_coverage_base_init.svh
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@
`cover_info("// SsstrictV - Enabled");
`include "SsstrictV_coverage_init.svh"
`endif
`ifdef COVER_SSU64XL
`cover_info("// Ssu64xl - Enabled");
`include "Ssu64xl_coverage_init.svh"
`endif
`ifdef COVER_SV
`cover_info("// Sv - Enabled");
`include "Sv_coverage_init.svh"
Expand Down Expand Up @@ -326,6 +330,10 @@
`cover_info("// Vx8 - Enabled");
`include "Vx8_coverage_init.svh"
`endif
`ifdef COVER_ZA64RS
`cover_info("// Za64rs - Enabled");
`include "Za64rs_coverage_init.svh"
`endif
`ifdef COVER_ZAAMO
`cover_info("// Zaamo - Enabled");
`include "Zaamo_coverage_init.svh"
Expand Down Expand Up @@ -446,6 +454,10 @@
`cover_info("// ZfhminD - Enabled");
`include "ZfhminD_coverage_init.svh"
`endif
`ifdef COVER_ZIC64BZICBOZ
`cover_info("// Zic64bzicboz - Enabled");
`include "Zic64bzicboz_coverage_init.svh"
`endif
`ifdef COVER_ZICBOM
`cover_info("// Zicbom - Enabled");
`include "Zicbom_coverage_init.svh"
Expand Down
9 changes: 9 additions & 0 deletions coverpoints/coverage/RISCV_coverage_base_sample.svh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@
`ifdef COVER_SSSTRICTV
ssstrictv_sample(hart, issue, ins);
`endif
`ifdef COVER_SSU64XL
ssu64xl_sample(hart, issue, ins);
`endif
`ifdef COVER_SV
sv_sample(hart, issue, ins);
`endif
Expand Down Expand Up @@ -247,6 +250,9 @@
`ifdef COVER_VX8
vx8_sample(hart, issue, ins);
`endif
`ifdef COVER_ZA64RS
za64rs_sample(hart, issue, ins);
`endif
`ifdef COVER_ZAAMO
zaamo_sample(hart, issue, ins);
`endif
Expand Down Expand Up @@ -337,6 +343,9 @@
`ifdef COVER_ZFHMIND
zfhmind_sample(hart, issue, ins);
`endif
`ifdef COVER_ZIC64BZICBOZ
zic64bzicboz_sample(hart, issue, ins);
`endif
`ifdef COVER_ZICBOM
zicbom_sample(hart, issue, ins);
`endif
Expand Down
9 changes: 9 additions & 0 deletions coverpoints/coverage/RISCV_coverage_config.svh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@
`ifdef SSSTRICTV_COVERAGE
`include "SsstrictV_coverage.svh"
`endif
`ifdef SSU64XL_COVERAGE
`include "Ssu64xl_coverage.svh"
`endif
`ifdef SV_COVERAGE
`include "Sv_coverage.svh"
`endif
Expand Down Expand Up @@ -248,6 +251,9 @@
`ifdef VX8_COVERAGE
`include "Vx8_coverage.svh"
`endif
`ifdef ZA64RS_COVERAGE
`include "Za64rs_coverage.svh"
`endif
`ifdef ZAAMO_COVERAGE
`include "Zaamo_coverage.svh"
`endif
Expand Down Expand Up @@ -338,6 +344,9 @@
`ifdef ZFHMIND_COVERAGE
`include "ZfhminD_coverage.svh"
`endif
`ifdef ZIC64BZICBOZ_COVERAGE
`include "Zic64bzicboz_coverage.svh"
`endif
`ifdef ZICBOM_COVERAGE
`include "Zicbom_coverage.svh"
`endif
Expand Down
18 changes: 18 additions & 0 deletions coverpoints/priv/S_coverage.svh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ covergroup S_scause_cg with function sample(ins_t ins);
// main coverpoints
cp_scause_write_exception: cross priv_mode_s, csrrw, scause, scause_exception_values, scause_exception; // CSR write of scause in S mode with interesting values
cp_scause_write_interrupt: cross priv_mode_s, csrrw, scause, scause_interrupt_values, scause_interrupt; // CSR write of scause in S mode with interesting values

endgroup


Expand All @@ -104,6 +105,23 @@ covergroup S_sstatus_cg with function sample(ins_t ins);
// main coverpoints
cp_sstatus_sd_write: cross priv_mode_s, csrrw, sstatus, cp_sstatus_sd, cp_sstatus_fs, cp_sstatus_vs, cp_sstatus_xs;

`ifdef SS1P13_SUPPORTED
Comment thread
Ammarahwakeel marked this conversation as resolved.
`ifdef XLEN64
uxl_write_attempt: coverpoint ins.current.rs1_val[33:32] {
bins attempt_1 = {2'b01};
bins attempt_2 = {2'b10};
}
sstatus_uxl_after: coverpoint get_csr_val(ins.hart, ins.issue, `SAMPLE_AFTER, "sstatus", "uxl") {
Comment thread
Ammarahwakeel marked this conversation as resolved.
Outdated
// empty bins: auto-observes what DUT actually stored, no assertion on value
}
csrop: coverpoint ins.current.insn {
wildcard bins csrrw = {CSRRW};
}
// main coverpoints
cp_sxlen_ge_uxlen: cross priv_mode_s, csrop, sstatus, uxl_write_attempt, sstatus_uxl_after;
`endif // XLEN64
`endif // SS1P13_SUPPORTED

endgroup

covergroup S_sprivinst_cg with function sample(ins_t ins);
Expand Down
33 changes: 33 additions & 0 deletions coverpoints/priv/Sm_coverage.svh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ covergroup Sm_mcause_cg with function sample(ins_t ins);
// This is Sm machine-mode testing, so all coverpoints are in Machine mode.
cp_mcause_write_exception: cross priv_mode_m, csrrw, mcause, mcause_exception_values, mcause_exception; // CSR write of mcause in M mode with interesting values
cp_mcause_write_interrupt: cross priv_mode_m, csrrw, mcause, mcause_interrupt_values, mcause_interrupt; // CSR write of mcause in M mode with interesting values

endgroup


Expand Down Expand Up @@ -413,6 +414,38 @@ covergroup Sm_mcsr_cg with function sample(ins_t ins);
cp_mtimeh_write : cross priv_mode_m, csrr, timeh_csr; // assumes mtimeh has been written
`endif
`endif

`ifdef SM1P13_SUPPORTED
misa_b_bit: coverpoint get_csr_val(ins.hart, ins.issue, `SAMPLE_AFTER, "misa", "b")[0] {
Comment thread
Ammarahwakeel marked this conversation as resolved.
Outdated
bins b_set = {1'b1};
bins b_clear = {1'b0};
}
misa_v_bit: coverpoint get_csr_val(ins.hart, ins.issue, `SAMPLE_AFTER, "misa", "v")[0] {
bins v_set = {1'b1};
bins v_clear = {1'b0};
}
mip_csr: coverpoint ins.current.insn[31:20] {
bins mip = {CSR_MIP};
}
mip_msip_after: coverpoint get_csr_val(ins.hart, ins.issue, `SAMPLE_AFTER, "mip", "msip")[0] {
Comment thread
Ammarahwakeel marked this conversation as resolved.
Outdated
bins msip_set = {1'b1};
bins msip_clear = {1'b0};
}

cp_misa_b: cross priv_mode_m, misa, csrop, misa_b_bit;
cp_misa_v: cross priv_mode_m, misa, csrop, misa_v_bit;
cp_msip: cross priv_mode_m, csrr, mip_csr, mip_msip_after;

`ifdef XLEN32
medelegh: coverpoint ins.current.insn[31:20] {
bins medelegh = {CSR_MEDELEGH};
}

cp_medelegh: cross priv_mode_m, csrrw, medelegh, rs1_ones; // RV32 only: write all 1s to medelegh and read back
`endif // XLEN32
`endif // SM1P13_SUPPORTED


endgroup

function void sm_sample(int hart, int issue, ins_t ins);
Expand Down
37 changes: 37 additions & 0 deletions coverpoints/priv/Ssu64xl_coverage.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
///////////////////////////////////////////////
// RISC-V Architectural Functional Coverage Covergroups
//
// Written: Ammarah Wakeel email:ammarahwakeel9@gmail.com (UET, April 2026)
//
// Copyright (C) : 2026 Harvey Mudd College, 10x Engineers, UET Lahore, Habib University
// SPDX-License-Identifier: Apache-2.0
//
// Description: Coverage for RVA23 profile - Ssu64xl extension
//
///////////////////////////////////////////////

`define COVER_SSU64XL

covergroup Ssu64xl_cg with function sample(ins_t ins);
option.per_instance = 0;

Comment thread
Ammarahwakeel marked this conversation as resolved.
`include "general/RISCV_coverage_standard_coverpoints.svh"

`ifdef XLEN64

sstatus_uxl_after: coverpoint get_csr_val(ins.hart, ins.issue, `SAMPLE_AFTER, "sstatus", "uxl") {
bins uxl_is_10 = {2'b10};
}
gpr_bit63: coverpoint ins.current.rd_val[63] {
bins bit63_set = {1'b1};
}

cp_ssu64xl: cross priv_mode_u, sstatus_uxl_after, gpr_bit63;

`endif

endgroup

function void ssu64xl_sample(int hart, int issue, ins_t ins);
Ssu64xl_cg.sample(ins);
endfunction
11 changes: 11 additions & 0 deletions coverpoints/priv/Ssu64xl_coverage_init.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
///////////////////////////////////////////////
// RISC-V Architectural Functional Coverage Covergroups Initialization File
//
// Copyright (C) 2026 Harvey Mudd College, 10x Engineers, UET Lahore, Habib University
//
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////

Ssu64xl_cg = new();
Ssu64xl_cg.set_inst_name("obj_Ssu64xl");
38 changes: 38 additions & 0 deletions coverpoints/priv/Za64rs_coverage.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
///////////////////////////////////////////////
// RISC-V Architectural Functional Coverage Covergroups
//
// Written: Ammarah Wakeel email:ammarahwakeel9@gmail.com (UET, April 2026)
//
// Copyright (C) : 2026 Harvey Mudd College, 10x Engineers, UET Lahore, Habib University
// SPDX-License-Identifier: Apache-2.0
//
// Description: Coverage for Za64rs extension (Reservation sets are contiguous, naturally aligned, and a maximum of 64 bytes)
///////////////////////////////////////////////


`define COVER_ZA64RS

covergroup Za64rs_cg with function sample(ins_t ins);
option.per_instance = 0;
`include "general/RISCV_coverage_standard_coverpoints.svh"

lr_w_instr: coverpoint ins.prev.insn {
wildcard bins lr_w = {LR_W};
}
sc_w_instr: coverpoint ins.current.insn {
wildcard bins sc_w = {SC_W};
}
lr_w_base_aligned: coverpoint ins.prev.rs1_val[5:0] {
bins aligned_64 = {6'd0};
}
sc_offset: coverpoint ins.current.rs1_val[6:0] {
Comment thread
Ammarahwakeel marked this conversation as resolved.
bins offset_aligned[] = {[7'd0 : 7'd64]} with (item % 4 == 0);
}

cp_za64rs: cross sc_w_instr, sc_offset, lr_w_instr, lr_w_base_aligned ;

endgroup

function void za64rs_sample(int hart, int issue, ins_t ins);
Za64rs_cg.sample(ins);
endfunction
11 changes: 11 additions & 0 deletions coverpoints/priv/Za64rs_coverage_init.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
///////////////////////////////////////////////
// RISC-V Architectural Functional Coverage Covergroups Initialization File
//
// Copyright (C) 2026 Harvey Mudd College, 10x Engineers, UET Lahore, Habib University
//
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////

Za64rs_cg = new();
Za64rs_cg.set_inst_name("obj_Za64rs");
31 changes: 31 additions & 0 deletions coverpoints/priv/Zic64bzicboz_coverage.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
///////////////////////////////////////////////
// RISC-V Architectural Functional Coverage Covergroups
//
// Written: Ammarah Wakeel email:ammarahwakeel9@gmail.com (UET, April 2026)
//
// Copyright (C) : 2026 Harvey Mudd College, 10x Engineers, UET Lahore, Habib University
// SPDX-License-Identifier: Apache-2.0
//
// Description: Coverage for RVA23U64 profile - Zic64bzicboz extension
///////////////////////////////////////////////

`define COVER_ZIC64BZICBOZ

covergroup Zic64bzicboz_cg with function sample(ins_t ins);
option.per_instance = 0;
`include "general/RISCV_coverage_standard_coverpoints.svh"

cbo_zero: coverpoint ins.current.insn {
wildcard bins cbo_zero = {CBO_ZERO};
}
cbo_zero_offset: coverpoint ins.current.rs1_val[6:0] {
Comment thread
Ammarahwakeel marked this conversation as resolved.
bins offset_aligned[] = {[7'd0 : 7'd64]} with (item % 4 == 0);
}

cp_zi64cb: cross cbo_zero, cbo_zero_offset ;

endgroup

function void zic64bzicboz_sample(int hart, int issue, ins_t ins);
Zic64bzicboz_cg.sample(ins);
endfunction
11 changes: 11 additions & 0 deletions coverpoints/priv/Zic64bzicboz_coverage_init.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
///////////////////////////////////////////////
// RISC-V Architectural Functional Coverage Covergroups Initialization File
//
// Copyright (C) 2026 Harvey Mudd College, 10x Engineers, UET Lahore, Habib University
//
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////

Zic64bzicboz_cg = new();
Zic64bzicboz_cg.set_inst_name("obj_Zic64bzicboz");
43 changes: 43 additions & 0 deletions generators/testgen/src/testgen/priv/extensions/S.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,50 @@ def _generate_sstatus_sd_tests(test_data: TestData) -> list[str]:
gen_csr_write_sigupd(check_reg, "sstatus", test_data),
]
)

lines.append(f"\nCSRW(sstatus, x{save_reg}) # restore CSR")

lines.extend(
[
"",
"#ifdef SS1P13_SUPPORTED",
Comment thread
Ammarahwakeel marked this conversation as resolved.
"#if __riscv_xlen == 64",
comment_banner(
f"{coverpoint}",
"Ss1p13: from S-mode attempt to set sstatus.UXL = 1 and UXL = 2.\n"
"UXL=2 must be silently rejected when SXLEN=32 (UXLEN <= SXLEN).",
),
f"CSRR(x{save_reg}, sstatus)",
"",
]
)

for uxl, label in ((1, "uxlen32"), (2, "uxlen64")):
lines.extend(
[
"",
f"# Testcase: Ss1p13 attempt to set sstatus.UXL = {uxl} ({label})",
f"CSRR(x{check_reg}, sstatus) # read current sstatus into GPR",
f"LI(x{reg2}, {~(3 << 32) & 0xFFFFFFFFFFFFFFFF}) # mask to clear UXL bits [33:32]",
f"and x{check_reg}, x{check_reg}, x{reg2} # clear UXL bits [33:32]",
f"LI(x{reg2}, {uxl << 32}) # UXL={uxl} shifted into position [33:32]",
f"or x{check_reg}, x{check_reg}, x{reg2} # OR in desired UXL value",
test_data.add_testcase(f"uxl_attempt_{uxl}", coverpoint, covergroup),
Comment thread
Ammarahwakeel marked this conversation as resolved.
gen_csr_write_sigupd(check_reg, "sstatus", test_data),
f"CSRR(x{check_reg}, sstatus)", # read back what DUT actually stored
write_sigupd(check_reg, test_data),
Comment thread
Ammarahwakeel marked this conversation as resolved.
]
)

lines.extend(
[
"",
f"CSRW(sstatus, x{save_reg}) # restore sstatus after Ss1p13 UXL tests",
"#endif // XLEN64",
"#endif // SS1P13_SUPPORTED",
]
)

test_data.int_regs.return_registers([save_reg, check_reg, reg1, reg2, reg3])
return lines

Expand Down
Loading
Loading