module A (input a, input b)
...
module B (input a, input b)
...
endmodule
endmodule
Is the above allowed in Verilog?
module A (input a, input b)
...
module B (input a, input b)
...
endmodule
endmodule
Is the above allowed in Verilog?
I do not think it is allowed, may be if you want to do, you should use System Verilog. More information is available in this link.
Nested module declarations are only allowed in SystemVerilog. The nested module is only visible for instanciation within the module is contained.
If you are looking to have two different module definitions with the same name, it's possible to do this in Verilog with libraries and the config
construct.