Merge pull request #3463 from YosysHQ/micko/hierarchy_fix

Makes sure to set initial_top when top change, fixes #3462
This commit is contained in:
Miodrag Milanović 2022-08-29 10:12:34 +02:00 committed by GitHub
commit a8506c1c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -1058,6 +1058,7 @@ struct HierarchyPass : public Pass {
if (tmp_top_mod != NULL) {
if (tmp_top_mod != top_mod){
top_mod = tmp_top_mod;
top_mod->attributes[ID::initial_top] = RTLIL::Const(1);
did_something = true;
}
}

12
tests/various/bug3462.ys Normal file
View File

@ -0,0 +1,12 @@
read_verilog <<EOT
module top();
wire array[0:0];
wire out;
sub #(.d(1)) inst(
.in(array[0]),
.out(out)
);
endmodule
EOT
hierarchy -top top -libdir .

3
tests/various/sub.v Normal file
View File

@ -0,0 +1,3 @@
module sub #(parameter d=1) (input in, output out);
assign out = in;
endmodule