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

Unsigned number are padded to the left with ones instead of zeros #3997

Open
RustamC opened this issue Oct 23, 2024 · 0 comments
Open

Unsigned number are padded to the left with ones instead of zeros #3997

RustamC opened this issue Oct 23, 2024 · 0 comments

Comments

@RustamC
Copy link

RustamC commented Oct 23, 2024

While testing synlig, I encountered a problem with a simple counter: chipsalliance/synlig#2624 .

In this code:

module counter (  input clk, input rstn, output reg[3:0] out);
  always @ (posedge clk) begin
    if (! rstn)
      out <= 0;
    else
      out <= out + 4'h1;
  end
endmodule

integer literal 'h1 is expanded to 4'b1111 instead of 4'b0001 causing wrong synthesis.

At the same time, if one specifies an optional size constant ('h1 -> 4'h1), integer literal will be expanded as expected to 4'b0001.

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

No branches or pull requests

1 participant