opentitan
opentitan copied to clipboard
[dv/common] `tl_errors_vseq` assumes that unmapped addresses exist
Current inside of cip_base_vseq__tl_errors.svh, we randomly create error cases using a randcase as shown below:
randcase
1: tl_write_csr_word_unaligned_addr(ral_name);
1: tl_write_less_than_csr_width(ral_name);
1: tl_protocol_err(p_sequencer.tl_sequencer_hs[ral_name]);
// only run when unmapped addr exists
has_unmapped_addr: tl_access_unmapped_addr(ral_name);
// only run this task when there is a mem
has_mem: tl_write_mem_less_than_word(ral_name);
has_mem: tl_read_mem_err(ral_name);
endcase
However, the first of these tasks (tl_write_csr_word_unaligned_addr) assumes that unmapped addresses exist as it constrains the target addresses to be outside any valid CSR addresses and memory address ranges.
This results in runtime constraint errors when running the tl_error vseq on an IP where every single address in the RAL memory is mapped (such as SRAM memory RAL model):
Solver failed when solving following set of constraints
bit[31:0] csr_addr_mask["sram_ctrl_prim_reg_block"] = 32'h1fffc;
bit[31:0] loc_mem_ranges[0].start_addr = 32'h0;
bit[31:0] loc_mem_ranges[0].end_addr = 32'h1ffff;
rand bit[31:0] addr; // rand_mode = ON
constraint WITH_CONSTRAINT // (from this) (constraint_mode = ON) (../src/lowrisc_dv_cip_lib_0/seq_lib/cip_base_vseq__tl_errors.svh:60)
{
(!((addr & csr_addr_mask["sram_ctrl_prim_reg_block"]) inside {[loc_mem_ranges[0].start_addr:loc_mem_ranges[0].end_addr]}));
}
There is a pretty simple fix for this issue - make these three tasks dependent on has_unmapped_addr as follows:
randcase
1: tl_write_less_than_csr_width(ral_name);
1: tl_protocol_err(p_sequencer.tl_sequencer_hs[ral_name]);
// only run when unmapped addr exists
has_unmapped_addr: tl_write_csr_word_unaligned_addr(ral_name);
has_unmapped_addr: tl_access_unmapped_addr(ral_name);
// only run this task when there is a mem
has_mem: tl_write_mem_less_than_word(ral_name);
has_mem: tl_read_mem_err(ral_name);
endcase
This is resolved by #6626, closing.