veripool / verilog-perl

Verilog parser, preprocessor, and related tools for the Verilog-Perl package
https://www.veripool.org/verilog-perl
Artistic License 2.0
121 stars 34 forks source link

Verilog::EditFiles misses module declarations where module keyword and module name are on separate lines #1311

Closed veripoolbot closed 6 years ago

veripoolbot commented 6 years ago

Author Name: Ben Rosser (@TC01) Original Redmine Issue: 1311 from https://www.veripool.org

Original Assignee: Wilson Snyder (@wsnyder)


I stumbled onto Verilog::EditFiles recently when looking for a tool that could split up a file and create one file per module. It's very neat!

However, I discovered an issue. I've been using it to post-process the output from a synthesis compiler, which-- for sufficiently long module names-- produces output with the name of the module on a separate line from the "module" keyword, like this:

      R3L1_prlp_policy_DATAWIDTH7_PTRWIDTH4_PREAMBLE3h5_NUM_CHANNELS11(
</code>

The EditFiles command misses this. It does not identify this as a module declaration and will then fail when it sees the next "endmodule", because it thinks it missed a declaration.

Our simulator (Cadence Incisive-- ius) thinks this is valid Verilog code, however, and the file containing module declarations of this form is properly interpreted.

I wrote some hacky Perl code to pre-process the file and clean up module declarations like this, which works. But it'd be nice if the EditFiles command could be fixed to handle this case correctly.

veripoolbot commented 6 years ago

Original Redmine Comment Author Name: Wilson Snyder (@wsnyder) Original Date: 2018-05-26T12:02:55Z


Thanks for reporting this.

Attached is a patch to fix this. I think I won't be applying this, as I know some people simply copy and modify this code for themselves, and I'm reluctant to make the code more complicated. If some others see the same problem, I'll reconsider.