Use of $urandom()
In core-v-verif there are 8 files that use some variation of $urandom()
. You are in the "assignees" list of this issue because git believes you authored one or more of these.
The Verissimo linter flags these as violation SVTB.29.1.3.1, which is a lint error because class members randomized with these calls cannot be constrained. I also worry that invocations of $urandom() may impair random stability (that is, the ability to reproduce results from the same seed).
Possible resolutions:
- Accept the use of $urandom() and create a project-wide waiver for SVTB.29.1.3.1.
- Enforce the use of a configuration or context class of random members to implement the same functionality.
- Waive, or not, on a case-by-case basis.
Example fixes
From uvma_obi_memory_drv.sv. Replace this:
UVMA_OBI_MEMORY_DRV_IDLE_RANDOM: begin
`uvm_info("OBI_MEMORY_DRV", $sformatf("Invalid drv_random: %0d", cfg.drv_idle), UVM_NONE)
slv_mp.drv_slv_cb.rdata <= $urandom();
slv_mp.drv_slv_cb.err <= $urandom();
slv_mp.drv_slv_cb.ruser <= $urandom();
slv_mp.drv_slv_cb.rid <= $urandom();
end
...with this:
UVMA_OBI_MEMORY_DRV_IDLE_RANDOM: begin
`uvm_info("OBI_MEMORY_DRV", $sformatf("Invalid drv_random: %0d", cfg.drv_idle), UVM_NONE)
if (!obi_mem_drv_random_cntxt.randomize())
`uvm_error("OBI_MEMORY_DRV", "Cannot randomize obi_mem_drv_random_cntxt")
slv_mp.drv_slv_cb.rdata <= obi_mem_drv_random_cntxt.rdata;
slv_mp.drv_slv_cb.err <= obi_mem_drv_random_cntxt.err;
slv_mp.drv_slv_cb.ruser <= obi_mem_drv_random_cntxt.ruser;
slv_mp.drv_slv_cb.rid <= obi_mem_drv_random_cntxt.rid;
end
Steps to Reproduce
Lint checks are run every six hours - the link above will show all violations of this rule.
Additional context
This is a set of linter issues identified by the Verissimo SystemVerilog Testbench Linter. Please reach out to me directly if you have questions about the tool.