line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Verilog - Verilog Perl Interface |
2
|
|
|
|
|
|
|
# See copyright, etc in below POD section. |
3
|
|
|
|
|
|
|
###################################################################### |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Verilog::Netlist::PinSelection; |
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
58
|
use vars qw($VERSION); |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
415
|
|
8
|
8
|
|
|
8
|
|
44
|
use strict; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
184
|
|
9
|
8
|
|
|
8
|
|
38
|
use warnings; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
3350
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.427'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
###################################################################### |
14
|
|
|
|
|
|
|
#### Methods |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
## Constructor |
17
|
|
|
|
|
|
|
sub new { |
18
|
852
|
|
|
852
|
0
|
1955
|
my ($class, $netname, $msb, $lsb) = @_; |
19
|
|
|
|
|
|
|
|
20
|
852
|
|
|
|
|
1695
|
my $self = bless({}, $class); |
21
|
852
|
|
|
|
|
2263
|
$self->{_netname} = $netname; |
22
|
852
|
|
|
|
|
1389
|
$self->{_msb} = $msb; |
23
|
852
|
|
|
|
|
1184
|
$self->{_lsb} = $lsb; |
24
|
852
|
|
|
|
|
2419
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
## Standard accessors |
28
|
|
|
|
|
|
|
sub netname { |
29
|
|
|
|
|
|
|
# ($self, $new) = @_; |
30
|
210
|
50
|
|
210
|
1
|
386
|
$_[0]->{_netname} = $_[1] if (@_ == 2); |
31
|
210
|
|
|
|
|
506
|
return $_[0]->{_netname}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub lsb { |
35
|
|
|
|
|
|
|
# ($self, $new) = @_; |
36
|
19
|
50
|
|
19
|
1
|
38
|
$_[0]->{_lsb} = $_[1] if (@_ == 2); |
37
|
19
|
|
|
|
|
42
|
return $_[0]->{_lsb}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub msb { |
41
|
|
|
|
|
|
|
# ($self, $new) = @_; |
42
|
126
|
50
|
|
126
|
1
|
239
|
$_[0]->{_msb} = $_[1] if (@_ == 2); |
43
|
126
|
|
|
|
|
281
|
return $_[0]->{_msb}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
## Member functions |
47
|
|
|
|
|
|
|
sub bracketed_msb_lsb { |
48
|
79
|
|
|
79
|
1
|
101
|
my $self = shift; |
49
|
79
|
|
|
|
|
111
|
my $out = ""; |
50
|
|
|
|
|
|
|
# Handle sized constant numbers (e.g., 7'b0) distinctively |
51
|
|
|
|
|
|
|
# but leave unsized constants (msb/lsb undefined) alone. |
52
|
79
|
50
|
|
|
|
175
|
if ($self->netname =~ /^'/) { |
53
|
0
|
0
|
|
|
|
0
|
$out .= $self->msb + 1 if defined($self->msb); |
54
|
0
|
|
|
|
|
0
|
$out .= $self->netname; |
55
|
|
|
|
|
|
|
} else { |
56
|
79
|
|
|
|
|
131
|
$out .= $self->netname; |
57
|
79
|
100
|
|
|
|
190
|
if (defined($self->msb)) { |
58
|
11
|
100
|
|
|
|
22
|
if ($self->msb == $self->lsb) { |
59
|
6
|
|
|
|
|
12
|
$out .= "[".$self->msb."]"; |
60
|
|
|
|
|
|
|
} else { |
61
|
5
|
|
|
|
|
11
|
$out .= "[".$self->msb.":".$self->lsb."]"; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
79
|
|
|
|
|
202
|
return $out; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
###################################################################### |
69
|
|
|
|
|
|
|
#### Package return |
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
__END__ |