| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Verilog::VCD::Writer::Module; |
|
2
|
|
|
|
|
|
|
$Verilog::VCD::Writer::Module::VERSION = '0.002'; |
|
3
|
3
|
|
|
3
|
|
129426
|
use strict; |
|
|
3
|
|
|
|
|
10
|
|
|
|
3
|
|
|
|
|
129
|
|
|
4
|
3
|
|
|
3
|
|
22
|
use warnings; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
114
|
|
|
5
|
3
|
|
|
3
|
|
1228
|
use DateTime; |
|
|
3
|
|
|
|
|
479420
|
|
|
|
3
|
|
|
|
|
106
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Module abstraction layer for Verilog::VCD::Writer |
|
8
|
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
1409
|
use Verilog::VCD::Writer::Signal; |
|
|
3
|
|
|
|
|
12
|
|
|
|
3
|
|
|
|
|
127
|
|
|
10
|
3
|
|
|
3
|
|
50
|
use v5.10; |
|
|
3
|
|
|
|
|
13
|
|
|
11
|
3
|
|
|
3
|
|
20
|
use Moose; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
22
|
|
|
12
|
3
|
|
|
3
|
|
22509
|
use namespace::clean; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
42
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has name => (is=>'ro'); |
|
15
|
|
|
|
|
|
|
has type => (is=>'ro',default=>'module'); |
|
16
|
|
|
|
|
|
|
has signals=>(is=>'rw',isa=>'ArrayRef[Verilog::VCD::Writer::Signal]', |
|
17
|
|
|
|
|
|
|
default=>sub{[]}, |
|
18
|
|
|
|
|
|
|
traits=>['Array'], |
|
19
|
|
|
|
|
|
|
handles=>{signals_push=>'push', |
|
20
|
|
|
|
|
|
|
signals_all=>'elements'} |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
has modules=>(is=>'rw',isa=>'ArrayRef[Verilog::VCD::Writer::Module]', |
|
23
|
|
|
|
|
|
|
default=>sub{[]}, |
|
24
|
|
|
|
|
|
|
traits=>['Array'], |
|
25
|
|
|
|
|
|
|
handles=>{modules_push=>'push', |
|
26
|
|
|
|
|
|
|
modules_all=>'elements'} |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
#has modules=>(is=>'rw',isa=>'ArrayRef'); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#my @signals; |
|
31
|
|
|
|
|
|
|
#my $modules; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub addSignal { |
|
35
|
13
|
|
|
13
|
1
|
1604
|
my ($self,$name,$bitmax,$bitmin)=@_; |
|
36
|
13
|
|
|
|
|
80
|
my $s=Verilog::VCD::Writer::Signal->new( |
|
37
|
|
|
|
|
|
|
name=>$name, |
|
38
|
|
|
|
|
|
|
bitmax=>$bitmax, |
|
39
|
|
|
|
|
|
|
bitmin=>$bitmin |
|
40
|
|
|
|
|
|
|
); |
|
41
|
13
|
|
|
|
|
10968
|
$self->signals_push($s); |
|
42
|
13
|
|
|
|
|
53
|
return $s; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub dupSignal { |
|
46
|
6
|
|
|
6
|
1
|
134
|
my ($self,$signal,$name,$bitmax,$bitmin)=@_; |
|
47
|
6
|
|
|
|
|
214
|
my $s=Verilog::VCD::Writer::Signal->new( |
|
48
|
|
|
|
|
|
|
name=>$name, |
|
49
|
|
|
|
|
|
|
bitmax=>$bitmax, |
|
50
|
|
|
|
|
|
|
bitmin=>$bitmin, |
|
51
|
|
|
|
|
|
|
symbol=>$signal->symbol |
|
52
|
|
|
|
|
|
|
); |
|
53
|
6
|
|
|
|
|
6976
|
$self->signals_push($s); |
|
54
|
|
|
|
|
|
|
#push @signals,$s; |
|
55
|
6
|
|
|
|
|
19
|
return $s; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub addSubModule { |
|
59
|
2
|
|
|
2
|
1
|
2142
|
my ($self,$name,$type)=@_; |
|
60
|
2
|
|
|
|
|
12
|
my $m=Verilog::VCD::Writer::Module->new( |
|
61
|
|
|
|
|
|
|
name=>$name, |
|
62
|
|
|
|
|
|
|
type=>$type # Module,Function,Task etc. |
|
63
|
|
|
|
|
|
|
); |
|
64
|
2
|
|
|
|
|
1704
|
$self->modules_push($m); |
|
65
|
2
|
|
|
|
|
7
|
return $m; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub printScope { |
|
70
|
7
|
|
|
7
|
0
|
2087
|
my ($self,$fh)=@_; |
|
71
|
7
|
|
|
|
|
250
|
say $fh '$scope '.$self->type.' '.$self->name.' $end'; |
|
72
|
7
|
|
|
|
|
304
|
map{$_->printScope($fh)} $self->signals_all; |
|
|
19
|
|
|
|
|
72
|
|
|
73
|
7
|
|
|
|
|
278
|
map{$_->printScope($fh)} $self->modules_all; |
|
|
2
|
|
|
|
|
13
|
|
|
74
|
7
|
|
|
|
|
35
|
say $fh '$upscope $end'; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1 |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=pod |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=encoding UTF-8 |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 NAME |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Verilog::VCD::Writer::Module - Module abstraction layer for Verilog::VCD::Writer |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 VERSION |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
version 0.002 |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 addSignal(name,bitmax,bitmin) |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This method takes 3 parameters and returns a newly created Verilog::VCD::Writer::Signal Object. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Parameters are |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
name: Module name. Required. |
|
101
|
|
|
|
|
|
|
bitmax: The upper index of the bitrange e.g. for byte[7:0] bitmax is 7 |
|
102
|
|
|
|
|
|
|
bitmin: The lower index of the bitrange e.g. for byte[7:0] bitmin is 0 |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
bitmax and bitmin are not required for a single bit signal. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 dupSignal (Signal,...) |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Adds a signal to the current module which is an exact duplicate of a signal elsewhere. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The first parameter is a Verilog::VCD::Writer::Signal object, the rest are the same as the addSignal method. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 addSubModule(name,type) |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Adds a submodule/function/task etc under the current module. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This method takes two parameter |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
name: Name of the module that will be added |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
type: a string which is either module,function or task |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
returns a newly created object of the type Verilog::VCD::Writer::Module |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=for Pod::Coverage printScope |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 AUTHOR |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Vijayvithal Jahagirdar<jvs@cpan.org> |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Vijayvithal. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
135
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |