Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[library] Remove blocking statements. #754

Open
cgyurgyik opened this issue Oct 28, 2021 · 2 comments
Open

[library] Remove blocking statements. #754

cgyurgyik opened this issue Oct 28, 2021 · 2 comments
Labels
C: Library Calyx's standard library good first issue Good issue to start contributing on Calyx S: Available Can be worked upon

Comments

@cgyurgyik
Copy link
Collaborator

cgyurgyik commented Oct 28, 2021

From @rachitnigam in #750:

Generally recommend splitting up assignments an always_comb block so that only individual signals are assigned to.

Instead of:

always_comb begin
  x = a;
  y = x;
end

do:

always_comb begin
  x = a
end
always_comb begin
  y = x
end

This is because = is the "blocking assignment" operator and implies ordering over statements. In the first program, we'll have y == a at the end. Generally, blocking semantics should be avoided.

We should carefully go through the primitive library and remove any blocking assignments that are present.

@rachitnigam
Copy link
Contributor

rachitnigam commented Nov 22, 2021

std_fp_div_pipe uses the following (#1217):

    always_comb begin
      if (acc >= {1'b0, right}) begin
        acc_next = acc - right;
        {acc_next, quotient_next} = {acc_next[WIDTH-1:0], quotient, 1'b1};
      end else begin
        {acc_next, quotient_next} = {acc, quotient} << 1;
      end
    end

@rachitnigam
Copy link
Contributor

fp_sqrt uses blocking assignments in the main, always_comb block.

@rachitnigam rachitnigam added the good first issue Good issue to start contributing on Calyx label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Library Calyx's standard library good first issue Good issue to start contributing on Calyx S: Available Can be worked upon
Projects
None yet
Development

No branches or pull requests

2 participants