Skip to content

Commit

Permalink
[entropy_src/dv] Fix usage of rng_max_delay plusarg
Browse files Browse the repository at this point in the history
Previously, upon reading the plusarg, the specified value was
immediately written to the configuration object of the RNG agent in the
environment config. But as it turns out, the entropy_src_env_cfg holding
the RNG agent which got the plusarg value is created before
entropy_src_env. During the creation of the latter, a new RNG agent
object is generated. This means the plusarg value got previously
overwritten.

This commit solves this issue by storing the plusarg value into a new
configuration variable that can be used in entropy_src_env to configure
the newly created RNG agent.

Signed-off-by: Pirmin Vogel <[email protected]>
  • Loading branch information
vogelpi committed Mar 2, 2024
1 parent 2b9338d commit 01b73a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion hw/ip/entropy_src/dv/env/entropy_src_env.sv
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class entropy_src_env extends cip_base_env #(
// on a test by test basis.
cfg.m_rng_agent_cfg.zero_delays = 0;
cfg.m_rng_agent_cfg.host_delay_min = 1;
cfg.m_rng_agent_cfg.host_delay_max = 12;
cfg.m_rng_agent_cfg.host_delay_max = cfg.rng_max_delay;
cfg.m_rng_agent_cfg.ignore_push_host_backpressure = cfg.rng_ignores_backpressure;

m_csrng_agent = push_pull_agent#(.HostDataWidth(entropy_src_pkg::FIPS_CSRNG_BUS_WIDTH))::
Expand Down
3 changes: 3 additions & 0 deletions hw/ip/entropy_src/dv/env/entropy_src_env_cfg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class entropy_src_env_cfg extends cip_base_env_cfg #(.RAL_T(entropy_src_reg_bloc
// alert within alert_max_delay clock cycles.
int alert_max_delay;

// host_delay_max value for the RNG agent. This can be overwritten using a plusarg.
int rng_max_delay = 12;

// Whether to keep the default response on the XHT interface at all time.
bit xht_only_default_rsp = 1;

Expand Down
2 changes: 1 addition & 1 deletion hw/ip/entropy_src/dv/tests/entropy_src_base_test.sv
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class entropy_src_base_test extends cip_base_test #(
bit xht_only_default_rsp;
if ($value$plusargs("rng_max_delay=%0d", rng_max_delay)) begin
`uvm_info(`gfn, $sformatf("+rng_max_delay specified"), UVM_MEDIUM)
cfg.m_rng_agent_cfg.host_delay_max = rng_max_delay;
cfg.rng_max_delay = rng_max_delay;
end
if ($value$plusargs("xht_only_default_rsp=%0b", xht_only_default_rsp)) begin
`uvm_info(`gfn, $sformatf("+xht_only_default_rsp specified"), UVM_MEDIUM)
Expand Down

0 comments on commit 01b73a0

Please sign in to comment.