ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monk, I have a file of the following content and structure:
=============================================== // 1st commented line //second commented line // timescale 1ns /5 ns timescale 1ns/4ns //this comment should also be ignored module modulename1 (a b c ) some lines.... some lines ... //third commented line //fourth commented line timescale 3ns/5ns module modulename2 (p q r) some lines ... //fifth comment //timescale 4ns/5ns timescale 1ns/3ns module modulename3 (m n p ) some line ... ================================================
In this above file structure '//' is used for commenting a line which will be ignored for parsing. I need to parse this above file so that I can extract the timescale value corresponding to each modulename. For example, modulename1 has 1ns/5ns as its timescale, modulename2 has 3ns/5ns and so on. Also the comments after the timescale value will be ignored as mentioned above. The problem being is the timescale value for a particular module is appearing above the module declaration in the file. Please help me in getting the timescale value corresponding to each modulename. Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting pattern from a file
by Ratazong (Monsignor) on Apr 17, 2012 at 06:03 UTC | |
by ghosh123 (Monk) on Apr 17, 2012 at 06:20 UTC | |
by Corion (Patriarch) on Apr 17, 2012 at 06:52 UTC | |
by rovf (Priest) on Apr 17, 2012 at 09:07 UTC | |
|
Re: Extracting pattern from a file (Verilog)
by toolic (Bishop) on Apr 17, 2012 at 13:38 UTC |