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

Local function variables conflict with aliased module variables #7

Open
timLinscott opened this issue Mar 4, 2020 · 0 comments
Open
Labels

Comments

@timLinscott
Copy link

When a signal is defined inside a function defined within a module, any signals defined outside the function with the same name will be connected to the declaration in the function, not at the module level. This applies to the behavior in the F12 goto_definition command and the content of the tooltip you get when you hover over a variable.

Example:

module Foo();
function bar (
  input logic[7:0] a,
  output logic[7:0] b);
  b = a;  // hovering over 'a' shows "input logic[7:0] a" in the tooltip
endfunction

logic a; // hovering over 'a' shows "input logic[7:0] a" in the tooltip
...
endmodule

However, if we put the signal definition first, we get the correct definitions in their respective scopes.

module Foo();
logic a; // hovering over 'a' shows "logic a" in the tooltip
function bar (
  input logic[7:0] a,
  output logic[7:0] b);
  b = a;  // hovering over 'a' shows "input logic[7:0] a" in the tooltip
endfunction

assign a = 1'b1; // hovering over 'a' shows "logic a" in the tooltip
...
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants