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

Misleading error message when overriding localparam via defparam #4955

Closed
FSY369 opened this issue Mar 21, 2025 · 1 comment
Closed

Misleading error message when overriding localparam via defparam #4955

FSY369 opened this issue Mar 21, 2025 · 1 comment
Labels
pending-verification This issue is pending verification and/or reproduction

Comments

@FSY369
Copy link

FSY369 commented Mar 21, 2025

Version

Yosys 0.50+7 (git sha1 38f8583, clang++ 14.0.0-1ubuntu1.1 -fPIC -O3)

On which OS did this happen?

Linux

Reproduction Steps

Save the following minimal testcase as testcase.v:

// testcase.v
module child #(parameter A=1, localparam B=2);
    initial $display("A=%d B=%d", A, B);
endmodule

module parent;
    defparam invalid_inst.B = 4; // Illegal defparam
    child invalid_inst();
endmodule

Run Yosys with:
yosys -p "read_verilog testcase.v; hierarchy -check

The error message incorrectly suggests the parameter is missing, while the real issue is an illegal localparam override.
No indication of the actual violation type (localparam vs missing parameter)

Expected Behavior

A clear error message indicating an attempt to override a localparam:
ERROR: Cannot override localparam 'B' in module 'child' via defparam at testcase.v:5

Actual Behavior

Misleading error message stating the parameter does not exist:
ERROR: Module child' referenced in module parent' in cell invalid_inst' does not have a parameter named 'B'`

@FSY369 FSY369 added the pending-verification This issue is pending verification and/or reproduction label Mar 21, 2025
@KrystalDelusion
Copy link
Member

This is already mentioned in #4927 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-verification This issue is pending verification and/or reproduction
Projects
None yet
Development

No branches or pull requests

2 participants