@@ -121,21 +121,20 @@ interface core_ibex_pmp_fcov_if import ibex_pkg::*; #(
121
121
assign pmp_iside2_nomatch = ~| pmp_iside2_match;
122
122
assign pmp_dside_nomatch = ~| pmp_dside_match;
123
123
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
-
128
124
// Store the Data Channel PMP match info from the first request to calculate boundary cross
129
125
always @ (posedge clk_i or negedge rst_ni) begin
130
126
if (! rst_ni) begin
131
- pmp_dside_match_last <= '0 ;
127
+ pmp_dside_match_last <= '0 ;
128
+ misaligned_pmp_err_last <= 1'b0 ;
132
129
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;
134
132
end
135
133
end
136
134
137
135
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;
139
138
140
139
for (genvar i_region = 0 ; i_region < PMPNumRegions; i_region + = 1 ) begin : g_pmp_region_fcov
141
140
pmp_priv_bits_e pmp_region_priv_bits;
@@ -513,7 +512,7 @@ interface core_ibex_pmp_fcov_if import ibex_pkg::*; #(
513
512
iff (fcov_csr_write && cs_registers_i.csr_addr_i == CSR_MSECCFG ) {
514
513
// Trying to enable RLB when RLB is disabled and locked regions present will result
515
514
// 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 }
517
516
iff (cs_registers_i.g_pmp_registers.any_pmp_entry_locked);
518
517
}
519
518
@@ -640,16 +639,26 @@ interface core_ibex_pmp_fcov_if import ibex_pkg::*; #(
640
639
ignore_bins unsupported_priv_lvl =
641
640
binsof (cs_registers_i.mstatus_q.mpp) intersect { PRIV_LVL_H , PRIV_LVL_S } ||
642
641
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 } ;
643
647
}
644
648
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 ,
646
650
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
+ }
648
658
649
659
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);
653
662
endgroup
654
663
655
664
`DV_FCOV_INSTANTIATE_CG (pmp_top_cg, en_pmp_fcov)
0 commit comments