I am working on a project to facilitate verilog programming by using perl scripting language. Now I want to write a script to scan a top verilog file, and then generate the hierarchy list for the module, which suggests that I need to extract the module instantiation statement from the verilog file, here is the problem:
How to write a regular expression to match the module instantiation in a verilog file, since we need to know the submodule names of the top module file.