line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Verilog::SigParser.pm -- Verilog signal parsing |
2
|
|
|
|
|
|
|
# See copyright, etc in below POD section. |
3
|
|
|
|
|
|
|
###################################################################### |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Verilog::SigParser; |
6
|
|
|
|
|
|
|
require 5.000; |
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
218491
|
use strict; |
|
10
|
|
|
|
|
46
|
|
|
10
|
|
|
|
|
282
|
|
9
|
10
|
|
|
10
|
|
41
|
use vars qw($VERSION $Debug); |
|
10
|
|
|
|
|
55
|
|
|
10
|
|
|
|
|
384
|
|
10
|
10
|
|
|
10
|
|
68
|
use Carp; |
|
10
|
|
|
|
|
1266
|
|
|
10
|
|
|
|
|
470
|
|
11
|
10
|
|
|
10
|
|
3606
|
use Verilog::Parser; |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
353
|
|
12
|
10
|
|
|
10
|
|
59
|
use base qw(Verilog::Parser); |
|
10
|
|
|
|
|
12
|
|
|
10
|
|
|
|
|
9568
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
###################################################################### |
15
|
|
|
|
|
|
|
#### Configuration Section |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = '3.480'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @_Callback_Names = qw( |
20
|
|
|
|
|
|
|
attribute |
21
|
|
|
|
|
|
|
class |
22
|
|
|
|
|
|
|
contassign |
23
|
|
|
|
|
|
|
covergroup |
24
|
|
|
|
|
|
|
defparam |
25
|
|
|
|
|
|
|
endcell |
26
|
|
|
|
|
|
|
endclass |
27
|
|
|
|
|
|
|
endgroup |
28
|
|
|
|
|
|
|
endinterface |
29
|
|
|
|
|
|
|
endmodport |
30
|
|
|
|
|
|
|
endmodule |
31
|
|
|
|
|
|
|
endpackage |
32
|
|
|
|
|
|
|
endprogram |
33
|
|
|
|
|
|
|
endtaskfunc |
34
|
|
|
|
|
|
|
function |
35
|
|
|
|
|
|
|
import |
36
|
|
|
|
|
|
|
instant |
37
|
|
|
|
|
|
|
interface |
38
|
|
|
|
|
|
|
modport |
39
|
|
|
|
|
|
|
module |
40
|
|
|
|
|
|
|
package |
41
|
|
|
|
|
|
|
parampin |
42
|
|
|
|
|
|
|
pin |
43
|
|
|
|
|
|
|
pinselects |
44
|
|
|
|
|
|
|
port |
45
|
|
|
|
|
|
|
program |
46
|
|
|
|
|
|
|
task |
47
|
|
|
|
|
|
|
var |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
####################################################################### |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# parse, parse_file, etc are inherited from Verilog::Parser |
53
|
|
|
|
|
|
|
sub new { |
54
|
486
|
|
|
486
|
1
|
1569
|
my $class = shift; |
55
|
|
|
|
|
|
|
|
56
|
486
|
|
|
|
|
1727
|
my $self = $class->SUPER::new(_sigparser => 1, |
57
|
|
|
|
|
|
|
use_unreadback => 0, |
58
|
|
|
|
|
|
|
use_protected => 0, |
59
|
|
|
|
|
|
|
use_pinselects => 0, |
60
|
|
|
|
|
|
|
@_); |
61
|
486
|
|
|
|
|
742
|
bless $self, $class; |
62
|
486
|
50
|
|
|
|
944
|
$self->debug($Debug) if $Debug; |
63
|
486
|
100
|
|
|
|
1300
|
$self->{metacomment} = {} unless defined $self->{metacomment}; |
64
|
486
|
|
|
|
|
915
|
return $self; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub metacomment { |
68
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
69
|
0
|
|
|
|
|
0
|
return $self->{metacomment}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
####################################################################### |
73
|
|
|
|
|
|
|
# Accessors |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub callback_names { |
76
|
1
|
|
|
1
|
1
|
143
|
my @out = sort @_Callback_Names; |
77
|
1
|
|
|
|
|
6
|
return @out; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
####################################################################### |
81
|
|
|
|
|
|
|
# Parser callbacks - backward compatibility |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub comment { |
84
|
3950
|
|
|
3950
|
1
|
5544
|
my $self = shift; |
85
|
3950
|
|
|
|
|
4528
|
my $text = shift; # Includes comment delimiters |
86
|
3950
|
100
|
|
|
|
16299
|
if ($text =~ m!^(/.)\s* ([\$A-Za-z]\w*)\s+ (\w+) !x) { |
87
|
2250
|
|
|
|
|
7010
|
my ($delim, $category, $name) = ($1, $2, $3); |
88
|
2250
|
50
|
|
|
|
4526
|
if ($self->{metacomment}->{$category}) { |
89
|
0
|
0
|
|
|
|
0
|
print "GotaMeta $category $name\n" if ($Debug); |
90
|
0
|
0
|
|
|
|
0
|
if ($delim eq "/*") { $text =~ s!\s*\*/$!!; } |
|
0
|
|
|
|
|
0
|
|
91
|
0
|
|
|
|
|
0
|
else { $text =~ s!\s+$!!; } |
92
|
0
|
|
|
|
|
0
|
$text =~ s!^/.\s*!!; |
93
|
0
|
|
|
|
|
0
|
$self->attribute( $text ); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
3950
|
|
|
|
|
7392
|
$self->SUPER::comment($text); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
####################################################################### |
100
|
|
|
|
|
|
|
# Null callbacks |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# The my's aren't needed since we do nothing, but are useful if the |
103
|
|
|
|
|
|
|
# user copies them from here to their program. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub contassign { |
106
|
672
|
|
|
672
|
1
|
984
|
my $self = shift; |
107
|
672
|
|
|
|
|
767
|
my $lhs = shift; |
108
|
672
|
|
|
|
|
4470
|
my $rhs = shift; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub class { |
112
|
1020
|
|
|
1020
|
1
|
1436
|
my $self = shift; |
113
|
1020
|
|
|
|
|
1145
|
my $keyword = shift; |
114
|
1020
|
|
|
|
|
1111
|
my $name = shift; |
115
|
1020
|
|
|
|
|
3634
|
my $virtual = shift; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub covergroup { |
119
|
154
|
|
|
154
|
1
|
278
|
my $self = shift; |
120
|
154
|
|
|
|
|
197
|
my $keyword = shift; |
121
|
154
|
|
|
|
|
632
|
my $name = shift; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub defparam { |
125
|
52
|
|
|
52
|
1
|
102
|
my $self = shift; |
126
|
52
|
|
|
|
|
79
|
my $lhs = shift; |
127
|
52
|
|
|
|
|
332
|
my $rhs = shift; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub endclass { |
131
|
1020
|
|
|
1020
|
1
|
6061
|
my $self = shift; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub endcell { |
135
|
1554
|
|
|
1554
|
1
|
5722
|
my $self = shift; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub endgroup { |
139
|
154
|
|
|
154
|
1
|
1240
|
my $self = shift; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub endinterface { |
143
|
156
|
|
|
156
|
1
|
915
|
my $self = shift; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub endmodport { |
147
|
154
|
|
|
154
|
1
|
721
|
my $self = shift; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub endtaskfunc { |
151
|
2652
|
|
|
2652
|
1
|
18880
|
my $self = shift; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub endmodule { |
155
|
4906
|
|
|
4906
|
1
|
38969
|
my $self = shift; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub endpackage { |
159
|
160
|
|
|
160
|
1
|
948
|
my $self = shift; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub endprogram { |
163
|
52
|
|
|
52
|
1
|
330
|
my $self = shift; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub function { |
167
|
1632
|
|
|
1632
|
1
|
2575
|
my $self = shift; |
168
|
1632
|
|
|
|
|
1983
|
my $keyword = shift; |
169
|
1632
|
|
|
|
|
1977
|
my $name = shift; |
170
|
1632
|
|
|
|
|
8887
|
my $data_type = shift; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub import { |
174
|
172
|
|
|
172
|
|
2187
|
my $self = shift; |
175
|
172
|
|
|
|
|
209
|
my $module = shift; |
176
|
172
|
|
|
|
|
881
|
my $name = shift; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub instant { |
180
|
1554
|
|
|
1554
|
1
|
2063
|
my $self = shift; |
181
|
1554
|
|
|
|
|
2086
|
my $module = shift; |
182
|
1554
|
|
|
|
|
1701
|
my $cell = shift; |
183
|
1554
|
|
|
|
|
7525
|
my $range = shift; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub interface { |
187
|
156
|
|
|
156
|
1
|
275
|
my $self = shift; |
188
|
156
|
|
|
|
|
209
|
my $keyword = shift; |
189
|
156
|
|
|
|
|
666
|
my $name = shift; |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub modport { |
193
|
154
|
|
|
154
|
1
|
261
|
my $self = shift; |
194
|
154
|
|
|
|
|
276
|
my $keyword = shift; |
195
|
154
|
|
|
|
|
694
|
my $name = shift; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub module { |
199
|
4753
|
|
|
4753
|
1
|
7722
|
my $self = shift; |
200
|
4753
|
|
|
|
|
5076
|
my $keyword = shift; |
201
|
4753
|
|
|
|
|
5132
|
my $name = shift; |
202
|
4753
|
|
|
|
|
4485
|
shift; # Ignored |
203
|
4753
|
|
|
|
|
17824
|
my $in_celldefine = shift; |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub pin { |
207
|
2219
|
|
|
2219
|
1
|
2747
|
my $self = shift; |
208
|
2219
|
|
|
|
|
2274
|
my $name = shift; |
209
|
2219
|
|
|
|
|
2223
|
my $conn = shift; |
210
|
2219
|
|
|
|
|
8715
|
my $number = shift; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub pinselects { |
214
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
215
|
0
|
|
|
|
|
0
|
my $name = shift; |
216
|
0
|
|
|
|
|
0
|
my $conns = shift; |
217
|
0
|
|
|
|
|
0
|
my $number = shift; |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
sub package { |
221
|
160
|
|
|
160
|
1
|
317
|
my $self = shift; |
222
|
160
|
|
|
|
|
246
|
my $kwd = shift; |
223
|
160
|
|
|
|
|
943
|
my $name = shift; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub parampin { |
227
|
463
|
|
|
463
|
1
|
611
|
my $self = shift; |
228
|
463
|
|
|
|
|
589
|
my $name = shift; |
229
|
463
|
|
|
|
|
484
|
my $conn = shift; |
230
|
463
|
|
|
|
|
2128
|
my $number = shift; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub port { |
234
|
8276
|
|
|
8276
|
1
|
10356
|
my $self = shift; |
235
|
8276
|
|
|
|
|
8499
|
my $name = shift; |
236
|
8276
|
|
|
|
|
8068
|
my $objof = shift; |
237
|
8276
|
|
|
|
|
7897
|
my $direction = shift; |
238
|
8276
|
|
|
|
|
8926
|
my $data_type = shift; |
239
|
8276
|
|
|
|
|
8595
|
my $array = shift; |
240
|
8276
|
|
|
|
|
40845
|
my $pinnum = shift; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub program { |
244
|
52
|
|
|
52
|
1
|
84
|
my $self = shift; |
245
|
52
|
|
|
|
|
81
|
my $kwd = shift; |
246
|
52
|
|
|
|
|
205
|
my $name = shift; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub task { |
250
|
1020
|
|
|
1020
|
1
|
1492
|
my $self = shift; |
251
|
1020
|
|
|
|
|
1053
|
my $keyword = shift; |
252
|
1020
|
|
|
|
|
5344
|
my $name = shift; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub var { |
256
|
25840
|
|
|
25840
|
1
|
32923
|
my $self = shift; |
257
|
25840
|
|
|
|
|
24112
|
my $keyword = shift; |
258
|
25840
|
|
|
|
|
24200
|
my $name = shift; |
259
|
25840
|
|
|
|
|
26203
|
my $objof = shift; |
260
|
25840
|
|
|
|
|
23173
|
my $net_type = shift; |
261
|
25840
|
|
|
|
|
25475
|
my $data_type = shift; |
262
|
25840
|
|
|
|
|
23252
|
my $array = shift; |
263
|
25840
|
|
|
|
|
148864
|
my $value = shift; |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
###################################################################### |
267
|
|
|
|
|
|
|
### Package return |
268
|
|
|
|
|
|
|
1; |
269
|
|
|
|
|
|
|
__END__ |