Skip to content

Commit c48ca23

Browse files
committed
[dv] Various fcov fixes and tweaks
1 parent 581f5d4 commit c48ca23

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

dv/uvm/core_ibex/fcov/core_ibex_fcov_if.sv

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,9 @@ interface core_ibex_fcov_if import ibex_pkg::*; (
635635
}
636636

637637
priv_mode_exception_cross: cross cp_priv_mode_id, cp_ls_pmp_exception, cp_ls_error_exception {
638-
illegal_bins pmp_and_error_exeption_both_or_none =
638+
illegal_bins pmp_and_error_exeption_both =
639639
(binsof(cp_ls_pmp_exception) intersect {1'b1} &&
640-
binsof(cp_ls_error_exception) intersect {1'b1}) ||
641-
(binsof(cp_ls_pmp_exception) intersect {1'b0} &&
642-
binsof(cp_ls_error_exception) intersect {1'b0});
640+
binsof(cp_ls_error_exception) intersect {1'b1});
643641
}
644642

645643
stall_cross: cross cp_id_instr_category, cp_stall_type_id {

dv/uvm/core_ibex/fcov/core_ibex_pmp_fcov_if.sv

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,20 @@ interface core_ibex_pmp_fcov_if import ibex_pkg::*; #(
121121
assign pmp_iside2_nomatch = ~|pmp_iside2_match;
122122
assign pmp_dside_nomatch = ~|pmp_dside_match;
123123

124-
assign misaligned_pmp_err_last = load_store_unit_i.fcov_ls_first_req ?
125-
load_store_unit_i.data_pmp_err_i :
126-
misaligned_pmp_err_last;
127-
128124
// Store the Data Channel PMP match info from the first request to calculate boundary cross
129125
always @(posedge clk_i or negedge rst_ni) begin
130126
if (!rst_ni) begin
131-
pmp_dside_match_last <= '0;
127+
pmp_dside_match_last <= '0;
128+
misaligned_pmp_err_last <= 1'b0;
132129
end else if (load_store_unit_i.fcov_ls_first_req) begin
133-
pmp_dside_match_last <= pmp_dside_match;
130+
pmp_dside_match_last <= pmp_dside_match;
131+
misaligned_pmp_err_last <= load_store_unit_i.data_pmp_err_i;
134132
end
135133
end
136134

137135
assign pmp_iside_boundary_cross = |(pmp_iside_match ^ pmp_iside2_match);
138-
assign pmp_dside_boundary_cross = |(pmp_dside_match ^ pmp_dside_match_last);
136+
assign pmp_dside_boundary_cross = |(pmp_dside_match ^ pmp_dside_match_last) &
137+
load_store_unit_i.fcov_ls_second_req;
139138

140139
for (genvar i_region = 0; i_region < PMPNumRegions; i_region += 1) begin : g_pmp_region_fcov
141140
pmp_priv_bits_e pmp_region_priv_bits;
@@ -513,7 +512,7 @@ interface core_ibex_pmp_fcov_if import ibex_pkg::*; #(
513512
iff (fcov_csr_write && cs_registers_i.csr_addr_i == CSR_MSECCFG) {
514513
// Trying to enable RLB when RLB is disabled and locked regions present will result
515514
// with an ignored write
516-
bins sticky = binsof(cp_rlb) intersect {1} && binsof(cp_wdata_rlb) intersect {0}
515+
bins sticky = binsof(cp_rlb) intersect {0} && binsof(cp_wdata_rlb) intersect {1}
517516
iff (cs_registers_i.g_pmp_registers.any_pmp_entry_locked);
518517
}
519518

@@ -640,16 +639,26 @@ interface core_ibex_pmp_fcov_if import ibex_pkg::*; #(
640639
ignore_bins unsupported_priv_lvl =
641640
binsof(cs_registers_i.mstatus_q.mpp) intersect {PRIV_LVL_H, PRIV_LVL_S} ||
642641
binsof(cs_registers_i.priv_mode_id_o) intersect {PRIV_LVL_H, PRIV_LVL_S};
642+
643+
// Cannot have mprv set in U mode (as it is cleared when executing an `mret` which takes the
644+
// hart into U mode).
645+
illegal_bins no_mrpv_in_umode =
646+
binsof(cs_registers_i.priv_mode_id_o) intersect {PRIV_LVL_U};
643647
}
644648

645-
pmp_instr_edge_cross: cross if_stage_i.instr_is_compressed_id_o,
649+
pmp_instr_edge_cross: cross if_stage_i.instr_is_compressed_out,
646650
pmp_iside_req_err, pmp_iside2_req_err
647-
iff (pmp_iside_boundary_cross);
651+
iff (pmp_iside_boundary_cross) {
652+
// Compressed instruction cannot see an error over the boundary as it only ever does
653+
// a single 16-bit fetch.
654+
illegal_bins no_iside2_err_on_compressed =
655+
binsof(if_stage_i.instr_is_compressed_out) intersect {1'b1} &&
656+
binsof(pmp_iside2_req_err) intersect {1'b1};
657+
}
648658

649659
misaligned_lsu_access_cross: cross misaligned_pmp_err_last,
650-
load_store_unit_i.fcov_ls_mis_pmp_err_2,
651-
pmp_dside_boundary_cross;
652-
660+
load_store_unit_i.fcov_ls_mis_pmp_err_2
661+
iff (pmp_dside_boundary_cross);
653662
endgroup
654663

655664
`DV_FCOV_INSTANTIATE_CG(pmp_top_cg, en_pmp_fcov)

rtl/ibex_load_store_unit.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ module ibex_load_store_unit #(
596596
`DV_FCOV_SIGNAL(logic, ls_pmp_exception, (load_err_o | store_err_o) & pmp_err_q)
597597
`DV_FCOV_SIGNAL(logic, ls_first_req, lsu_req_i & (ls_fsm_cs == IDLE))
598598
`DV_FCOV_SIGNAL(logic, ls_second_req,
599-
(ls_fsm_cs inside {WAIT_GNT, WAIT_RVALID_MIS}) & data_req_o & addr_incr_req_o)
599+
(ls_fsm_cs inside {WAIT_RVALID_MIS}) & data_req_o & addr_incr_req_o)
600600
`DV_FCOV_SIGNAL(logic, ls_mis_pmp_err_1,
601601
(ls_fsm_cs inside {WAIT_RVALID_MIS, WAIT_GNT_MIS}) && pmp_err_q)
602602
`DV_FCOV_SIGNAL(logic, ls_mis_pmp_err_2,

0 commit comments

Comments
 (0)