calyx
calyx copied to clipboard
[library] Remove blocking statements.
trafficstars
From @rachitnigam in #750:
Generally recommend splitting up assignments an
always_combblock so that only individual signals are assigned to.Instead of:
always_comb begin x = a; y = x; enddo:
always_comb begin x = a end always_comb begin y = x endThis is because
=is the "blocking assignment" operator and implies ordering over statements. In the first program, we'll havey == aat the end. Generally, blocking semantics should be avoided.
We should carefully go through the primitive library and remove any blocking assignments that are present.
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
fp_sqrt uses blocking assignments in the main, always_comb block.