Skip to content

NBA inside a subroutine an edge process calls still clobbers other processes' writes before the NBA region #1885

Open

Description

@tignear

Follow-up to #1864 / #1884. #1884 publishes exactly the bits an edge process's nonblocking assignments wrote when a process kernel may write the same variable before the NBA region. It does this only for nonblocking assignments written in the process body. A nonblocking assignment inside a task or function the edge process calls still goes through the whole-range seed and commit. A write by another process between the evaluation and the NBA region is lost, even when no nonblocking assignment executed.

An NBA update changes only the bits its lvalue names (IEEE 1800-2023 10.4.2), and the NBA region follows the active and inactive regions (4.4.2.4).

`timescale 1ns/1ns
module win_j_al;
  bit clk = 0;
  bit en = 0;
  bit [31:0] q = 0;
  always #1 clk = ~clk;
  task automatic update;
    if (en) q <= 32'h11;
  endtask
  always @(posedge clk) update();
  initial begin
    @(posedge clk); #0;
    q = 32'h22;
    #1;
    $display("q=%h", q);
    $finish;
  end
endmodule

The staging in Ff::lower_process (stage_nonblocking) rewrites only the assignments of the process body. Ff::subroutine_assignments excludes variables a called subroutine assigns from it. The fix needs the staging (value shadow plus written-bit mask) to reach nonblocking assignments in called subroutine bodies as well, for example by staging within inlined subroutine bodies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions