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

Bug: accessing parameters by upward hierarchial name #1108

Open
hpax opened this issue Mar 9, 2024 · 1 comment
Open

Bug: accessing parameters by upward hierarchial name #1108

hpax opened this issue Mar 9, 2024 · 1 comment
Labels
Bug VLOG95 Bugs in vlog95 target code generator

Comments

@hpax
Copy link

hpax commented Mar 9, 2024

Accessing parameters by upward-looking hierarchical name seems to always return the value as specified in alphabetically first(!) instance of the module in question.

This is tested with the vlog95 backend; I don't know if it is backend specific.

To test, compile the included example:

iverilog -g2012 -s main -t vlog95 -o inherit.v95 inherit.sv

... and observe the output definition of module "ab".

One would instead expect "main.mybc[01x]"
to have different expansions in their respective instantiations of "ab".

iverilog -v
Icarus Verilog version 12.0 (stable) ()

Files (with .txt added due to github drain bramage):

inherit.sv.txt
inherit.v95.txt

@martinwhitaker
Copy link
Collaborator

martinwhitaker commented Mar 9, 2024

This does seem to be backend-specific. With this simplified example:

module b (output b);
   assign b = c.foo; 
endmodule

module c #(parameter foo = 1'b1) (output b);
   b my_b (.b(b));
endmodule

module main();
   wire bx, b0, b1;
   
   c #(.foo(1'bx)) my_cx (.b(bx));
   c #(.foo(1'b0)) my_c0 (.b(b0));
   c #(.foo(1'b1)) my_c1 (.b(b1));

   initial #0 $display(bx,,b0,,b1);
endmodule

I get

% iverilog br_gh1108.v && a.out
x 0 1
% iverilog -tvlog95 -o tmp.v br_gh1108.v && iverilog tmp.v && a.out
0 0 0

@martinwhitaker martinwhitaker added Bug VLOG95 Bugs in vlog95 target code generator labels Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug VLOG95 Bugs in vlog95 target code generator
Projects
None yet
Development

No branches or pull requests

2 participants