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

Invalid verilog generated with constant idx into ROM #733

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

da-steve101
Copy link
Contributor

With the following verilog, the always @(*) is interpreted as trigger on all input changes. However as there are no inputs, this never triggers. Hence it has the value xxx. This pr is a bit hacky but gets round it by changing the declaration to set the reg to an initial value.

reg [3:0] T0;
 always @(*) case (2'h2)
    0: T0 = 4'h3;
    1: T0 = 4'h1;
    2: T0 = 4'h5;
    3: T0 = 4'h8;
    default: begin
      T0 = 4'bx;
`ifndef SYNTHESIS
// synthesis translate_off
      T0 = {1{$random}};
// synthesis translate_on
`endif
    end
  endcase

instead have

reg [3:0] T0 = 4'h5;

@ghost
Copy link

ghost commented Sep 14, 2016

Can one of the admins verify this patch?

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

Successfully merging this pull request may close these issues.

1 participant