开发者

Are you allowed to have a module identifier be the same as the module type in Verilog?

开发者 https://www.devze.com 2022-12-21 13:45 出处:网络
For example module top debouncer debouncer(...); endmodule module debouncer ... endmodule Can I instantiate a debouncer as \"debouncer\" in the top m开发者_运维知识库odule, or is that illegal? Yes

For example

module top
    debouncer debouncer(...);
endmodule

module debouncer
...
endmodule

Can I instantiate a debouncer as "debouncer" in the top m开发者_运维知识库odule, or is that illegal?


Yes, it is legal for a module instance name to match the module name in Verilog, and it is quite common to do so when you only need one instance of a module. But, you could have quickly verified that for yourself by simply compiling your file with your favorite simulator. The following is legal syntax and compiles for me:

module top;
    debouncer debouncer();
endmodule

module debouncer;
endmodule
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号