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
|
|
276213
|
use strict; |
|
10
|
|
|
|
|
59
|
|
|
10
|
|
|
|
|
338
|
|
9
|
10
|
|
|
10
|
|
47
|
use vars qw($VERSION $Debug); |
|
10
|
|
|
|
|
91
|
|
|
10
|
|
|
|
|
505
|
|
10
|
10
|
|
|
10
|
|
55
|
use Carp; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
620
|
|
11
|
10
|
|
|
10
|
|
4580
|
use Verilog::Parser; |
|
10
|
|
|
|
|
29
|
|
|
10
|
|
|
|
|
566
|
|
12
|
10
|
|
|
10
|
|
96
|
use base qw(Verilog::Parser); |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
12006
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
###################################################################### |
15
|
|
|
|
|
|
|
#### Configuration Section |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = '3.476'; |
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
|
1878
|
my $class = shift; |
55
|
|
|
|
|
|
|
|
56
|
486
|
|
|
|
|
1910
|
my $self = $class->SUPER::new(_sigparser => 1, |
57
|
|
|
|
|
|
|
use_unreadback => 0, |
58
|
|
|
|
|
|
|
use_protected => 0, |
59
|
|
|
|
|
|
|
use_pinselects => 0, |
60
|
|
|
|
|
|
|
@_); |
61
|
486
|
|
|
|
|
873
|
bless $self, $class; |
62
|
486
|
50
|
|
|
|
1083
|
$self->debug($Debug) if $Debug; |
63
|
486
|
100
|
|
|
|
1494
|
$self->{metacomment} = {} unless defined $self->{metacomment}; |
64
|
486
|
|
|
|
|
1038
|
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
|
237
|
my @out = sort @_Callback_Names; |
77
|
1
|
|
|
|
|
18
|
return @out; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
####################################################################### |
81
|
|
|
|
|
|
|
# Parser callbacks - backward compatibility |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub comment { |
84
|
3950
|
|
|
3950
|
1
|
5907
|
my $self = shift; |
85
|
3950
|
|
|
|
|
5004
|
my $text = shift; # Includes comment delimiters |
86
|
3950
|
100
|
|
|
|
19448
|
if ($text =~ m!^(/.)\s* ([\$A-Za-z]\w*)\s+ (\w+) !x) { |
87
|
2250
|
|
|
|
|
7948
|
my ($delim, $category, $name) = ($1, $2, $3); |
88
|
2250
|
50
|
|
|
|
5311
|
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
|
|
|
|
|
8985
|
$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
|
1120
|
my $self = shift; |
107
|
672
|
|
|
|
|
820
|
my $lhs = shift; |
108
|
672
|
|
|
|
|
5043
|
my $rhs = shift; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub class { |
112
|
1020
|
|
|
1020
|
1
|
1735
|
my $self = shift; |
113
|
1020
|
|
|
|
|
1203
|
my $keyword = shift; |
114
|
1020
|
|
|
|
|
1145
|
my $name = shift; |
115
|
1020
|
|
|
|
|
4546
|
my $virtual = shift; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub covergroup { |
119
|
154
|
|
|
154
|
1
|
267
|
my $self = shift; |
120
|
154
|
|
|
|
|
250
|
my $keyword = shift; |
121
|
154
|
|
|
|
|
836
|
my $name = shift; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub defparam { |
125
|
52
|
|
|
52
|
1
|
115
|
my $self = shift; |
126
|
52
|
|
|
|
|
83
|
my $lhs = shift; |
127
|
52
|
|
|
|
|
399
|
my $rhs = shift; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub endclass { |
131
|
1020
|
|
|
1020
|
1
|
7011
|
my $self = shift; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub endcell { |
135
|
1554
|
|
|
1554
|
1
|
6814
|
my $self = shift; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub endgroup { |
139
|
154
|
|
|
154
|
1
|
1456
|
my $self = shift; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub endinterface { |
143
|
156
|
|
|
156
|
1
|
1130
|
my $self = shift; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub endmodport { |
147
|
154
|
|
|
154
|
1
|
882
|
my $self = shift; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub endtaskfunc { |
151
|
2652
|
|
|
2652
|
1
|
21229
|
my $self = shift; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub endmodule { |
155
|
4906
|
|
|
4906
|
1
|
46453
|
my $self = shift; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub endpackage { |
159
|
160
|
|
|
160
|
1
|
1150
|
my $self = shift; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub endprogram { |
163
|
52
|
|
|
52
|
1
|
395
|
my $self = shift; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub function { |
167
|
1632
|
|
|
1632
|
1
|
2798
|
my $self = shift; |
168
|
1632
|
|
|
|
|
2025
|
my $keyword = shift; |
169
|
1632
|
|
|
|
|
1946
|
my $name = shift; |
170
|
1632
|
|
|
|
|
10510
|
my $data_type = shift; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub import { |
174
|
172
|
|
|
172
|
|
2784
|
my $self = shift; |
175
|
172
|
|
|
|
|
246
|
my $module = shift; |
176
|
172
|
|
|
|
|
1120
|
my $name = shift; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub instant { |
180
|
1554
|
|
|
1554
|
1
|
2497
|
my $self = shift; |
181
|
1554
|
|
|
|
|
2169
|
my $module = shift; |
182
|
1554
|
|
|
|
|
1811
|
my $cell = shift; |
183
|
1554
|
|
|
|
|
8409
|
my $range = shift; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub interface { |
187
|
156
|
|
|
156
|
1
|
316
|
my $self = shift; |
188
|
156
|
|
|
|
|
274
|
my $keyword = shift; |
189
|
156
|
|
|
|
|
745
|
my $name = shift; |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub modport { |
193
|
154
|
|
|
154
|
1
|
291
|
my $self = shift; |
194
|
154
|
|
|
|
|
193
|
my $keyword = shift; |
195
|
154
|
|
|
|
|
719
|
my $name = shift; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub module { |
199
|
4753
|
|
|
4753
|
1
|
7669
|
my $self = shift; |
200
|
4753
|
|
|
|
|
5923
|
my $keyword = shift; |
201
|
4753
|
|
|
|
|
5426
|
my $name = shift; |
202
|
4753
|
|
|
|
|
5350
|
shift; # Ignored |
203
|
4753
|
|
|
|
|
21201
|
my $in_celldefine = shift; |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub pin { |
207
|
2219
|
|
|
2219
|
1
|
3171
|
my $self = shift; |
208
|
2219
|
|
|
|
|
2571
|
my $name = shift; |
209
|
2219
|
|
|
|
|
2480
|
my $conn = shift; |
210
|
2219
|
|
|
|
|
9275
|
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
|
375
|
my $self = shift; |
222
|
160
|
|
|
|
|
257
|
my $kwd = shift; |
223
|
160
|
|
|
|
|
1199
|
my $name = shift; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub parampin { |
227
|
463
|
|
|
463
|
1
|
724
|
my $self = shift; |
228
|
463
|
|
|
|
|
620
|
my $name = shift; |
229
|
463
|
|
|
|
|
641
|
my $conn = shift; |
230
|
463
|
|
|
|
|
2413
|
my $number = shift; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
sub port { |
234
|
8276
|
|
|
8276
|
1
|
10374
|
my $self = shift; |
235
|
8276
|
|
|
|
|
9352
|
my $name = shift; |
236
|
8276
|
|
|
|
|
9483
|
my $objof = shift; |
237
|
8276
|
|
|
|
|
8710
|
my $direction = shift; |
238
|
8276
|
|
|
|
|
9276
|
my $data_type = shift; |
239
|
8276
|
|
|
|
|
9170
|
my $array = shift; |
240
|
8276
|
|
|
|
|
46641
|
my $pinnum = shift; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub program { |
244
|
52
|
|
|
52
|
1
|
116
|
my $self = shift; |
245
|
52
|
|
|
|
|
103
|
my $kwd = shift; |
246
|
52
|
|
|
|
|
238
|
my $name = shift; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub task { |
250
|
1020
|
|
|
1020
|
1
|
1661
|
my $self = shift; |
251
|
1020
|
|
|
|
|
1159
|
my $keyword = shift; |
252
|
1020
|
|
|
|
|
6446
|
my $name = shift; |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub var { |
256
|
25840
|
|
|
25840
|
1
|
38068
|
my $self = shift; |
257
|
25840
|
|
|
|
|
31192
|
my $keyword = shift; |
258
|
25840
|
|
|
|
|
27804
|
my $name = shift; |
259
|
25840
|
|
|
|
|
27511
|
my $objof = shift; |
260
|
25840
|
|
|
|
|
26388
|
my $net_type = shift; |
261
|
25840
|
|
|
|
|
27561
|
my $data_type = shift; |
262
|
25840
|
|
|
|
|
26784
|
my $array = shift; |
263
|
25840
|
|
|
|
|
176632
|
my $value = shift; |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
###################################################################### |
267
|
|
|
|
|
|
|
### Package return |
268
|
|
|
|
|
|
|
1; |
269
|
|
|
|
|
|
|
__END__ |