Skip to content

Commit

Permalink
Merge pull request #2281 from silabs-hfegran/dev_hf_cov_fixup
Browse files Browse the repository at this point in the history
Coverage & decoder fixup
  • Loading branch information
silabs-robin authored Nov 7, 2023
2 parents dc6620e + 9aee3e5 commit 233cb1f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
12 changes: 7 additions & 5 deletions cv32e40s/env/uvme/cov/uvme_exceptions_covg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ covergroup cg_exceptions

`per_instance_fcov

cp_trap : coverpoint isacov.instr.rvfi.trap {
cp_trap : coverpoint isacov.instr.rvfi.trap.trap {
bins trap = {1};
}
cp_intr : coverpoint isacov.instr.rvfi.intr {
bins intr = {1};
cp_intr : coverpoint isacov.instr.rvfi.intr.interrupt {
bins interrupt = {1};
}
cp_imm12 : coverpoint isacov.instr.csr_val {
bins imm12[16] = {[0:$]};
Expand All @@ -41,15 +41,17 @@ covergroup cg_exceptions
cp_no_ebreakm : coverpoint (isacov.instr.rvfi.csrs["dcsr"].get_csr_retirement_data()[15]) {
bins no_ebreakm = {0};
}
cp_mcause : coverpoint isacov.instr.rvfi.csrs["mcause"].get_csr_retirement_data() {
cp_mcause : coverpoint isacov.instr.rvfi.csrs["mcause"].get_csr_retirement_data()[10:0] {
bins reset = {0};
bins ins_acc_fault = {1};
bins illegal_ins = {2};
bins breakpoint = {3};
bins load_acc_fault = {5};
bins store_amo_acc_fault = {7};
bins ecall_umode = {8};
bins ecall = {11};
bins ins_bus_fault = {48};
bins ins_bus_fault = {24};
bins ins_parity_fault = {25};
}
cp_pcr_mtvec : coverpoint (isacov.instr.rvfi.pc_rdata[31:2] == isacov.instr.rvfi.csrs["mtvec"].get_csr_retirement_data()[31:2]) {
bins one = {1};
Expand Down
16 changes: 16 additions & 0 deletions lib/isa_decoder/isa_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,22 @@
asm.rs1.valid = 1;
asm.rs1.valid_gpr_rvc = 1;
asm.imm.valid = 1;
end else if (name inside { C_ANDI }) begin
asm.rd.gpr = get_gpr_from_gpr_rvc(instr.compressed.format.cb.rd_rs1.gpr);
asm.rd.gpr_rvc = instr.compressed.format.cb.rd_rs1.gpr;
asm.rs1.gpr = get_gpr_from_gpr_rvc(instr.compressed.format.cb.rd_rs1.gpr);
asm.rs1.gpr_rvc = instr.compressed.format.cb.rd_rs1.gpr;
asm.imm.imm_raw = { instr.compressed.format.cb.offset_12_10[12], instr.compressed.format.cb.offset_6_2 };
asm.imm.imm_raw_sorted = { instr.compressed.format.cb.offset_12_10[12], instr.compressed.format.cb.offset_6_2 };
asm.imm.imm_type = IMM;
asm.imm.width = 6;
asm.imm.sign_ext = 1;
asm.imm.imm_value = get_imm_value_cb({ instr.compressed.format.cb.offset_12_10[12], instr.compressed.format.cb.offset_6_2 });
asm.rd.valid = 1;
asm.rd.valid_gpr_rvc = 1;
asm.rs1.valid = 1;
asm.rs1.valid_gpr_rvc = 1;
asm.imm.valid = 1;
end
end
CJ_TYPE: begin
Expand Down
3 changes: 2 additions & 1 deletion lib/uvm_agents/uvma_isacov/uvma_isacov_mon.sv
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ function void uvma_isacov_mon_c::write_rvfi_instr(uvma_rvfi_instr_seq_item_c#(IL
// might also interfere with the spike implementation.
// the "get_rx"-functions should no longer be needed if we supply the translated values to
// the coverage model.
mon_trn.instr.c_rdrs1 = instr_asm.rd.valid_gpr_rvc ? instr_asm.rd.gpr_rvc : instr_asm.rd.gpr;
mon_trn.instr.c_rdrs1 = instr_asm.rd.valid ? ( instr_asm.rd.valid_gpr_rvc ? instr_asm.rd.gpr_rvc : instr_asm.rd.gpr )
: ( instr_asm.rs1.valid_gpr_rvc ? instr_asm.rs1.gpr_rvc : instr_asm.rs1.gpr );
mon_trn.instr.c_rdp = instr_asm.rd.valid_gpr_rvc ? instr_asm.rd.gpr_rvc : instr_asm.rd.gpr;
mon_trn.instr.c_rs1s = instr_asm.rs1.valid_gpr_rvc ? instr_asm.rs1.gpr_rvc : instr_asm.rs1.gpr;
mon_trn.instr.c_rs2s = instr_asm.rs2.valid_gpr_rvc ? instr_asm.rs2.gpr_rvc : instr_asm.rs2.gpr;
Expand Down

0 comments on commit 233cb1f

Please sign in to comment.