calyx icon indicating copy to clipboard operation
calyx copied to clipboard

[library] Remove blocking statements.

Open cgyurgyik opened this issue 4 years ago • 2 comments
trafficstars

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.

cgyurgyik avatar Oct 28 '21 04:10 cgyurgyik

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 avatar Nov 22 '21 18:11 rachitnigam

fp_sqrt uses blocking assignments in the main, always_comb block.

rachitnigam avatar Nov 22 '21 18:11 rachitnigam