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
|
|
49
|
use vars qw($VERSION); |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
316
|
|
8
|
8
|
|
|
8
|
|
39
|
use strict; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
138
|
|
9
|
8
|
|
|
8
|
|
32
|
use warnings; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
2703
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.427'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
###################################################################### |
14
|
|
|
|
|
|
|
#### Methods |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
## Constructor |
17
|
|
|
|
|
|
|
sub new { |
18
|
852
|
|
|
852
|
0
|
1525
|
my ($class, $netname, $msb, $lsb) = @_; |
19
|
|
|
|
|
|
|
|
20
|
852
|
|
|
|
|
1353
|
my $self = bless({}, $class); |
21
|
852
|
|
|
|
|
1808
|
$self->{_netname} = $netname; |
22
|
852
|
|
|
|
|
1090
|
$self->{_msb} = $msb; |
23
|
852
|
|
|
|
|
1135
|
$self->{_lsb} = $lsb; |
24
|
852
|
|
|
|
|
2099
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
## Standard accessors |
28
|
|
|
|
|
|
|
sub netname { |
29
|
|
|
|
|
|
|
# ($self, $new) = @_; |
30
|
210
|
50
|
|
210
|
1
|
301
|
$_[0]->{_netname} = $_[1] if (@_ == 2); |
31
|
210
|
|
|
|
|
408
|
return $_[0]->{_netname}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub lsb { |
35
|
|
|
|
|
|
|
# ($self, $new) = @_; |
36
|
19
|
50
|
|
19
|
1
|
29
|
$_[0]->{_lsb} = $_[1] if (@_ == 2); |
37
|
19
|
|
|
|
|
34
|
return $_[0]->{_lsb}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub msb { |
41
|
|
|
|
|
|
|
# ($self, $new) = @_; |
42
|
126
|
50
|
|
126
|
1
|
196
|
$_[0]->{_msb} = $_[1] if (@_ == 2); |
43
|
126
|
|
|
|
|
242
|
return $_[0]->{_msb}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
## Member functions |
47
|
|
|
|
|
|
|
sub bracketed_msb_lsb { |
48
|
79
|
|
|
79
|
1
|
85
|
my $self = shift; |
49
|
79
|
|
|
|
|
86
|
my $out = ""; |
50
|
|
|
|
|
|
|
# Handle sized constant numbers (e.g., 7'b0) distinctively |
51
|
|
|
|
|
|
|
# but leave unsized constants (msb/lsb undefined) alone. |
52
|
79
|
50
|
|
|
|
115
|
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
|
|
|
|
|
106
|
$out .= $self->netname; |
57
|
79
|
100
|
|
|
|
119
|
if (defined($self->msb)) { |
58
|
11
|
100
|
|
|
|
18
|
if ($self->msb == $self->lsb) { |
59
|
6
|
|
|
|
|
10
|
$out .= "[".$self->msb."]"; |
60
|
|
|
|
|
|
|
} else { |
61
|
5
|
|
|
|
|
9
|
$out .= "[".$self->msb.":".$self->lsb."]"; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
79
|
|
|
|
|
148
|
return $out; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
###################################################################### |
69
|
|
|
|
|
|
|
#### Package return |
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
__END__ |