7 my $class = ref($invocant) || $invocant;
12 # if no ptf section was passed in, then return undef
13 $self->{ptf
} or return;
15 bless ($self, $class);
22 return $self->{ptf
}->getAssignment ('class');
30 my @ports = $self->{ptf
}->getSections ('SLAVE');
31 foreach $port (@ports) {
32 push @port_names, $port->name;
39 my ($self, $port_name) = @_;
44 # use first port found
45 my @port_names = $self->getPorts ();
46 $port = $self->{ptf
}->getSection ('SLAVE', $port_names[0]);
48 $port = $self->{ptf
}->getSection ('SLAVE', $port_name);
50 # return undef if the PTF section doesn't exist
58 sub getWSAAssignment
{
59 my ($self, $assignment) = @_;
61 my $WSA = $self->{ptf
}->getSection ('WIZARD_SCRIPT_ARGUMENTS', '');
63 # return undef if the WSA section doesn't exist.
67 my $result = $WSA->getAssignment ($assignment);
74 my ($self, $name) = @_;
76 my $WSA = $self->{ptf
}->getSection ('WIZARD_SCRIPT_ARGUMENTS', '');
78 # return undef if the WSA section doesn't exist.
82 my $constants = $WSA->getSection ('CONSTANTS', '');
84 # return undef if the CONSTANTS section doesn't exist.
88 my $constant = $constants->getSection ('CONSTANT', $name);
90 # return undef if the CONSTANT $name section doesn't exist.
94 my $result = $constant->getAssignment ('value');
100 my ($self, $port_name) = @_;
102 my $port = $self->getPort ($port_name);
104 # return undef if the PTF section doesn't exist
108 my $SBI = $port->getSection('SYSTEM_BUILDER_INFO', '');
110 # return undef if the PTF section doesn't exist
114 my $result = $SBI->getAssignment('Is_Memory_Device');
119 sub isCustomInstruction
{
120 my ($self, $port_name) = @_;
122 my $port = $self->getPort ($port_name);
124 # return undef if the PTF section doesn't exist
128 my $SBI = $port->getSection('SYSTEM_BUILDER_INFO', '');
130 # return undef if the PTF section doesn't exist
134 my $result = $SBI->getAssignment('Is_Custom_Instruction');
140 my ($self, $port_name) = @_;
142 my $port = $self->getPort ($port_name);
144 # return undef if the PTF section doesn't exist
148 my $SBI = $port->getSection('SYSTEM_BUILDER_INFO', '');
150 # return undef if the PTF section doesn't exist
154 my $result = $SBI->getAssignment('Base_Address');
155 if ($result eq 'N/A') {
162 my ($self, $port_name) = @_;
164 my $port = $self->getPort ($port_name);
165 $port or return; #return undef if the ptf section doesn't exist
167 my $SBI = $port->getSection ('SYSTEM_BUILDER_INFO', '');
168 my $data_width = $SBI->getAssignment ('Data_Width');
169 my $addr_width = $SBI->getAssignment ('Address_Width');
171 if ($data_width == 8) {
172 $size = 1 << $addr_width;
173 } elsif ($data_width == 16) {
174 $size = 1 << ($addr_width + 1);
175 } elsif ($data_width == 32) {
176 $size = 1 << ($addr_width + 2);
177 } elsif ($data_width == 64) {
178 $size = 1 << ($addr_width + 3);
179 } elsif ($data_width == 128) {
180 $size = 1 << ($addr_width + 4);
185 $size_text = sprintf ("%#010x", $size);
190 my ($self, $port_name) = @_;
192 my $port = $self->getPort ($port_name);
194 # return undef if the PTF section doesn't exist
198 my $SBI = $port->getSection('SYSTEM_BUILDER_INFO', '');
200 # return undef if the PTF section doesn't exist
204 my $result = $SBI->getAssignment('Has_IRQ');
205 if ($result ne "1") {
206 # this device has no associated IRQ
210 my @irq_masters = $SBI->getSections('IRQ_MASTER');
211 return $irq_masters[0]->getAssignment('IRQ_Number');
215 my ($self, $type) = @_;
218 # get list of all slave for device
219 my @slaves = $self->{ptf
}->getSections ('SLAVE');
221 # get list of masters of relevant type for all slaves
222 foreach my $slave (@slaves) {
224 my $SBI = $slave->getSection ('SYSTEM_BUILDER_INFO', '');
226 # get list of all MASTERED_BY and IRQ_MASTER sections
227 my @mastered_bys = $SBI->getSections ('MASTERED_BY');
228 my @irq_masters = $SBI->getSections ('IRQ_MASTER');
230 # start adding masters to the list
231 foreach my $master (@mastered_bys, @irq_masters) {
232 my $section_name = $master->name;
233 $section_name =~ /(.*)\/(.*)/;
234 my $master_name = $1;
235 my $master_type = $2;
238 $masters{$master_name} = ();
240 if ($master_type eq $type) {
241 $masters{$master_name} = ();
249 return keys (%masters);
255 $sbi = $self->{ptf
}->getSection('SYSTEM_BUILDER_INFO', '');
258 my $enabled = $sbi->getAssignment ('Is_Enabled');
259 if ($enabled eq "1") {