Modules with ' 1' ' 2' suffix in their names
>>> This article will be merged with this article <<<
Static elaboration process adds the suffix "_<number>" to the module name when:
- Module contains hierarchical identifier(s), and
- Hierarchical identifier(s) in that module point(s) to different objects depending on the hierarchical position of that module instance.
An example :
module test ; parameter p = 12 ; mod I() ; foo I2() ; endmodule module foo ; test1 test() ; endmodule module test1 ; parameter p = 2 ; mod I3() ; endmodule module mod ; initial $display(test.p) ; // This is hierarchical identifier endmodule
The hierarchy is:
test (top module) I (mod) I2 (foo) test (test1) I3 (mod)
So here module 'mod' is instantiated twice in the hierarchy. The hierarchical identifier 'test.p' inside module 'mod', can refer to parameter 'p' inside top level module 'test' for the instance 'I' of module 'mod'; but it can also refer to parameter 'p' inside module 'test1' for the instance 'I3' of module 'mod'. In other words, the prefix 'test' can refer to module 'test' (top module) or instance 'top' inside module 'foo'.
In the example above, one hierarchical name can refer to different objects in the hierarchy. In this situation static elaboration creates 2 different copies of module 'mod' and their names are differentiated by adding "_<number>" ('mod_2' and 'mod_3'). Hierarchical identifiers in these two modules are resolved with proper identifiers.
The parsetree after static elaboration:
module test ; parameter p = 12 ; mod_2 I () ; foo I2 () ; endmodule module foo ; test1 test () ; endmodule module test1 ; parameter p = 2 ; mod_3 I3 () ; endmodule module mod ; initial $display (test.p) ; endmodule module mod_2 ; initial $display (test.p) ; endmodule module mod_3 ; initial $display (test.p) ; endmodule
The design hierarchy is:
test (top module) I (mod_2) I2 (foo) test (test1) I3 (mod_3)
The original module 'mod' is not instantiated.