File tree Expand file tree Collapse file tree 11 files changed +67
-3
lines changed Expand file tree Collapse file tree 11 files changed +67
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ indicates the contributor was also the author of the fix; Thanks!
66
77* Verilog-Perl 3.471 devel
88
9+ *** Add vhier --includes. [Gregory Pierce]
10+
911**** Add error on misused define (#1659). [Topa Tota]
1012
1113**** Fix packages as enum base types, Verilator bug 2202. [Driss Hafdi]
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ sub new {
4040
4141 my $self = {defines => {},
4242 incdir => [' .' , ],
43+ includes => {},
4344 module_dir => [' .' , ],
4445 libext => [' .v' , ],
4546 library => [ ],
@@ -335,6 +336,17 @@ sub write_parameters_file {
335336 $fh -> close ;
336337}
337338
339+ sub includes {
340+ my $self = shift ;
341+ if (@_ ) {
342+ my $from_filename = shift ;
343+ my $inc_filename = shift ;
344+ $self -> {includes }{$from_filename } ||= [];
345+ push @{$self -> {includes }{$from_filename }}, $inc_filename ;
346+ }
347+ return $self -> {includes };
348+ }
349+
338350# ######################################################################
339351# Utility functions
340352
@@ -756,6 +768,13 @@ undefined variables are not substituted nor cause errors.
756768Returns reference to list of include directories. With argument, adds that
757769directory.
758770
771+ =item $self->includes
772+
773+ Returns reference to hash of files that included some file, and for each
774+ hash value a list of files included. Only relevant after Verilog::Netlist
775+ processing. With two arguments, adds an include for the given referencing
776+ filename to the given include filename.
777+
759778=item $self->libext
760779
761780Returns reference to list of library extensions. With argument, adds that
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ t/80_vppreproc_simple.out
137137t/85_vhier.t
138138t/85_vhier_cells.out
139139t/85_vhier_forest.out
140+ t/85_vhier_includes.out
140141t/85_vhier_inpfiles.out
141142t/85_vhier_modfiles.out
142143t/85_vhier_resolvefiles.out
@@ -172,6 +173,7 @@ verilog/test.v
172173verilog/test.vrename
173174verilog/v_comments.v
174175verilog/v_gate.v
176+ verilog/v_hier_inc.vh
175177verilog/v_hier_noport.v
176178verilog/v_hier_sub.v
177179verilog/v_hier_subprim.v
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ sub def_substitute {
171171sub include {
172172 my ($self ,$filename )=@_ ;
173173 print " INCLUDE $filename \n " if $self -> {debug };
174+ $self -> {options }-> includes($self -> filename, $filename );
174175 $self -> open (filename => $filename ,
175176 open_nonfatal => $self -> {include_open_nonfatal },
176177 );
Original file line number Diff line number Diff line change @@ -9,19 +9,20 @@ use IO::File;
99use strict;
1010use Test::More;
1111
12- BEGIN { plan tests => 17 }
12+ BEGIN { plan tests => 19 }
1313BEGIN { require " ./t/test_utils.pl" ; }
1414
1515print " Checking vhier...\n " ;
1616
1717vhier (" t/85_vhier_cells.out" , " --cells" );
18+ vhier (" t/85_vhier_includes.out" , " --includes" );
1819vhier (" t/85_vhier_inpfiles.out" , " --input-files" );
1920vhier (" t/85_vhier_resolvefiles.out" ," --resolve-files" );
2021vhier (" t/85_vhier_modfiles.out" , " --module-files --language 2001" );
2122vhier (" t/85_vhier_topmodule.out" , " --module-files --top-module v_hier_sub" );
2223vhier (" t/85_vhier_forest.out" , " --forest --instance" );
2324vhier (" t/85_vhier_skiplist.out" , " --forest --instance --skiplist t/85_vhier_skiplist.dat" );
24- vhier (" t/85_vhier_xml.out" , " --xml --cells --input-files --module-files --missing-modules" );
25+ vhier (" t/85_vhier_xml.out" , " --xml --cells --includes -- input-files --module-files --missing-modules" );
2526check_valid_xml(" test_dir/vhier.out" );
2627
2728sub vhier {
Original file line number Diff line number Diff line change 1+ verilog/v_hier_top.v
2+ v_hier_inc.vh
Original file line number Diff line number Diff line change 1+ verilog/v_hier_inc.vh
12 verilog/v_hier_sub.v
23 verilog/v_hier_subsub.v
34 verilog/v_hier_top.v
Original file line number Diff line number Diff line change 1818 <file>verilog/v_hier_subsub.v</file>
1919 </module_files>
2020 <input_files>
21+ <file>verilog/v_hier_inc.vh</file>
2122 <file>verilog/v_hier_sub.v</file>
2223 <file>verilog/v_hier_subsub.v</file>
2324 <file>verilog/v_hier_top.v</file>
2425 <file>verilog/v_recursive.v</file>
2526 </input_files>
27+ <includes>
28+ <file>verilog/v_hier_top.v</file>
29+ <inc>v_hier_inc.vh</inc>
30+ </includes>
2631 <missing_modules>
2732 <module name="missing" />
2833 </missing_modules>
Original file line number Diff line number Diff line change 1+ // DESCRIPTION: Verilog-Perl: Example Verilog for testing package
2+ // This file ONLY is placed into the Public Domain, for any use,
3+ // without warranty, 2000-2012 by Wilson Snyder.
4+
5+ `ifndef V_HIER_INC_VH
6+ `define V_HIER_INC_VH // Guard
7+
8+ `define hsub v_hier_sub
9+
10+ `endif // Guard
Original file line number Diff line number Diff line change 22// This file ONLY is placed into the Public Domain, for any use,
33// without warranty, 2000-2012 by Wilson Snyder.
44
5- `define hsub v_hier_sub
5+ `include "v_hier_inc.vh"
66
77module v_hier_top (/*AUTOARG*/
88 // Inputs
You can’t perform that action at this time.
0 commit comments