Skip to content

[csrng, dv] Handle and track reset in csrng_monitor - #31064

Open
KinzaQamar wants to merge 1 commit into
lowRISC:masterfrom
KinzaQamar:csrnd_cmds_test
Open

[csrng, dv] Handle and track reset in csrng_monitor#31064
KinzaQamar wants to merge 1 commit into
lowRISC:masterfrom
KinzaQamar:csrnd_cmds_test

Conversation

@KinzaQamar

@KinzaQamar KinzaQamar commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

csrng_cmds tests were failing because the fork...join_any block in collect_valid_trans() contains two threads; one of which exits when the command receives an ack or a reset occurs. If reset occurs before all requested genbits blocks are collected by the monitor, the monitor still writes to the analysis port, causing the scoreboard comparison to fail on predicted vs. actual genbit blocks that don't exist.

@KinzaQamar
KinzaQamar requested a review from a team as a code owner August 19, 2026 22:28
@KinzaQamar
KinzaQamar requested review from hcallahan-lowrisc and rswarbrick and removed request for a team and rswarbrick August 19, 2026 22:28
Comment thread hw/dv/sv/csrng_agent/csrng_monitor.sv Outdated
end
endtask

local task monitor_reset();

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.

I'd suggest combining monitor_reset and handle_reset: the rather silly handle_reset task was a silly mistake from me....

Why not make handle_reset into a function and call it at the same time as setting cfg.in_reset here?

@KinzaQamar KinzaQamar Aug 20, 2026

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.

Just double_checking if I understand your suggestion properly:

  local task monitor_and_handle_reset();
    fork
      forever begin
        @(cfg.vif.rst_n);
        cfg.in_reset = !cfg.vif.rst_n;
      end
      handle_reset();
    join_none
  endtask

  task body()
     fork
         monitor_and_handle_reset()
          ...
     join_none
  endtask

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.

That approach looks sensible to me, thanks @KinzaQamar

Comment thread hw/dv/sv/csrng_agent/csrng_monitor.sv Outdated

local task monitor_reset();
forever begin
@(cfg.vif.rst_n);

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.

This is clever! I was about to leave a note saying that it wouldn't work... but I was wrong! Much simpler than what I'd suggest :-)

csrng_cmds tests were failing because the fork...join_any block
in collect_valid_trans() contains two threads; one of which
exits when the command receives an ack or a reset occurs. If
reset occurs before all requested genbits blocks are collected
by the monitor, the monitor still writes to the analysis port,
causing the scoreboard comparison to fail on predicted vs.
actual genbit blocks that don't exist.

Signed-off-by: Kinza Qamar <kqzaman@lowrisc.org>
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.

3 participants