upwards cross module reference behave incorrectly #431
Replies: 5 comments 2 replies
-
The splitting of the module hierarchy for upward names happens in the DesignTree code after all normal elaboration is done. There appears to be a bug in it though so it's not working for your particular case. I will put it on my list of things to fix. |
Beta Was this translation helpful? Give feedback.
-
Hi MikePopoloski: |
Beta Was this translation helpful? Give feedback.
-
I do see there is code in getSemanticDiagnostics calling DesignTreeNode::build, i think we need duplicate the module whenever the hierarchy underneath having upwards name. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your replay. |
Beta Was this translation helpful? Give feedback.
-
I don't have any real design right now, but i can cook some test cases to test the performance once defparam/bind/upward name are supported , because those features can usually cause performance issues |
Beta Was this translation helpful? Give feedback.
-
Hi MikePopoloski:
I was looking the source code of slang , when there is upwards cross module reference, the elaboration seems doesn't work properly. below is the small case to demonstrate this issue:
module Top();
dut_0 inst_0();
dut_1 inst_1();
endmodule
module dut_0();
dut inst_dut();
dummy_1 inst_dummy();
endmodule
module dut_1();
dut inst_dut();
dummy_2 inst_dummy();
endmodule
module dummy_1();
reg[1:0] data;
endmodule
module dummy_2();
reg[7:0] data;
endmodule
module dut();
sub inst();
endmodule
module sub();
reg[1:0] data;
initial begin
data = inst_dummy.data;
end
endmodule
for module sub, there are two hierarchies : Top.inst_0.inst_dut.inst and Top.inst_1.inst_dut.inst
and there is a upwards cross module reference: inst_dummy.data in module sub.
in this case under different hierarchy , ints_dummy.data will be resolved to different type in different module.
under Top.inst_0.inst_dut.inst it will be resolved to Top.inst_0.inst_dummy.data which is reg[1:0]
under Top.inst_1.inst_dut.inst it will be resolved to Top.inst_1.inst_dummy.data which is reg[7:0]
so ideally we have to create different instanceBody for Top.inst_0.inst_dut.inst and Top.inst_1.inst_dut.inst,
but I didn't see it happened, right now we will only use parameter value + interface port to decide whether
we need create a different instanceBody which i think is not sufficient , we should also include upwards cross reference.
i was working on other commercial simulators for long time, i am pretty sure they will split the hierarchy if the target of cross module reference pointing to different type. The elaboration flow between other tools and slang is very different. They usually create an elaborated instance view of the design to help effectively processing defparam/bind/cross module reference /etc.
i don't know how slang can properly handle it without elaborated view of the design.
did you aware of this issue, any comment ?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions