Skip to content

[csrng, dv] Fixed csrng_regwen test - #31067

Merged
KinzaQamar merged 1 commit into
lowRISC:masterfrom
KinzaQamar:csrng_regwen_test
Aug 21, 2026
Merged

[csrng, dv] Fixed csrng_regwen test#31067
KinzaQamar merged 1 commit into
lowRISC:masterfrom
KinzaQamar:csrng_regwen_test

Conversation

@KinzaQamar

@KinzaQamar KinzaQamar commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

The test was failing an expected vs actual value check in csrng_regwen_vseq.sv#L61. The actual value is the data read from int_state_read_enable register, which will return a 3-bit read data. But the comparison happened with a 5 bits wide expected chk_int_state_read_enable

@KinzaQamar
KinzaQamar requested a review from a team as a code owner August 20, 2026 13:00
@KinzaQamar
KinzaQamar requested review from glaserf, marnovandermaas and rswarbrick and removed request for a team and marnovandermaas August 20, 2026 13:00
rand bit [MaxNumHwApps:0] int_state_read_enable;
bit [MaxNumHwApps:0] chk_int_state_read_enable;
rand bit [NumApps - 1:0] int_state_read_enable;
bit [NumApps - 1:0] chk_int_state_read_enable;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you do this by masking out the bottom cfg.m_num_hw_apps bits of each? It would probably be nicer to have this be inferred from the hardware in the tb, rather than set in a global parameter in the package.

Yes, I know that OpenTitan is full of that sort of ugliness! But we can do better :-)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this suggestion and explaining the reason behind the existence of MaxNumHwApps in person

Comment thread hw/ip/csrng/dv/env/csrng_env_pkg.sv Outdated
@KinzaQamar

Copy link
Copy Markdown
Contributor Author

Thanks @rswarbrick and @glaserf for helping with the review. I agree with this discussion_r3822488371. Instead of introducing a duplicate parameter, I've added MaxNumApps. I guess the parameter MaxNumHwApps used to declare the width of int_read_state_enable is wrong as that register represents bits per instance (which I think also includes SW app)

@glaserf glaserf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @KinzaQamar for this PR and yet another improvement to CSRNGs dv!

I only have a small nit, see below.

Comment thread hw/ip/csrng/dv/env/seq_lib/csrng_regwen_vseq.sv Outdated
Comment thread hw/ip/csrng/dv/env/seq_lib/csrng_regwen_vseq.sv Outdated
The test was failing an expected vs actual value check in
csrng_regwen_vseq. The actual value is the data read from
int_state_read_enable register, which will return a 3-bit
read data. But the comparison happened with a 5 bits wide
expected chk_int_state_read_enable

Also introduced a parameter MaxNumApps in csrng_env_cfg,
as the int_state_read_enable register represents bits per
instance (which also includes SW app).

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
@KinzaQamar
KinzaQamar force-pushed the csrng_regwen_test branch 2 times, most recently from a6886f4 to d85fb17 Compare August 20, 2026 22:45

@hcallahan-lowrisc hcallahan-lowrisc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this @KinzaQamar, and for following up on the reviewers' comments so quickly. LGTM!

@KinzaQamar
KinzaQamar added this pull request to the merge queue Aug 21, 2026
Merged via the queue into lowRISC:master with commit 82f9144 Aug 21, 2026
45 checks passed
@KinzaQamar
KinzaQamar deleted the csrng_regwen_test branch August 21, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants