|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| Netlist/ | H | 06-Jun-2021 | - | 4,165 | 2,172 |
| Parser/ | H | 03-May-2022 | - | 16,850 | 12,691 |
| Preproc/ | H | 03-May-2022 | - | 7,694 | 5,933 |
| t/ | H | 06-Jun-2021 | - | 12,051 | 11,043 |
| verilog/ | H | 06-Jun-2021 | - | 2,643 | 1,859 |
| .clang-format | H A D | 13-Apr-2021 | 3.1 KiB | 112 | 110 |
| .gitignore | H A D | 02-Feb-2018 | 124 | 18 | 17 |
| COPYING | H A D | 02-Feb-2018 | 8.9 KiB | 198 | 154 |
| Changes | H A D | 06-Jun-2021 | 39.5 KiB | 1,484 | 711 |
| EditFiles.pm | H A D | 06-Jun-2021 | 10.8 KiB | 400 | 206 |
| Getopt.pm | H A D | 06-Jun-2021 | 22 KiB | 831 | 502 |
| Language.pm | H A D | 06-Jun-2021 | 20.9 KiB | 730 | 502 |
| MANIFEST | H A D | 13-Apr-2021 | 3.5 KiB | 195 | 194 |
| MANIFEST.SKIP | H A D | 29-Mar-2021 | 608 | 45 | 44 |
| META.yml | H A D | 06-Jun-2021 | 783 | 28 | 26 |
| Makefile.PL | H A D | 03-May-2022 | 5.4 KiB | 149 | 114 |
| Netlist.pm | H A D | 06-Jun-2021 | 19.3 KiB | 727 | 276 |
| README | H A D | 05-Jun-2021 | 11.5 KiB | 292 | 220 |
| README.pod | H A D | 13-Apr-2021 | 11 KiB | 341 | 231 |
| Std.pm | H A D | 06-Jun-2021 | 3.2 KiB | 136 | 56 |
| vhier | H A D | 06-Jun-2021 | 16.6 KiB | 607 | 334 |
| vpassert | H A D | 06-Jun-2021 | 50.1 KiB | 1,706 | 1,122 |
| vppreproc | H A D | 06-Jun-2021 | 7.4 KiB | 295 | 91 |
| vrename | H A D | 06-Jun-2021 | 19.4 KiB | 730 | 461 |
| vsplitmodule | H A D | 25-Jan-2019 | 3.3 KiB | 93 | 31 |
README
1NAME
2
3 Verilog-Perl - Overview of Verilog language packages for Perl
4
5DESCRIPTION
6
7 The Verilog-Perl distribution provides Perl parsing and utilities for
8 the Verilog Language. This file provides an overview of the
9 distribution.
10
11 Verilog-Perl is currently a mature tool. Bugs are fixed and IEEE
12 language capabilities updated as needed, but the basic features and API
13 are not expected to change.
14
15 For general information see <https://www.veripool.org/verilog-perl>.
16
17 For specific details on each component, see that component's manpage.
18
19 You may also want to try the AUTO features present in
20 <https://www.veripool.org/verilog-mode> Verilog-Mode.
21
22SCRIPTS
23
24 The following scripts are installed by Verilog-Perl:
25
26 vhier
27 Vhier reads the Verilog files passed on the command line and outputs
28 a tree of all of the filenames, modules, and cells referenced by
29 that file.
30
31 vpassert
32 Vpassert will read the specified Verilog files and preprocess
33 special PLI assertions.
34
35 vppreproc
36 Vppreproc (Verilog-Perl Pre Processor) reads the Verilog files
37 passed on the command line and outputs preprocessed output.
38
39 vrename
40 Vrename will allow a signal to be changed across all levels of the
41 design hierarchy, or to create a cross reference of signal names.
42
43PACKAGES
44
45 Verilog::Getopt
46 Verilog::Getopt provides standardized handling of options similar to
47 Verilog/VCS and cc/GCC.
48
49 Verilog::Language
50 Verilog::Language provides general utilities for using the Verilog
51 Language, such as parsing numbers or determining what keywords
52 exist.
53
54 Verilog::Netlist
55 Verilog::Netlist reads and holds interconnect information about a
56 whole design database.
57
58 Verilog::Netlist::Cell
59 A Verilog::Netlist::Cell object is created by Verilog::Netlist for
60 every instantiation in the current module.
61
62 Verilog::Netlist::ContAssign
63 A Verilog::Netlist::ContAssign object is created by Verilog::Netlist
64 for every continuous assignment in the current module.
65
66 Verilog::Netlist::File
67 Verilog::Netlist::File allows Verilog::Netlist objects to be read
68 and written in Verilog format.
69
70 Verilog::Netlist::Module
71 A Verilog::Netlist::Module object is created by Verilog::Netlist for
72 every module in the design.
73
74 Verilog::Netlist::Net
75 A Verilog::Netlist::Net object is created by
76 Verilog::Netlist::Module for every signal and input/output
77 declaration in the current module.
78
79 Verilog::Netlist::Pin
80 A Verilog::Netlist::Pin object is created by Verilog::Netlist::Cell
81 for for each pin connection on a cell.
82
83 Verilog::Netlist::Port
84 A Verilog::Netlist::Port object is created by
85 Verilog::Netlist::Module for every port connection in the module.
86
87 Verilog::Netlist::Subclass
88 The Verilog::Netlist::Subclass is used as a base class for all
89 Verilog::Netlist::* structures.
90
91 Verilog::Parser
92 Verilog::Parser will tokenize a Verilog file and invoke various
93 callback methods.
94
95 Verilog::Preproc
96 Verilog::Preproc reads Verilog files, and preprocesses them
97 according to the Verilog specification. Programs can be easily
98 converted from reading a IO::File into reading preprocessed output
99 from Verilog::Preproc.
100
101 Verilog::SigParse
102 Verilog::SigParser builds upon the Verilog::Parser package to
103 provide callbacks for when a signal is declared, a module
104 instantiated, or a module defined.
105
106WHICH PARSER PACKAGE?
107
108 If you are starting a new application which needs to parse the Verilog
109 language you have several tools available to you. Which you pick depends
110 on how low level and complete the information you need is.
111
112 VParseBison.y
113 The low level VParse* source files may be of use when you need a
114 starting point for your own a full C++ SystemVerilog grammar parser,
115 using Bison and Flex. It understands most of the SystemVerilog 2017
116 grammar (1800-2017 Appendix A).
117
118 Verilog::Preproc
119 Verilog::Preproc is useful when you need only post-preprocessed text
120 output, or a list of defines, includes, etc. It can preprocess a
121 file, or be used to provide the Verilog macro language on top of
122 synthesis scripts. It understands and implements all preprocessor
123 features of SystemVerilog 2017.
124
125 Verilog::Parser
126 Verilog::Parser is useful when you need to tokenize or write source
127 filters (where you need everything including whitespace). It can
128 take raw files, or preprocessed input, and generates callbacks. It
129 understands all SystemVerilog 2017 keywords.
130
131 Abstract Syntax Tree
132 Verilog::Parser knows enough to make a complete Abstract Syntax Tree
133 (AST) of Verilog syntax. This represents all major constructs such
134 as a "module" as a data structure, but does not interconnect the AST
135 nodes as would be needed to follow signals. Not all keywords have
136 been implemented; many are parsed but otherwise ignored. A complete
137 Ast tree would allow any arbitrary transformation of Verilog syntax
138 (everything is known excluding whitespace). For these applications
139 consider Verilator's XML output (below).
140
141 Verilog::SigParser
142 Verilog::SigParser is useful when you need a list of modules,
143 signals, ports, functions, etc. It requires a preprocessed file
144 (from Verilog::Preproc), and can parse all SystemVerilog 2017 files,
145 but only provides callbacks on certain interesting things. The
146 SigParser operates only on a file at a time; it does not
147 interconnect signals nor perform any elaboration (resolution of
148 parameters).
149
150 Verilog::Netlist
151 Verilog::Netlist is useful for when you need the hierarchy, and a
152 list of signals per module, pins per cell, etc. It builds upon the
153 output of Verilog::SigParser, so requires preprocessed files (from
154 Verilog::Preproc). It parses all SystemVerilog 2017 files, but not
155 all SystemVerilog constructs are loaded into objects.
156 Verilog::Netlist interconnects modules with instantiations but does
157 not perform any elaboration (resolution of parameters).
158
159 VPI Using the VPI is the best way to access the behavior of the design.
160 It is not part of this package as it requires a compliant simulator
161 and C++ code to call the VPI, and understands as much of the
162 language as the simulator supports. This allows writing lint checks
163 and full knowledge of all parts of the code. The VPI can operate
164 ONLY on an elaborated design (where all parameters are resolved).
165 Walking a VPI tree general requires a good deal of work compared to
166 simple scripting (though little work compared to writing a parser
167 from scratch).
168
169 Verilator
170 The Verilator program also contains a very similar front end as
171 Verilog-Perl and can create XML output showing the abstract syntax
172 tree. Verilator also understands how to elaborate and connect
173 complex pins and types, but supports mostly only the synthesis
174 subset of SystemVerilog.
175
176 If you're looking to parse only synthesizable code this is the
177 recommended route.
178
179 Verilog-Mode for Emacs
180 Although not a parser, a common requested use of Verilog-Perl is to
181 automatically make shell modules and interconnect modules.
182 Verilog-Mode is a better solution to this problem, as it results in
183 completely portable code; the program (Verilog-Mode) isn't needed
184 for others to update the design. It's also in very common usage,
185 including by many IP providers.
186
187INSTALLATION
188
189 Skip this section if Verilog-Perl has already been installed.
190
191 Verilog-Perl should run on any system with Perl, G++, Flex, and Bison.
192 It is known to work on most Linux distributions, plus Cygwin.
193
194 You may install using either CPAN, or the sources. If you plan to do any
195 development on Verilog-Perl, use the sources.
196
197 CPAN Installation
198
199 Option 1: Easiest installation is using the "CPAN" command line that
200 comes with Perl. After configuring CPAN the first time, simply
201
202 cpan install Verilog-Perl
203 # And see the documentation
204 man Verilog-Perl
205 # Or, sometimes the capitalization is changed
206 man verilog-perl
207
208 Read the rest of this file for details on the programs provided.
209
210 Manual Installation from Repository
211
212 Option 2: Build any version using the source development repository
213 with:
214
215 git clone http://git.veripool.org/git/Verilog-Perl # Only first time
216 cd Verilog-Perl
217 git pull # Make sure we're up-to-date
218 git tag # See what versions exist (recent GITs only)
219 #git checkout master # Use development branch (e.g. recent bug fix)
220 #git checkout stable # Use most recent release
221 #git checkout v{version} # Switch to specified release version
222
223 perl Makefile.PL
224 # Ignore warning about README, this file will be generated
225 make
226 make test
227 make install
228
229 Read the rest of this file for details on the programs provided.
230
231FAQ
232
233 Why do I get "unexpected `do'" or "unexpected `bit'" errors?
234 Do, bit, ref, return, and other words are now SystemVerilog
235 keywords. You should change your code to not use them to insure it
236 works with newer tools. Alternatively, surround them by the Verilog
237 2005/SystemVerilog begin_keywords pragma to indicate Verilog 2001
238 code.
239
240 `begin_keywords "1364-2001"
241 integer bit; initial bit = 1;
242 `end_keywords
243
244 Alternatively use the --language (for vhier) or
245 Verilog::Language::language_standard call to specify "1364-2001", or
246 for really old code, "1364-1995".
247
248 But, again, you really should fix the Verilog code.
249
250 With Verilog::Netlist how do I resolve signal widths that include
251 parameters down to constants?
252 Unfortunately parameter resolution is part of elaboration.
253 Verilog-Perl doesn't do elaboration as it requires a good fraction
254 of a complete simulator implementation. Many applications can work
255 around this limitation, if yours still requires elaboration you're
256 stuck with using Verilator or the VPI, see the sections above.
257
258DISTRIBUTION
259
260 Verilog-Perl is part of the <https://www.veripool.org/> free Verilog EDA
261 software tool suite. The latest version is available from CPAN and from
262 <https://www.veripool.org/verilog-perl>.
263
264 Copyright 2000-2021 by Wilson Snyder. This package is free software; you
265 can redistribute it and/or modify it under the terms of either the GNU
266 Lesser General Public License Version 3 or the Perl Artistic License
267 Version 2.0.
268
269 This code is provided with no warranty of any kind, and is used entirely
270 at your own risk.
271
272AUTHORS
273
274 Wilson Snyder <wsnyder@wsnyder.org>
275
276SEE ALSO
277
278 vhier, vpassert, vppreproc, vrename
279
280 Verilog::EditFiles, Verilog::Getopt, Verilog::Language Verilog::Netlist,
281 Verilog::Parser, Verilog::Preproc, Verilog::SigParser
282
283 Verilog::Netlist::Cell, Verilog::Netlist::ContAssign,
284 Verilog::Netlist::File, Verilog::Netlist::Interface,
285 Verilog::Netlist::ModPort, Verilog::Netlist::Module,
286 Verilog::Netlist::Net, Verilog::Netlist::Pin, Verilog::Netlist::Port,
287 Verilog::Netlist::Subclass,
288
289 And the <https://www.veripool.org/verilog-mode>Verilog-Mode package for
290 Emacs.
291
292
README.pod
1=pod
2
3=head1 NAME
4
5Verilog-Perl - Overview of Verilog language packages for Perl
6
7=head1 DESCRIPTION
8
9The Verilog-Perl distribution provides Perl parsing and utilities for the
10Verilog Language. This file provides an overview of the distribution.
11
12Verilog-Perl is currently a mature tool. Bugs are fixed and IEEE language
13capabilities updated as needed, but the basic features and API are not
14expected to change.
15
16For general information see L<https://www.veripool.org/verilog-perl>.
17
18For specific details on each component, see that component's manpage.
19
20You may also want to try the AUTO features present in
21L<https://www.veripool.org/verilog-mode> Verilog-Mode.
22
23=head1 SCRIPTS
24
25The following scripts are installed by Verilog-Perl:
26
27=over 4
28
29=item L<vhier>
30
31Vhier reads the Verilog files passed on the command line and outputs a tree
32of all of the filenames, modules, and cells referenced by that file.
33
34=item L<vpassert>
35
36Vpassert will read the specified Verilog files and preprocess special
37PLI assertions.
38
39=item L<vppreproc>
40
41Vppreproc (Verilog-Perl Pre Processor) reads the Verilog files passed on the
42command line and outputs preprocessed output.
43
44=item L<vrename>
45
46Vrename will allow a signal to be changed across all levels of the design
47hierarchy, or to create a cross reference of signal names.
48
49=back
50
51=head1 PACKAGES
52
53=over 4
54
55=item L<Verilog::Getopt|Verilog::Getopt>
56
57Verilog::Getopt provides standardized handling of options similar to
58Verilog/VCS and cc/GCC.
59
60=item L<Verilog::Language|Verilog::Language>
61
62Verilog::Language provides general utilities for using the Verilog
63Language, such as parsing numbers or determining what keywords exist.
64
65=item L<Verilog::Netlist|Verilog::Netlist>
66
67Verilog::Netlist reads and holds interconnect information about a whole
68design database.
69
70=item L<Verilog::Netlist::Cell|Verilog::Netlist::Cell>
71
72A Verilog::Netlist::Cell object is created by Verilog::Netlist for every
73instantiation in the current module.
74
75=item L<Verilog::Netlist::ContAssign|Verilog::Netlist::ContAssign>
76
77A Verilog::Netlist::ContAssign object is created by Verilog::Netlist for
78every continuous assignment in the current module.
79
80=item L<Verilog::Netlist::File|Verilog::Netlist::File>
81
82Verilog::Netlist::File allows Verilog::Netlist objects to be read and
83written in Verilog format.
84
85=item L<Verilog::Netlist::Module|Verilog::Netlist::Module>
86
87A Verilog::Netlist::Module object is created by Verilog::Netlist for every
88module in the design.
89
90=item L<Verilog::Netlist::Net|Verilog::Netlist::Net>
91
92A Verilog::Netlist::Net object is created by Verilog::Netlist::Module for
93every signal and input/output declaration in the current module.
94
95=item L<Verilog::Netlist::Pin|Verilog::Netlist::Pin>
96
97A Verilog::Netlist::Pin object is created by Verilog::Netlist::Cell for for
98each pin connection on a cell.
99
100=item L<Verilog::Netlist::Port|Verilog::Netlist::Port>
101
102A Verilog::Netlist::Port object is created by Verilog::Netlist::Module for
103every port connection in the module.
104
105=item L<Verilog::Netlist::Subclass|Verilog::Netlist::Subclass>
106
107The Verilog::Netlist::Subclass is used as a base class for all
108Verilog::Netlist::* structures.
109
110=item L<Verilog::Parser|Verilog::Parser>
111
112Verilog::Parser will tokenize a Verilog file and invoke various callback
113methods.
114
115=item L<Verilog::Preproc|Verilog::Preproc>
116
117Verilog::Preproc reads Verilog files, and preprocesses them according to
118the Verilog specification. Programs can be easily converted from reading a
119IO::File into reading preprocessed output from Verilog::Preproc.
120
121=item L<Verilog::SigParse|Verilog::SigParser>
122
123Verilog::SigParser builds upon the Verilog::Parser package to provide
124callbacks for when a signal is declared, a module instantiated, or a module
125defined.
126
127=back
128
129=head1 WHICH PARSER PACKAGE?
130
131If you are starting a new application which needs to parse the Verilog
132language you have several tools available to you. Which you pick depends
133on how low level and complete the information you need is.
134
135=over 4
136
137=item VParseBison.y
138
139The low level VParse* source files may be of use when you need a starting
140point for your own a full C++ SystemVerilog grammar parser, using Bison and
141Flex. It understands most of the SystemVerilog 2017 grammar (1800-2017
142Appendix A).
143
144=item Verilog::Preproc
145
146Verilog::Preproc is useful when you need only post-preprocessed text
147output, or a list of defines, includes, etc. It can preprocess a file, or
148be used to provide the Verilog macro language on top of synthesis scripts.
149It understands and implements all preprocessor features of SystemVerilog
1502017.
151
152=item Verilog::Parser
153
154Verilog::Parser is useful when you need to tokenize or write source filters
155(where you need everything including whitespace). It can take raw files,
156or preprocessed input, and generates callbacks. It understands all
157SystemVerilog 2017 keywords.
158
159=item Abstract Syntax Tree
160
161Verilog::Parser knows enough to make a complete Abstract Syntax Tree (AST)
162of Verilog syntax. This represents all major constructs such as a "module"
163as a data structure, but does not interconnect the AST nodes as would be
164needed to follow signals. Not all keywords have been implemented; many are
165parsed but otherwise ignored. A complete Ast tree would allow any
166arbitrary transformation of Verilog syntax (everything is known excluding
167whitespace). For these applications consider Verilator's XML output
168(below).
169
170=item Verilog::SigParser
171
172Verilog::SigParser is useful when you need a list of modules, signals,
173ports, functions, etc. It requires a preprocessed file (from
174Verilog::Preproc), and can parse all SystemVerilog 2017 files, but only
175provides callbacks on certain interesting things. The SigParser operates
176only on a file at a time; it does not interconnect signals nor perform any
177elaboration (resolution of parameters).
178
179=item Verilog::Netlist
180
181Verilog::Netlist is useful for when you need the hierarchy, and a list of
182signals per module, pins per cell, etc. It builds upon the output of
183Verilog::SigParser, so requires preprocessed files (from Verilog::Preproc).
184It parses all SystemVerilog 2017 files, but not all SystemVerilog
185constructs are loaded into objects. Verilog::Netlist interconnects modules
186with instantiations but does not perform any elaboration (resolution of
187parameters).
188
189=item VPI
190
191Using the VPI is the best way to access the behavior of the design. It is
192not part of this package as it requires a compliant simulator and C++ code
193to call the VPI, and understands as much of the language as the simulator
194supports. This allows writing lint checks and full knowledge of all parts
195of the code. The VPI can operate ONLY on an elaborated design (where all
196parameters are resolved). Walking a VPI tree general requires a good deal
197of work compared to simple scripting (though little work compared to
198writing a parser from scratch).
199
200=item Verilator
201
202The Verilator program also contains a very similar front end as
203Verilog-Perl and can create XML output showing the abstract syntax tree.
204Verilator also understands how to elaborate and connect complex pins and
205types, but supports mostly only the synthesis subset of SystemVerilog.
206
207If you're looking to parse only synthesizable code this is the recommended
208route.
209
210=item Verilog-Mode for Emacs
211
212Although not a parser, a common requested use of Verilog-Perl is to
213automatically make shell modules and interconnect modules. Verilog-Mode is
214a better solution to this problem, as it results in completely portable
215code; the program (Verilog-Mode) isn't needed for others to update the
216design. It's also in very common usage, including by many IP providers.
217
218=back
219
220=head1 INSTALLATION
221
222Skip this section if Verilog-Perl has already been installed.
223
224Verilog-Perl should run on any system with Perl, G++, Flex, and Bison. It
225is known to work on most Linux distributions, plus Cygwin.
226
227You may install using either CPAN, or the sources. If you plan to do any
228development on Verilog-Perl, use the sources.
229
230=head2 CPAN Installation
231
232Option 1: Easiest installation is using the "CPAN" command line that comes
233with Perl. After configuring CPAN the first time, simply
234
235 cpan install Verilog-Perl
236 # And see the documentation
237 man Verilog-Perl
238 # Or, sometimes the capitalization is changed
239 man verilog-perl
240
241Read the rest of this file for details on the programs provided.
242
243=head2 Manual Installation from Repository
244
245Option 2: Build any version using the source development repository with:
246
247 git clone http://git.veripool.org/git/Verilog-Perl # Only first time
248 cd Verilog-Perl
249 git pull # Make sure we're up-to-date
250 git tag # See what versions exist (recent GITs only)
251 #git checkout master # Use development branch (e.g. recent bug fix)
252 #git checkout stable # Use most recent release
253 #git checkout v{version} # Switch to specified release version
254
255 perl Makefile.PL
256 # Ignore warning about README, this file will be generated
257 make
258 make test
259 make install
260
261Read the rest of this file for details on the programs provided.
262
263=head1 FAQ
264
265=over 4
266
267=item Why do I get "unexpected `do'" or "unexpected `bit'" errors?
268
269Do, bit, ref, return, and other words are now SystemVerilog keywords. You
270should change your code to not use them to insure it works with newer
271tools. Alternatively, surround them by the Verilog 2005/SystemVerilog
272begin_keywords pragma to indicate Verilog 2001 code.
273
274 `begin_keywords "1364-2001"
275 integer bit; initial bit = 1;
276 `end_keywords
277
278Alternatively use the --language (for vhier) or
279Verilog::Language::language_standard call to specify "1364-2001", or for
280really old code, "1364-1995".
281
282But, again, you really should fix the Verilog code.
283
284=item With Verilog::Netlist how do I resolve signal widths that include
285parameters down to constants?
286
287Unfortunately parameter resolution is part of elaboration. Verilog-Perl
288doesn't do elaboration as it requires a good fraction of a complete
289simulator implementation. Many applications can work around this
290limitation, if yours still requires elaboration you're stuck with using
291Verilator or the VPI, see the sections above.
292
293=back
294
295=head1 DISTRIBUTION
296
297Verilog-Perl is part of the L<https://www.veripool.org/> free Verilog EDA
298software tool suite. The latest version is available from CPAN and from
299L<https://www.veripool.org/verilog-perl>.
300
301Copyright 2000-2021 by Wilson Snyder. This package is free software; you
302can redistribute it and/or modify it under the terms of either the GNU
303Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
304
305This code is provided with no warranty of any kind, and is used entirely at
306your own risk.
307
308=head1 AUTHORS
309
310Wilson Snyder <wsnyder@wsnyder.org>
311
312=head1 SEE ALSO
313
314L<vhier>,
315L<vpassert>,
316L<vppreproc>,
317L<vrename>
318
319L<Verilog::EditFiles>,
320L<Verilog::Getopt>,
321L<Verilog::Language>
322L<Verilog::Netlist>,
323L<Verilog::Parser>,
324L<Verilog::Preproc>,
325L<Verilog::SigParser>
326
327L<Verilog::Netlist::Cell>,
328L<Verilog::Netlist::ContAssign>,
329L<Verilog::Netlist::File>,
330L<Verilog::Netlist::Interface>,
331L<Verilog::Netlist::ModPort>,
332L<Verilog::Netlist::Module>,
333L<Verilog::Netlist::Net>,
334L<Verilog::Netlist::Pin>,
335L<Verilog::Netlist::Port>,
336L<Verilog::Netlist::Subclass>,
337
338And the L<https://www.veripool.org/verilog-mode>Verilog-Mode package for Emacs.
339
340=cut
341