1 |
131 |
jt_eaton |
eval 'exec `which perl` -S $0 ${1+"$@"}'
|
2 |
|
|
if 0;
|
3 |
135 |
jt_eaton |
#/****************************************************************************/
|
4 |
|
|
#/* */
|
5 |
|
|
#/* SOCGEN Design for Reuse toolset */
|
6 |
|
|
#/* */
|
7 |
|
|
#/* Version 1.0.0 */
|
8 |
|
|
#/* */
|
9 |
|
|
#/* Author(s): */
|
10 |
|
|
#/* - John Eaton, z3qmtr45@gmail.com */
|
11 |
|
|
#/* */
|
12 |
|
|
#/****************************************************************************/
|
13 |
|
|
#/* */
|
14 |
|
|
#/* */
|
15 |
|
|
#/* Copyright 2016 John T Eaton */
|
16 |
|
|
#/* */
|
17 |
|
|
#/* Licensed under the Apache License, Version 2.0 (the "License"); */
|
18 |
|
|
#/* you may not use this file except in compliance with the License. */
|
19 |
|
|
#/* You may obtain a copy of the License at */
|
20 |
|
|
#/* */
|
21 |
|
|
#/* http://www.apache.org/licenses/LICENSE-2.0 */
|
22 |
|
|
#/* */
|
23 |
|
|
#/* Unless required by applicable law or agreed to in writing, software */
|
24 |
|
|
#/* distributed under the License is distributed on an "AS IS" BASIS, */
|
25 |
|
|
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
26 |
|
|
#/* See the License for the specific language governing permissions and */
|
27 |
|
|
#/* limitations under the License. */
|
28 |
|
|
#/* */
|
29 |
|
|
#/* */
|
30 |
|
|
#/****************************************************************************/
|
31 |
131 |
jt_eaton |
|
32 |
|
|
|
33 |
|
|
############################################################################
|
34 |
|
|
# General PERL config
|
35 |
|
|
############################################################################
|
36 |
|
|
use Getopt::Long;
|
37 |
|
|
use English;
|
38 |
|
|
use File::Basename;
|
39 |
|
|
use Cwd;
|
40 |
|
|
use Scalar::Util qw(looks_like_number);
|
41 |
|
|
use XML::LibXML;
|
42 |
|
|
use lib './tools';
|
43 |
|
|
use sys::lib;
|
44 |
|
|
use yp::lib;
|
45 |
|
|
use BerkeleyDB;
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
############################################################################
|
52 |
|
|
### Process the options
|
53 |
|
|
############################################################################
|
54 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
55 |
|
|
GetOptions("h","help",
|
56 |
|
|
"vendor=s" => \$vendor,
|
57 |
|
|
"library=s" => \$library,
|
58 |
|
|
"version=s" => \$version,
|
59 |
|
|
"component=s" => \$component,
|
60 |
|
|
"debug","verbose"
|
61 |
|
|
) || die "(use '$program_name -h' for help)";
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
##############################################################################
|
65 |
|
|
## Help option
|
66 |
|
|
##############################################################################
|
67 |
|
|
if ( $opt_h or $opt_help )
|
68 |
|
|
{ print "\n gen_ports - -vendor vendor_name -library library_name -component component_name -version version_name \n";
|
69 |
|
|
exit 1;
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
#############################################################################
|
78 |
|
|
##
|
79 |
|
|
##
|
80 |
|
|
#############################################################################
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
$home = cwd();
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
my $variant;
|
87 |
|
|
|
88 |
|
|
if($version) {$variant = "${component}_${version}";}
|
89 |
|
|
else {$variant = "${component}";}
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
|
93 |
|
|
my $parser = XML::LibXML->new();
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
|
97 |
|
|
|
98 |
135 |
jt_eaton |
print "\n GEN_ports $vendor $library $component $version \n";
|
99 |
131 |
jt_eaton |
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
my $io_ports = yp::lib::get_io_ports() ;
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
my $path = "${home}/${io_ports}";
|
108 |
|
|
mkdir $path,0755 unless( -e $path );
|
109 |
|
|
$path = "${home}/${io_ports}/${vendor}__${library}";
|
110 |
|
|
mkdir $path,0755 unless( -e $path );
|
111 |
|
|
$path = "${home}/${io_ports}/${vendor}__${library}/${component}";
|
112 |
|
|
mkdir $path,0755 unless( -e $path );
|
113 |
133 |
jt_eaton |
$path ="${path}/${main_module_name}";
|
114 |
|
|
mkdir $path,0755 unless( -e $path );
|
115 |
131 |
jt_eaton |
|
116 |
133 |
jt_eaton |
|
117 |
|
|
$outfile ="${path}/busses.txt";
|
118 |
|
|
|
119 |
131 |
jt_eaton |
if(-e ${outfile} )
|
120 |
|
|
{
|
121 |
|
|
# print " $outfile Exists, exiting \n";
|
122 |
|
|
exit 0
|
123 |
|
|
}
|
124 |
|
|
|
125 |
|
|
# print " $outfile Does not Exist, creating \n";
|
126 |
|
|
open DEST_FILE,">$outfile" or die "unable to open $outfile";
|
127 |
|
|
|
128 |
|
|
|
129 |
134 |
jt_eaton |
$outfile = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version,"default");
|
130 |
131 |
jt_eaton |
$busses_db = new BerkeleyDB::Hash( -Filename => $outfile, -Flags => DB_CREATE ) or die "Cannot open ${outfile}: $!";
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
# print "XXXXXXXX $outfile GEN_PORTS CREATE \n";
|
135 |
|
|
process_design_files($spirit_component_file);
|
136 |
|
|
parse_component_file($spirit_component_file);
|
137 |
|
|
|
138 |
|
|
my $key;
|
139 |
|
|
my $value;
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
my @bus_list;
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
my $cursor = $busses_db ->db_cursor() ;
|
146 |
|
|
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
|
147 |
|
|
{
|
148 |
|
|
|
149 |
|
|
( ${key_type},${busref},${conn}) = split( /\./ , $key);
|
150 |
|
|
( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
|
151 |
|
|
if(($key_type eq "BusRef"))
|
152 |
|
|
{
|
153 |
|
|
push (@bus_list, "${busref}_${conn} ${phy_name} ${log_name} ${direction} ${type} ${vector} ${left}:${right} ");
|
154 |
|
|
}
|
155 |
|
|
else
|
156 |
|
|
{
|
157 |
|
|
|
158 |
|
|
}
|
159 |
|
|
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
my $status = $cursor->c_close() ;
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
$busses_db -> db_close();
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
@bus_list = sys::lib::trim_sort(@bus_list);
|
171 |
|
|
|
172 |
|
|
foreach $list (@bus_list)
|
173 |
|
|
{ print DEST_FILE "${list}\n";}
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
# print "XXXXXXXX $outfile GEN_PORTS CLOSED \n";
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
#/*********************************************************************************************/
|
180 |
|
|
#/ */
|
181 |
|
|
#/ */
|
182 |
|
|
#/ */
|
183 |
|
|
#/ */
|
184 |
|
|
#/ */
|
185 |
|
|
#/ */
|
186 |
|
|
#/*********************************************************************************************/
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
sub parse_component_file
|
192 |
|
|
{
|
193 |
|
|
my @params = @_;
|
194 |
|
|
my $spirit_component_file = pop(@params);
|
195 |
|
|
|
196 |
|
|
|
197 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:vendorExtensions/ipxact:componentRef"))
|
198 |
131 |
jt_eaton |
{
|
199 |
135 |
jt_eaton |
my($new_vendor) = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
|
200 |
|
|
my($new_library) = $new_comp->findnodes('./@ipxact:library')->to_literal ;
|
201 |
|
|
my($new_name) = $new_comp->findnodes('./@ipxact:name')->to_literal ;
|
202 |
|
|
my($new_version) = $new_comp->findnodes('./@ipxact:version')->to_literal ;
|
203 |
131 |
jt_eaton |
if(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version))
|
204 |
|
|
{
|
205 |
|
|
parse_component_file($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version)) );
|
206 |
|
|
}
|
207 |
|
|
}
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
#/**********************************************************************/
|
214 |
|
|
#/* */
|
215 |
|
|
#/* */
|
216 |
|
|
#/* */
|
217 |
|
|
#/**********************************************************************/
|
218 |
|
|
|
219 |
135 |
jt_eaton |
foreach my $bus_iface ($spirit_component_file->findnodes("//ipxact:component/ipxact:busInterfaces/ipxact:busInterface/ipxact:slave"))
|
220 |
131 |
jt_eaton |
{
|
221 |
135 |
jt_eaton |
my $busInterface_name = $bus_iface->findnodes('../ipxact:name/text()')->to_literal ;
|
222 |
|
|
my $memMap_name = $bus_iface->findnodes('./ipxact:memoryMapRef/@ipxact:memoryMapRef')->to_literal ;
|
223 |
131 |
jt_eaton |
|
224 |
|
|
|
225 |
135 |
jt_eaton |
foreach my $bus_iface ($spirit_component_file->findnodes("//ipxact:busInterface[ipxact:name/text() = '$busInterface_name']/ipxact:slave/ipxact:bridge"))
|
226 |
131 |
jt_eaton |
{
|
227 |
135 |
jt_eaton |
my($bridge_map) = $bus_iface->findnodes('./@ipxact:masterRef')->to_literal ;
|
228 |
131 |
jt_eaton |
|
229 |
135 |
jt_eaton |
|
230 |
|
|
foreach my $mem_map ($spirit_component_file->findnodes("//ipxact:component/ipxact:memoryMaps/ipxact:memoryMap[ipxact:name/text() = '$memMap_name']/ipxact:subspaceMap[ipxact:name/text() = '$bridge_map']/ipxact:baseAddress"))
|
231 |
131 |
jt_eaton |
{
|
232 |
135 |
jt_eaton |
# my $xxx = $mem_map->findnodes('../ipxact:subspaceMap/@ipxact:masterRef')->to_literal ;
|
233 |
131 |
jt_eaton |
my $add = $mem_map->findnodes('./text()')->to_literal ;
|
234 |
|
|
my $int_base_addr = hex($add);
|
235 |
|
|
|
236 |
|
|
my $repo_data;
|
237 |
|
|
$busses_db->db_get( "AbsDef.${busInterface_name}.bridge", $repo_data );
|
238 |
|
|
$busses_db->db_put( "AbsDef.${busInterface_name}.bridge","${bridge_map}..${int_base_addr}::${repo_data}" );
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
135 |
jt_eaton |
|
245 |
|
|
foreach my $addSpace_map ($spirit_component_file->findnodes("//ipxact:component/ipxact:addressSpaces/ipxact:addressSpace[ipxact:name/text() = '$bridge_map']/ipxact:range"))
|
246 |
131 |
jt_eaton |
{
|
247 |
|
|
my $range = $addSpace_map->findnodes('./text()')->to_literal ;
|
248 |
|
|
my $int_range = hex($range);
|
249 |
|
|
$busses_db->db_put( "BlkDef.${busInterface_name}.${bridge_map}","${int_base_addr}::${int_range}::8" );
|
250 |
|
|
# print "FFFFFFF RANGE BlkDef.${busInterface_name}.${bridge_map} ${int_base_addr}::${int_range}::8 \n";
|
251 |
|
|
}
|
252 |
|
|
|
253 |
|
|
}
|
254 |
|
|
|
255 |
|
|
}
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
|
259 |
135 |
jt_eaton |
foreach my $mem_map ($spirit_component_file->findnodes("//ipxact:component/ipxact:memoryMaps/ipxact:memoryMap[ipxact:name/text() = '$memMap_name']/ipxact:bank/ipxact:addressBlock"))
|
260 |
131 |
jt_eaton |
{
|
261 |
135 |
jt_eaton |
my($addB_name) = $mem_map->findnodes('./ipxact:name/text()')->to_literal ;
|
262 |
|
|
my($baseAdd) = $mem_map->findnodes('../ipxact:baseAddress/text()')->to_literal ;
|
263 |
|
|
my($range) = $mem_map->findnodes('./ipxact:range/text()')->to_literal ;
|
264 |
|
|
my($width) = $mem_map->findnodes('./ipxact:width/text()')->to_literal ;
|
265 |
131 |
jt_eaton |
my $int_baseAdd = hex($baseAdd);
|
266 |
|
|
my $int_range = hex($range);
|
267 |
|
|
$busses_db->db_put( "BlkDef.${memMap_name}.${addB_name}","${int_baseAdd}::${int_range}::${width}" );
|
268 |
|
|
}
|
269 |
|
|
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
135 |
jt_eaton |
foreach my $mem_map ($spirit_component_file->findnodes("//ipxact:component/ipxact:memoryMaps/ipxact:memoryMap[ipxact:name/text() = '$memMap_name']/ipxact:bank/ipxact:addressBlock/ipxact:register"))
|
275 |
131 |
jt_eaton |
{
|
276 |
135 |
jt_eaton |
my($reg_name) = $mem_map->findnodes('./ipxact:name/text()')->to_literal ;
|
277 |
|
|
my($bank_name) = $mem_map->findnodes('../../../ipxact:name/text()')->to_literal ;
|
278 |
|
|
my($reg_offset) = $mem_map->findnodes('./ipxact:addressOffset/text()')->to_literal ;
|
279 |
|
|
my($reg_size) = $mem_map->findnodes('./ipxact:size/text()')->to_literal ;
|
280 |
|
|
my($reg_access) = $mem_map->findnodes('./ipxact:access/text()')->to_literal ;
|
281 |
131 |
jt_eaton |
my $int_reg_offset = hex($reg_offset);
|
282 |
|
|
$busses_db->db_put( "RegDef.${bank_name}.${reg_name}","${int_reg_offset}::${reg_name}::${reg_size}::${reg_access}" );
|
283 |
|
|
# print "FFFFFFF REGISTER ${bank_name}.${reg_name} ${reg_offset}::${reg_size}::${reg_access} \n";
|
284 |
|
|
}
|
285 |
|
|
|
286 |
|
|
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
}
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
#/**********************************************************************/
|
328 |
|
|
#/* */
|
329 |
|
|
#/* Read each busInterface and save master/slave direction */
|
330 |
|
|
#/* */
|
331 |
|
|
#/**********************************************************************/
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
my @mas_slave;
|
335 |
|
|
|
336 |
|
|
push @mas_slave , "master";
|
337 |
|
|
push @mas_slave , "slave";
|
338 |
|
|
|
339 |
|
|
foreach $seek_type (@mas_slave)
|
340 |
|
|
{
|
341 |
|
|
|
342 |
135 |
jt_eaton |
foreach my $bus_iface ($spirit_component_file->findnodes("//ipxact:component/ipxact:busInterfaces/ipxact:busInterface/ipxact:${seek_type}"))
|
343 |
131 |
jt_eaton |
{
|
344 |
135 |
jt_eaton |
my($mmm_cname) = $bus_iface->findnodes('../ipxact:name/text()')->to_literal ;
|
345 |
|
|
my($mmm_vendor) = $bus_iface->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@vendor')->to_literal ;
|
346 |
|
|
my($mmm_library) = $bus_iface->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@library')->to_literal ;
|
347 |
|
|
my($mmm_name) = $bus_iface->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@name')->to_literal ;
|
348 |
|
|
my($mmm_version) = $bus_iface->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@version')->to_literal ;
|
349 |
131 |
jt_eaton |
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
if($mmm_cname)
|
353 |
|
|
{
|
354 |
|
|
$busses_db->db_put( "AbsDef.${mmm_cname}.${seek_type}","${mmm_vendor}:${mmm_library}:${mmm_name}:${mmm_version}" );
|
355 |
|
|
}
|
356 |
|
|
|
357 |
135 |
jt_eaton |
foreach my $port_face ($spirit_component_file->findnodes('//ipxact:component/ipxact:busInterfaces/ipxact:busInterface/ipxact:abstractionTypes/ipxact:abstractionType/ipxact:portMaps/ipxact:portMap/ipxact:logicalPort'))
|
358 |
131 |
jt_eaton |
{
|
359 |
135 |
jt_eaton |
my($rrr_log_name) = $port_face->findnodes('./ipxact:name/text()')->to_literal ;
|
360 |
|
|
my($rrr_int_name) = $port_face->findnodes('../../../../../ipxact:name/text()')->to_literal ;
|
361 |
|
|
my($rrr_phy_name) = $port_face->findnodes('../ipxact:physicalPort/ipxact:name/text()')->to_literal ;
|
362 |
|
|
my($rrr_type_name) = $port_face->findnodes('../ipxact:physicalPort/ipxact:wireTypeDefs/ipxact:wireTypeDef/ipxact:typeName/text()')->to_literal ;
|
363 |
|
|
my($rrr_left_value) = $port_face->findnodes('../ipxact:physicalPort/ipxact:wire/ipxact:vectors/ipxact:vector/ipxact:left/text()')->to_literal ;
|
364 |
|
|
my($rrr_right_value) = $port_face->findnodes('../ipxact:physicalPort/ipxact:wire/ipxact:vectors/ipxact:vector/ipxact:right/text()')->to_literal ;
|
365 |
131 |
jt_eaton |
|
366 |
|
|
unless ($rrr_type_name) {$rrr_type_name = "wire";}
|
367 |
|
|
unless ($rrr_phy_name) {$rrr_phy_name = ${rrr_log_name} ;}
|
368 |
|
|
|
369 |
|
|
if( $mmm_cname eq $rrr_int_name )
|
370 |
|
|
{
|
371 |
|
|
my $absDef_filename = yp::lib::get_absDef_db_filename($mmm_vendor,$mmm_library,$mmm_name,$mmm_version);
|
372 |
|
|
$absDef_db = new BerkeleyDB::Hash( -Filename => $absDef_filename, -Flags => DB_CREATE ) or die "Cannot open ${absDef_filename}: $!";
|
373 |
|
|
|
374 |
|
|
my $abs_data;
|
375 |
|
|
$absDef_db->db_get("${seek_type}__${rrr_log_name}", $abs_data );
|
376 |
|
|
|
377 |
|
|
( $berk_name, $berk_presence,$berk_width,$berk_direction ) = split ':', $abs_data;
|
378 |
|
|
my $rrr_direction = $berk_direction;
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
if($rrr_left_value ne "")
|
384 |
|
|
{
|
385 |
|
|
$berk_vector = "vector";
|
386 |
|
|
}
|
387 |
|
|
else
|
388 |
|
|
{
|
389 |
|
|
$berk_vector = "scaler";
|
390 |
|
|
$rrr_left_value = "none";
|
391 |
|
|
$rrr_right_value = "none";
|
392 |
|
|
}
|
393 |
|
|
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
uplift_busref(${mmm_cname},${rrr_log_name},${rrr_direction},${rrr_type_name},${berk_vector},${rrr_left_value},${rrr_right_value},${rrr_phy_name});
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
|
400 |
|
|
$absDef_db->db_close();
|
401 |
|
|
}
|
402 |
|
|
}
|
403 |
|
|
}
|
404 |
|
|
}
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
|
409 |
|
|
#/**********************************************************************/
|
410 |
|
|
#/* */
|
411 |
|
|
#/* Read all ports and store into array */
|
412 |
|
|
#/* */
|
413 |
|
|
#/**********************************************************************/
|
414 |
|
|
|
415 |
135 |
jt_eaton |
foreach my $i_name ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:ports/ipxact:port/ipxact:name"))
|
416 |
131 |
jt_eaton |
{
|
417 |
|
|
my($port_name) = $i_name ->findnodes('./text()')->to_literal ;
|
418 |
135 |
jt_eaton |
my($direction) = $i_name ->findnodes('../ipxact:wire/ipxact:direction/text()')->to_literal ;
|
419 |
|
|
my($left) = $i_name ->findnodes('../ipxact:wire/ipxact:vectors/ipxact:vector/ipxact:left/text()')->to_literal ;
|
420 |
|
|
my($right) = $i_name ->findnodes('../ipxact:wire/ipxact:vectors/ipxact:vector/ipxact:right/text()')->to_literal ;
|
421 |
|
|
my($type) = $i_name ->findnodes('../ipxact:wire/ipxact:wireTypeDefs/ipxact:wireTypeDef/ipxact:typeName/text()')->to_literal ;
|
422 |
131 |
jt_eaton |
|
423 |
135 |
jt_eaton |
unless (defined $type) {$type = "wire";}
|
424 |
|
|
|
425 |
131 |
jt_eaton |
if ($direction eq "in") { $direction = "input";}
|
426 |
|
|
elsif ($direction eq "out") { $direction = "output";}
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
my $vector;
|
430 |
|
|
$vector ="vector";
|
431 |
|
|
|
432 |
|
|
if($left ne "")
|
433 |
|
|
{
|
434 |
|
|
|
435 |
|
|
}
|
436 |
|
|
else
|
437 |
|
|
{
|
438 |
|
|
$vector = "scaler";
|
439 |
|
|
$left = "none";
|
440 |
|
|
$right = "none";
|
441 |
|
|
}
|
442 |
|
|
|
443 |
|
|
|
444 |
|
|
uplift_busref("adhoc", ${port_name} , ${direction}, ${type} , ${vector},${left},${right},${port_name} );
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
}
|
448 |
|
|
|
449 |
|
|
}
|
450 |
|
|
|
451 |
|
|
|
452 |
|
|
|
453 |
|
|
|
454 |
|
|
|
455 |
|
|
#/*********************************************************************************************/
|
456 |
|
|
#/ */
|
457 |
|
|
#/ */
|
458 |
|
|
#/ */
|
459 |
|
|
#/ */
|
460 |
|
|
#/ */
|
461 |
|
|
#/ */
|
462 |
|
|
#/*********************************************************************************************/
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
|
466 |
|
|
|
467 |
|
|
sub process_design_files
|
468 |
|
|
{
|
469 |
|
|
my @params = @_;
|
470 |
|
|
my $spirit_component_file = pop(@params);
|
471 |
|
|
|
472 |
|
|
#print "\n";
|
473 |
|
|
|
474 |
|
|
|
475 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:vendorExtensions/ipxact:componentRef"))
|
476 |
131 |
jt_eaton |
{
|
477 |
135 |
jt_eaton |
my($new_vendor) = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
|
478 |
|
|
my($new_library) = $new_comp->findnodes('./@ipxact:library')->to_literal ;
|
479 |
|
|
my($new_name) = $new_comp->findnodes('./@ipxact:name')->to_literal ;
|
480 |
|
|
my($new_version) = $new_comp->findnodes('./@ipxact:version')->to_literal ;
|
481 |
131 |
jt_eaton |
process_design_files($parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_name,$new_version )) );
|
482 |
|
|
}
|
483 |
|
|
|
484 |
135 |
jt_eaton |
|
485 |
|
|
|
486 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:hierarchyRef"))
|
487 |
131 |
jt_eaton |
{
|
488 |
135 |
jt_eaton |
my($new_vendor) = $new_comp->findnodes('./@ipxact:vendor')->to_literal ;
|
489 |
|
|
my($new_library) = $new_comp->findnodes('./@ipxact:library')->to_literal ;
|
490 |
|
|
my($new_name) = $new_comp->findnodes('./@ipxact:name')->to_literal ;
|
491 |
|
|
my($new_version) = $new_comp->findnodes('./@ipxact:version')->to_literal ;
|
492 |
131 |
jt_eaton |
if( yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version ) )
|
493 |
|
|
{
|
494 |
135 |
jt_eaton |
#print "FFFFFFF $new_vendor $new_library $new_name $new_version hierarchyRef \n";
|
495 |
131 |
jt_eaton |
process_design_file($parser->parse_file(yp::lib::find_ipxact_design($new_vendor,$new_library,$new_name,$new_version )) );
|
496 |
|
|
}
|
497 |
|
|
}
|
498 |
135 |
jt_eaton |
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:designInstantiationRef/text()"))
|
503 |
|
|
{
|
504 |
|
|
my($designInsref_value) = $new_comp ->to_literal ;
|
505 |
|
|
my($designInsref_name) = $new_comp ->findnodes('../../ipxact:name')->to_literal ;
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
foreach my $new_comp ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:instantiations/ipxact:designInstantiation"))
|
509 |
|
|
{
|
510 |
|
|
my($t_ref) = $new_comp->findnodes('./ipxact:name/text()')->to_literal ;
|
511 |
|
|
my($t_vendor) = $new_comp->findnodes('./ipxact:designRef/@vendor')->to_literal ;
|
512 |
|
|
my($t_library) = $new_comp->findnodes('./ipxact:designRef/@library')->to_literal ;
|
513 |
|
|
my($t_name) = $new_comp->findnodes('./ipxact:designRef/@name')->to_literal ;
|
514 |
|
|
my($t_version) = $new_comp->findnodes('./ipxact:designRef/@version')->to_literal ;
|
515 |
|
|
|
516 |
|
|
if($t_ref eq $designInsref_name )
|
517 |
|
|
{
|
518 |
|
|
if( yp::lib::find_ipxact_design($t_vendor,$t_library,$t_name,$t_version ) )
|
519 |
|
|
{
|
520 |
|
|
#print "FFFFFFF $t_vendor $t_library $t_name $t_version designgInstantiationRef \n";
|
521 |
|
|
process_design_file($parser->parse_file(yp::lib::find_ipxact_design($t_vendor,$t_library,$t_name,$t_version )) );
|
522 |
|
|
}
|
523 |
|
|
|
524 |
|
|
}
|
525 |
|
|
|
526 |
|
|
}
|
527 |
|
|
|
528 |
|
|
}
|
529 |
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
|
|
|
536 |
131 |
jt_eaton |
}
|
537 |
|
|
|
538 |
|
|
|
539 |
|
|
#/*********************************************************************************************/
|
540 |
|
|
#/ */
|
541 |
|
|
#/ */
|
542 |
|
|
#/ */
|
543 |
|
|
#/ */
|
544 |
|
|
#/ */
|
545 |
|
|
#/ */
|
546 |
|
|
#/*********************************************************************************************/
|
547 |
|
|
|
548 |
|
|
|
549 |
|
|
sub process_design_file
|
550 |
|
|
{
|
551 |
|
|
my @params = @_;
|
552 |
|
|
my $spirit_design_file = pop(@params);
|
553 |
|
|
|
554 |
135 |
jt_eaton |
foreach my $new_comp ($spirit_design_file->findnodes("//ipxact:design/ipxact:vendor"))
|
555 |
131 |
jt_eaton |
{
|
556 |
|
|
my($new_vendor) = $new_comp->findnodes('./text()')->to_literal ;
|
557 |
135 |
jt_eaton |
my($new_library) = $new_comp->findnodes('../ipxact:library/text()')->to_literal ;
|
558 |
|
|
my($new_name) = $new_comp->findnodes('../ipxact:name/text()')->to_literal ;
|
559 |
|
|
my($new_version) = $new_comp->findnodes('../ipxact:version/text()')->to_literal ;
|
560 |
131 |
jt_eaton |
# print "XXXXXX- $new_vendor $new_library $new_name $new_version DESIGN \n";
|
561 |
|
|
}
|
562 |
|
|
|
563 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes("//ipxact:design/ipxact:componentInstances/ipxact:componentInstance/ipxact:instanceName"))
|
564 |
131 |
jt_eaton |
{
|
565 |
|
|
my($instance_name) = $i_name ->findnodes('./text()')->to_literal ;
|
566 |
135 |
jt_eaton |
my($vendor_name) = $i_name ->findnodes('../ipxact:componentRef/@vendor')->to_literal ;
|
567 |
|
|
my($library_name) = $i_name ->findnodes('../ipxact:componentRef/@library')->to_literal ;
|
568 |
|
|
my($component_name) = $i_name ->findnodes('../ipxact:componentRef/@name')->to_literal ;
|
569 |
|
|
my($version_name) = $i_name ->findnodes('../ipxact:componentRef/@version')->to_literal ;
|
570 |
131 |
jt_eaton |
my $module_name = yp::lib::get_module_name($vendor_name,$library_name,$component_name,$version_name) ;
|
571 |
|
|
my $inst_path = "${home}/${io_ports}/${vendor_name}__${library_name}/${component_name}";
|
572 |
|
|
|
573 |
|
|
my $file = "$inst_path/${module_name}";
|
574 |
|
|
if(-e $file) { # print "XXXXXXXX $file Exists \n";
|
575 |
|
|
}
|
576 |
|
|
else
|
577 |
|
|
{
|
578 |
|
|
# print "XXXXXXXX $file Doesn't Exist \n";
|
579 |
|
|
$cmd = "./tools/verilog/gen_ports -vendor $vendor_name -library $library_name -component $component_name -version $version_name ";
|
580 |
|
|
if (system($cmd)) {}
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
}
|
584 |
|
|
|
585 |
|
|
}
|
586 |
|
|
|
587 |
|
|
|
588 |
135 |
jt_eaton |
|
589 |
131 |
jt_eaton |
#/**********************************************************************/
|
590 |
|
|
#/* */
|
591 |
135 |
jt_eaton |
#/* Hierarchical connections 1685_2014 style */
|
592 |
131 |
jt_eaton |
#/* */
|
593 |
|
|
#/**********************************************************************/
|
594 |
|
|
|
595 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes('//ipxact:interconnections/ipxact:interconnection/ipxact:hierInterface/@busRef'))
|
596 |
131 |
jt_eaton |
{
|
597 |
|
|
|
598 |
|
|
my($hierConn_name) = $i_name ->to_literal ;
|
599 |
135 |
jt_eaton |
my($hierConn_comref_name) = $i_name ->findnodes('../../ipxact:activeInterface/@componentRef')->to_literal ;
|
600 |
|
|
my($hierConn_busref_name) = $i_name ->findnodes('../../ipxact:activeInterface/@busRef')->to_literal ;
|
601 |
131 |
jt_eaton |
|
602 |
135 |
jt_eaton |
process_hier ( $hierConn_comref_name,$hierConn_name,$hierConn_busref_name , $spirit_design_file);
|
603 |
|
|
}
|
604 |
131 |
jt_eaton |
|
605 |
|
|
|
606 |
|
|
|
607 |
|
|
|
608 |
|
|
|
609 |
|
|
|
610 |
|
|
|
611 |
|
|
#/*******************************************************************************/
|
612 |
|
|
#/* */
|
613 |
|
|
#/* Read each interconnection */
|
614 |
|
|
#/* */
|
615 |
|
|
#/*******************************************************************************/
|
616 |
|
|
|
617 |
|
|
|
618 |
|
|
|
619 |
|
|
|
620 |
|
|
|
621 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes('//ipxact:interconnections/ipxact:interconnection/ipxact:activeInterface'))
|
622 |
131 |
jt_eaton |
{
|
623 |
135 |
jt_eaton |
my($lp_componentref_name) = $i_name ->findnodes('./@componentRef')->to_literal ;
|
624 |
|
|
my($lp_busref_name) = $i_name ->findnodes('./@busRef')->to_literal ;
|
625 |
|
|
my($lp_interconnect_name) = $i_name ->findnodes('../ipxact:name/text()')->to_literal ;
|
626 |
131 |
jt_eaton |
|
627 |
|
|
my $repo_data;
|
628 |
|
|
$busses_db->db_get( "AbsDef.${lp_interconnect_name}.interconnect" , $repo_data );
|
629 |
|
|
$busses_db->db_put( "AbsDef.${lp_interconnect_name}.interconnect","${lp_componentref_name}..${lp_busref_name}::${repo_data}" );
|
630 |
|
|
$busses_db->db_put( "Instance.${lp_componentref_name}.${lp_busref_name}","${lp_interconnect_name}" );
|
631 |
|
|
}
|
632 |
|
|
|
633 |
|
|
|
634 |
|
|
|
635 |
|
|
|
636 |
|
|
|
637 |
|
|
|
638 |
|
|
|
639 |
|
|
|
640 |
|
|
#/**************************************************************************/
|
641 |
|
|
#/* */
|
642 |
|
|
#/* Read each interconnection and enter sub signals into wire_decs */
|
643 |
|
|
#/* */
|
644 |
|
|
#/**************************************************************************/
|
645 |
|
|
|
646 |
|
|
|
647 |
|
|
|
648 |
|
|
|
649 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes('//ipxact:interconnections/ipxact:interconnection/ipxact:activeInterface/@componentRef'))
|
650 |
131 |
jt_eaton |
{
|
651 |
|
|
my($hierConn_comref_name) = $i_name ->to_literal;
|
652 |
135 |
jt_eaton |
my($hierConn_busref_name) = $i_name ->findnodes('../@busRef')->to_literal ;
|
653 |
|
|
my($hierConn_name) = $i_name ->findnodes('../../ipxact:name/text()')->to_literal ;
|
654 |
131 |
jt_eaton |
|
655 |
|
|
|
656 |
|
|
#/*******************************************************************************/
|
657 |
|
|
#/* */
|
658 |
|
|
#/* Read each interconnection and enter modified signals into wire_decs */
|
659 |
|
|
#/* */
|
660 |
|
|
#/*******************************************************************************/
|
661 |
|
|
|
662 |
|
|
|
663 |
|
|
|
664 |
|
|
|
665 |
|
|
|
666 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes('//ipxact:interconnections/ipxact:interconnection/ipxact:activeInterface/ipxact:portMaps/ipxact:portMap/ipxact:logicalPort/ipxact:name'))
|
667 |
131 |
jt_eaton |
{
|
668 |
|
|
my($lp_name) = $i_name ->to_literal;
|
669 |
135 |
jt_eaton |
my($lp_pname) = $i_name ->findnodes('../../ipxact:physicalPort/ipxact:name/text()')->to_literal ;
|
670 |
|
|
my($lp_left) = $i_name ->findnodes('../../ipxact:physicalPort/ipxact:wire/ipxact:vector/ipxact:left/text()')->to_literal ;
|
671 |
|
|
my($lp_right) = $i_name ->findnodes('../../ipxact:physicalPort/ipxact:wire/ipxact:vector/ipxact:right/text()')->to_literal ;
|
672 |
|
|
my($lp_componentref_name) = $i_name ->findnodes('../../../../@componentRef')->to_literal ;
|
673 |
|
|
my($lp_busref_name) = $i_name ->findnodes('../../../../@busRef')->to_literal ;
|
674 |
|
|
my($lp_interconnect_name) = $i_name ->findnodes('../../../../../ipxact:name/text()')->to_literal ;
|
675 |
131 |
jt_eaton |
$lp_vector = "vector";
|
676 |
|
|
|
677 |
|
|
|
678 |
|
|
if ( $lp_pname eq '' ) { $lp_pname ="${lp_interconnect_name}_${lp_name}";}
|
679 |
|
|
if ( $lp_left eq '' )
|
680 |
|
|
{
|
681 |
|
|
$lp_left ="none";
|
682 |
|
|
$lp_vector = "scaler";
|
683 |
|
|
}
|
684 |
|
|
if ( $lp_right eq '' )
|
685 |
|
|
{
|
686 |
|
|
$lp_right ="none";
|
687 |
|
|
$lp_vector = "scaler";
|
688 |
|
|
}
|
689 |
|
|
|
690 |
|
|
|
691 |
|
|
|
692 |
|
|
if( ($hierConn_name eq $lp_interconnect_name) && ( $hierConn_comref_name eq $lp_componentref_name ) )
|
693 |
|
|
{
|
694 |
|
|
# print "TTTTTTTTTTTT ${lp_pname}_${lp_name} => ${lp_interconnect_name}_${lp_name} ${lp_pname} $lp_left $lp_right $lp_busref_name \n";
|
695 |
|
|
|
696 |
|
|
if(${lp_vector} eq "vector")
|
697 |
|
|
{
|
698 |
|
|
unless( looks_like_number($lp_left) ) { $lp_left=0;}
|
699 |
|
|
}
|
700 |
|
|
|
701 |
|
|
uplift_busref(${hierConn_name},${lp_name},"node","wire",${lp_vector},${lp_left},${lp_right},${lp_pname});
|
702 |
|
|
}
|
703 |
|
|
}
|
704 |
|
|
|
705 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes("//ipxact:design/ipxact:componentInstances/ipxact:componentInstance/ipxact:instanceName[text() = '$hierConn_comref_name']"))
|
706 |
131 |
jt_eaton |
{
|
707 |
|
|
#/**********************************************************************/
|
708 |
|
|
#/* */
|
709 |
|
|
#/* Lookup VLNV for each instantiated component */
|
710 |
|
|
#/* */
|
711 |
|
|
#/**********************************************************************/
|
712 |
|
|
|
713 |
135 |
jt_eaton |
my($vendor_name) = $i_name ->findnodes('../ipxact:componentRef/@vendor')->to_literal ;
|
714 |
|
|
my($library_name) = $i_name ->findnodes('../ipxact:componentRef/@library')->to_literal ;
|
715 |
|
|
my($component_name) = $i_name ->findnodes('../ipxact:componentRef/@name')->to_literal ;
|
716 |
|
|
my($version_name) = $i_name ->findnodes('../ipxact:componentRef/@version')->to_literal ;
|
717 |
131 |
jt_eaton |
|
718 |
|
|
|
719 |
|
|
|
720 |
|
|
|
721 |
|
|
|
722 |
|
|
# print "XCCXX INTERCONN inst ${hierConn_comref_name} name ${hierConn_name} busref $hierConn_busref_name child ${vendor_name}_${library_name}_${component_name}_${version_name}\n";
|
723 |
134 |
jt_eaton |
my $child_file = yp::lib::get_io_busses_db_filename($vendor_name,$library_name,$component_name,$version_name,"default");
|
724 |
131 |
jt_eaton |
$child_ports_db = new BerkeleyDB::Hash( -Filename => $child_file, -Flags => DB_CREATE ) or die "Cannot open ${child_file}: $!";
|
725 |
|
|
# print "XXXXXXXX GEN_PORTS OPENNED $child_file \n";
|
726 |
|
|
|
727 |
|
|
my $child_cursor = $child_ports_db->db_cursor() ;
|
728 |
|
|
while ($child_cursor->c_get($key, $value, DB_NEXT) == 0)
|
729 |
|
|
{
|
730 |
|
|
( ${log_name},${direction},${type},${vector},${left},${right}) = split ':', $value;
|
731 |
|
|
|
732 |
|
|
if(($key eq "BusRef.${hierConn_busref_name}.${log_name}"))
|
733 |
|
|
{
|
734 |
|
|
# print "INTERCONN ${hierConn_name}_${log_name} $direction , $vector, $left , $right \n";
|
735 |
|
|
uplift_busref(${hierConn_name},${log_name},"node","wire",${vector},${left},${right},"${hierConn_name}_${log_name}");
|
736 |
133 |
jt_eaton |
|
737 |
|
|
$busses_db->db_put( "IXstance.${hierConn_comref_name}.${hierConn_busref_name}.${log_name}","${value}" );
|
738 |
|
|
|
739 |
|
|
|
740 |
|
|
|
741 |
131 |
jt_eaton |
}
|
742 |
|
|
elsif(($key eq "AbsDef.${hierConn_busref_name}.master"))
|
743 |
|
|
{
|
744 |
|
|
$busses_db->db_put( "AbsDef.${hierConn_name}.node","$value" );
|
745 |
|
|
}
|
746 |
|
|
elsif(($key eq "AbsDef.${hierConn_busref_name}.slave"))
|
747 |
|
|
{
|
748 |
|
|
$busses_db->db_put( "AbsDef.${hierConn_name}.node","$value" );
|
749 |
|
|
}
|
750 |
|
|
|
751 |
|
|
|
752 |
|
|
}
|
753 |
|
|
my $status = $child_cursor->c_close() ;
|
754 |
|
|
$child_ports_db -> db_close();
|
755 |
|
|
}
|
756 |
|
|
|
757 |
|
|
|
758 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes("//ipxact:design/ipxact:componentInstances/ipxact:componentInstance/ipxact:instanceName"))
|
759 |
131 |
jt_eaton |
{
|
760 |
|
|
#/**********************************************************************/
|
761 |
|
|
#/* */
|
762 |
|
|
#/* Lookup VLNV for each instantiated component */
|
763 |
|
|
#/* */
|
764 |
|
|
#/**********************************************************************/
|
765 |
|
|
|
766 |
|
|
my($instance_name) = $i_name ->findnodes('./text()')->to_literal ;
|
767 |
135 |
jt_eaton |
my($vendor_name) = $i_name ->findnodes('../ipxact:componentRef/@vendor')->to_literal ;
|
768 |
|
|
my($library_name) = $i_name ->findnodes('../ipxact:componentRef/@library')->to_literal ;
|
769 |
|
|
my($component_name) = $i_name ->findnodes('../ipxact:componentRef/@name')->to_literal ;
|
770 |
|
|
my($version_name) = $i_name ->findnodes('../ipxact:componentRef/@version')->to_literal ;
|
771 |
131 |
jt_eaton |
|
772 |
|
|
if( "$instance_name" eq "$hierConn_comref_name" )
|
773 |
|
|
{
|
774 |
|
|
# print "INTERCONNECTION $instance_name $vendor_name $library_name $component_name $version_name $hierConn_busref_name $hierConn_name \n";
|
775 |
|
|
}
|
776 |
|
|
}
|
777 |
|
|
}
|
778 |
|
|
|
779 |
|
|
#/**********************************************************************/
|
780 |
|
|
#/* */
|
781 |
|
|
#/* Read all wires and store into array */
|
782 |
|
|
#/* */
|
783 |
|
|
#/**********************************************************************/
|
784 |
|
|
|
785 |
|
|
|
786 |
|
|
|
787 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes("//ipxact:design/ipxact:vendorExtensions/socgen:nodes/socgen:node/ipxact:name"))
|
788 |
131 |
jt_eaton |
{
|
789 |
|
|
my($node_name) = $i_name ->findnodes('./text()')->to_literal ;
|
790 |
|
|
my($node_busdef) = $i_name ->findnodes('../socgen:busDef/text()')->to_literal ;
|
791 |
135 |
jt_eaton |
my($node_left) = $i_name ->findnodes('../ipxact:wire/ipxact:vector/ipxact:left/text()')->to_literal ;
|
792 |
|
|
my($node_right) = $i_name ->findnodes('../ipxact:wire/ipxact:vector/ipxact:right/text()')->to_literal ;
|
793 |
|
|
my($node_type) = $i_name ->findnodes('../ipxact:typeName/text()')->to_literal ;
|
794 |
131 |
jt_eaton |
|
795 |
|
|
unless($node_busdef){ $node_busdef = $node_name; }
|
796 |
|
|
|
797 |
|
|
if( $node_left ne "" )
|
798 |
|
|
{
|
799 |
|
|
if( $node_right eq "" ){ $node_right = $node_left; }
|
800 |
|
|
$node_vector = "vector";
|
801 |
|
|
}
|
802 |
|
|
else
|
803 |
|
|
{
|
804 |
|
|
$node_vector = "scaler";
|
805 |
|
|
$node_left = "none";
|
806 |
|
|
$node_right = "none";
|
807 |
|
|
}
|
808 |
|
|
|
809 |
|
|
# print "WIRE_NODE ${node_name} node , $node_type , $node_vector, $node_left , $node_right $node_busdef \n";
|
810 |
|
|
uplift_busref("adhoc", "${node_name}" , "node" , ${node_type} , ${node_vector}, ${node_left} , ${node_right},${node_name});
|
811 |
|
|
}
|
812 |
|
|
|
813 |
|
|
|
814 |
|
|
#/**********************************************************************/
|
815 |
|
|
#/* */
|
816 |
|
|
#/* Read all adHocConnections and load instance connect info into array*/
|
817 |
|
|
#/* */
|
818 |
|
|
#/**********************************************************************/
|
819 |
|
|
|
820 |
133 |
jt_eaton |
|
821 |
|
|
|
822 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes('//ipxact:adHocConnections/ipxact:adHocConnection/ipxact:internalPortReference/@componentRef'))
|
823 |
131 |
jt_eaton |
{
|
824 |
|
|
my($componentRef_name) = $i_name ->to_literal;
|
825 |
135 |
jt_eaton |
my($adhocConnection_name) = $i_name ->findnodes('../../ipxact:name/text()')->to_literal ;
|
826 |
|
|
my($tied_value) = $i_name ->findnodes('../../@tiedValue')->to_literal ;
|
827 |
|
|
my($int_portRef_name) = $i_name ->findnodes('../@portRef')->to_literal ;
|
828 |
|
|
my($ext_portRef_name) = $i_name ->findnodes('../../ipxact:externalPortReference/@portRef')->to_literal ;
|
829 |
|
|
my($left) = $i_name ->findnodes('../../ipxact:externalPortReference/@left')->to_literal ;
|
830 |
|
|
my($right) = $i_name ->findnodes('../../ipxact:externalPortReference/@right')->to_literal ;
|
831 |
131 |
jt_eaton |
if( $left ne "" )
|
832 |
|
|
{
|
833 |
|
|
if( $right eq "" ){ $right = $left; }
|
834 |
|
|
$vector = "vector";
|
835 |
|
|
}
|
836 |
|
|
else
|
837 |
|
|
{
|
838 |
|
|
$vector = "scaler";
|
839 |
|
|
$left = "none";
|
840 |
|
|
$right = "none";
|
841 |
|
|
}
|
842 |
135 |
jt_eaton |
if ( ${adhocConnection_name} eq "" ) { $adhocConnection_name = "***";}
|
843 |
|
|
if ( ${ext_portRef_name} eq "" ) { $ext_portRef_name = "***";}
|
844 |
|
|
#print "NNNNNNNNN $componentRef_name $adhocConnection_name ||${tied_value}|| $int_portRef_name $ext_portRef_name $left $right \n";
|
845 |
|
|
if($tied_value )
|
846 |
|
|
{
|
847 |
|
|
$busses_db->db_put( "AdHoc_${componentRef_name}__${int_portRef_name}","${tied_value}:${ext_portRef_name}:${type}:${vector}:${left}:${right}" );
|
848 |
|
|
#print"NNNNNNNNN AdHoc_${componentRef_name}__${int_portRef_name} ${tied_value}:${ext_portRef_name}:${type}:${vector}:${left}:${right}\n" ;
|
849 |
|
|
}
|
850 |
|
|
else
|
851 |
|
|
{
|
852 |
|
|
$busses_db->db_put( "AdHoc_${componentRef_name}__${int_portRef_name}","${adhocConnection_name}:${ext_portRef_name}:${type}:${vector}:${left}:${right}" );
|
853 |
|
|
#print "NNNNNNNNN AdHoc_${componentRef_name}__${int_portRef_name} ${adhocConnection_name}:${ext_portRef_name}:${type}:${vector}:${left}:${right} \n" ;
|
854 |
|
|
$_ = ${adhocConnection_name};
|
855 |
|
|
if(/(\w+)/)
|
856 |
|
|
{
|
857 |
|
|
$adhocConnection_name = $1;
|
858 |
|
|
unless( looks_like_number($adhocConnection_name) )
|
859 |
|
|
{
|
860 |
|
|
# print "ADHOC_NODE ${adhocConnection_name} , node , wire , $vector, $left , $right \n";
|
861 |
|
|
uplift_busref("adhoc", ${adhocConnection_name} , "node" , "wire" , ${vector}, ${left} , ${right}, ${adhocConnection_name});
|
862 |
|
|
}
|
863 |
|
|
}
|
864 |
|
|
}
|
865 |
|
|
}
|
866 |
131 |
jt_eaton |
|
867 |
133 |
jt_eaton |
|
868 |
|
|
|
869 |
|
|
|
870 |
|
|
|
871 |
135 |
jt_eaton |
#/**********************************************************************/
|
872 |
|
|
#/* 1685_2014 version */
|
873 |
|
|
#/* Read all adHocConnections and load instance connect info into array*/
|
874 |
|
|
#/* */
|
875 |
|
|
#/**********************************************************************/
|
876 |
133 |
jt_eaton |
|
877 |
135 |
jt_eaton |
|
878 |
|
|
|
879 |
|
|
foreach my $i_name ($spirit_design_file->findnodes('//ipxact:adHocConnections/ipxact:adHocConnection/ipxact:portReferences/ipxact:internalPortReference/@componentRef'))
|
880 |
|
|
{
|
881 |
|
|
my($componentRef_name) = $i_name ->to_literal;
|
882 |
|
|
my($adhocConnection_name) = $i_name ->findnodes('../../../ipxact:name/text()')->to_literal ;
|
883 |
|
|
my($tied_value) = $i_name ->findnodes('../../../@tiedValue')->to_literal ;
|
884 |
|
|
my($int_portRef_name) = $i_name ->findnodes('../@portRef')->to_literal ;
|
885 |
|
|
my($ext_portRef_name) = $i_name ->findnodes('../../ipxact:externalPortReference/@portRef')->to_literal ;
|
886 |
|
|
my($left) = $i_name ->findnodes('../../ipxact:externalPortReference/@left')->to_literal ;
|
887 |
|
|
my($right) = $i_name ->findnodes('../../ipxact:externalPortReference/@right')->to_literal ;
|
888 |
|
|
if( $left ne "" )
|
889 |
|
|
{
|
890 |
|
|
if( $right eq "" ){ $right = $left; }
|
891 |
|
|
$vector = "vector";
|
892 |
|
|
}
|
893 |
|
|
else
|
894 |
|
|
{
|
895 |
|
|
$vector = "scaler";
|
896 |
|
|
$left = "none";
|
897 |
|
|
$right = "none";
|
898 |
|
|
}
|
899 |
|
|
if ( ${adhocConnection_name} eq "" ) { $adhocConnection_name = "***";}
|
900 |
|
|
if ( ${ext_portRef_name} eq "" ) { $ext_portRef_name = "***";}
|
901 |
|
|
#print "NNNNNNNNN-N $componentRef_name $adhocConnection_name ||${tied_value}|| $int_portRef_name $ext_portRef_name $left $right \n";
|
902 |
133 |
jt_eaton |
if($tied_value )
|
903 |
|
|
{
|
904 |
|
|
$busses_db->db_put( "AdHoc_${componentRef_name}__${int_portRef_name}","${tied_value}:${ext_portRef_name}:${type}:${vector}:${left}:${right}" );
|
905 |
135 |
jt_eaton |
#print "NNNNNNNNN-N AdHoc_${componentRef_name}__${int_portRef_name} ${tied_value}:${ext_portRef_name}:${type}:${vector}:${left}:${right}\n" ;
|
906 |
133 |
jt_eaton |
}
|
907 |
|
|
else
|
908 |
|
|
{
|
909 |
|
|
$busses_db->db_put( "AdHoc_${componentRef_name}__${int_portRef_name}","${adhocConnection_name}:${ext_portRef_name}:${type}:${vector}:${left}:${right}" );
|
910 |
135 |
jt_eaton |
#print "NNNNNNNNN-N AdHoc_${componentRef_name}__${int_portRef_name} ${adhocConnection_name}:${ext_portRef_name}:${type}:${vector}:${left}:${right} \n" ;
|
911 |
131 |
jt_eaton |
$_ = ${adhocConnection_name};
|
912 |
|
|
if(/(\w+)/)
|
913 |
|
|
{
|
914 |
|
|
$adhocConnection_name = $1;
|
915 |
|
|
unless( looks_like_number($adhocConnection_name) )
|
916 |
|
|
{
|
917 |
|
|
# print "ADHOC_NODE ${adhocConnection_name} , node , wire , $vector, $left , $right \n";
|
918 |
|
|
uplift_busref("adhoc", ${adhocConnection_name} , "node" , "wire" , ${vector}, ${left} , ${right}, ${adhocConnection_name});
|
919 |
|
|
}
|
920 |
|
|
}
|
921 |
133 |
jt_eaton |
}
|
922 |
135 |
jt_eaton |
}
|
923 |
133 |
jt_eaton |
|
924 |
|
|
|
925 |
135 |
jt_eaton |
|
926 |
|
|
|
927 |
|
|
|
928 |
|
|
|
929 |
|
|
|
930 |
|
|
|
931 |
131 |
jt_eaton |
}
|
932 |
|
|
|
933 |
|
|
|
934 |
|
|
|
935 |
|
|
|
936 |
|
|
|
937 |
|
|
|
938 |
|
|
#/*********************************************************************************************/
|
939 |
|
|
#/ */
|
940 |
|
|
#/ */
|
941 |
|
|
#/ */
|
942 |
|
|
#/ */
|
943 |
|
|
#/ */
|
944 |
|
|
#/ */
|
945 |
|
|
#/*********************************************************************************************/
|
946 |
|
|
|
947 |
|
|
|
948 |
|
|
|
949 |
|
|
|
950 |
|
|
sub uplift_busref
|
951 |
|
|
{
|
952 |
|
|
my @params = @_;
|
953 |
|
|
my $phy_name = pop(@params);
|
954 |
|
|
my $right = pop(@params);
|
955 |
|
|
my $left = pop(@params);
|
956 |
|
|
my $vector = pop(@params);
|
957 |
|
|
my $type = pop(@params);
|
958 |
|
|
my $direction = pop(@params);
|
959 |
|
|
my $log_name = pop(@params);
|
960 |
|
|
my $busref_name = pop(@params);
|
961 |
|
|
|
962 |
|
|
# print "BUS_UPLIFT $busref_name $log_name $direction $type $vector $left $right $phy_name \n";
|
963 |
|
|
$busses_db->db_put( "","${log_name}:${direction}:${type}:${vector}:${left}:${right}:${phy_name}" );
|
964 |
|
|
|
965 |
|
|
my $uplift_data;
|
966 |
|
|
my $uplift_log_name ;
|
967 |
|
|
my $uplift_phy_name ;
|
968 |
|
|
my $uplift_direction ;
|
969 |
|
|
my $uplift_type;
|
970 |
|
|
my $uplift_vector;
|
971 |
|
|
my $uplift_left;
|
972 |
|
|
my $uplift_right;
|
973 |
|
|
|
974 |
|
|
|
975 |
|
|
$busses_db->db_get("BusRef.${busref_name}.$log_name", $uplift_data );
|
976 |
|
|
(${uplift_log_name},${uplift_direction},${uplift_type},${uplift_vector},${uplift_left},${uplift_right},${uplift_phy_name} ) = split ':', $uplift_data;
|
977 |
|
|
|
978 |
|
|
$busses_db->db_get("", $uplift_data );
|
979 |
|
|
(${log_name},${direction},${type},${vector},${left},${right},${phy_name} ) = split ':', $uplift_data;
|
980 |
|
|
$busses_db->db_del("");
|
981 |
|
|
|
982 |
|
|
|
983 |
|
|
if(${uplift_phy_name} ne "")
|
984 |
|
|
{
|
985 |
|
|
if(${uplift_phy_name} ne "${busref_name}_${uplift_log_name}" )
|
986 |
|
|
{
|
987 |
|
|
${phy_name}= ${uplift_phy_name};
|
988 |
|
|
# print "SET |${uplift_phy_name}|${busref_name}_${uplift_log_name}| \n";
|
989 |
|
|
}
|
990 |
|
|
|
991 |
|
|
}
|
992 |
|
|
|
993 |
|
|
|
994 |
|
|
|
995 |
|
|
if(${uplift_log_name})
|
996 |
|
|
{
|
997 |
|
|
# print "REPLACING ${busref_name} ${uplift_log_name} ${uplift_direction} ${uplift_type} ${uplift_vector} ${uplift_left} ${uplift_right} ${uplift_phy_name} \n";
|
998 |
|
|
if(${uplift_direction} ne "node" ) { $direction =${uplift_direction};}
|
999 |
|
|
|
1000 |
|
|
if(${type} eq "wire" ) { $type =${uplift_type};}
|
1001 |
|
|
|
1002 |
|
|
if(${uplift_vector} eq "vector")
|
1003 |
|
|
{
|
1004 |
|
|
if( $vector eq "vector" )
|
1005 |
|
|
{
|
1006 |
|
|
if( looks_like_number($uplift_left))
|
1007 |
|
|
{
|
1008 |
|
|
if( looks_like_number($left) )
|
1009 |
|
|
{
|
1010 |
|
|
if($uplift_left > $left ) {$left = $uplift_left;}
|
1011 |
|
|
}
|
1012 |
|
|
|
1013 |
|
|
}
|
1014 |
|
|
else
|
1015 |
|
|
{
|
1016 |
|
|
if( looks_like_number($left) ) {$left = ${uplift_left}; }
|
1017 |
|
|
unless(${direction} ne "node") {$left = ${uplift_left}; }
|
1018 |
|
|
}
|
1019 |
|
|
if( looks_like_number($uplift_right) && looks_like_number($right) ) { if($uplift_right < $right ) {$right = $uplift_right;}}
|
1020 |
|
|
}
|
1021 |
|
|
else
|
1022 |
|
|
{
|
1023 |
|
|
$vector = "vector";
|
1024 |
|
|
$left = ${uplift_left};
|
1025 |
|
|
$right = ${uplift_right};
|
1026 |
|
|
}
|
1027 |
|
|
}
|
1028 |
|
|
}
|
1029 |
|
|
# print "WITH ${busref_name} $log_name $direction $type $vector $left $right $phy_name \n";
|
1030 |
|
|
|
1031 |
|
|
$busses_db->db_put( "BusRef.${busref_name}.$log_name","${log_name}:${direction}:${type}:${vector}:${left}:${right}:${phy_name}" );
|
1032 |
|
|
}
|
1033 |
|
|
|
1034 |
|
|
|
1035 |
|
|
|
1036 |
|
|
|
1037 |
|
|
|
1038 |
135 |
jt_eaton |
#/*********************************************************************************************/
|
1039 |
|
|
#/ */
|
1040 |
|
|
#/ Process hierarchial connection */
|
1041 |
|
|
#/ */
|
1042 |
|
|
#/ */
|
1043 |
|
|
#/ */
|
1044 |
|
|
#/ */
|
1045 |
|
|
#/*********************************************************************************************/
|
1046 |
131 |
jt_eaton |
|
1047 |
|
|
|
1048 |
|
|
|
1049 |
|
|
|
1050 |
135 |
jt_eaton |
sub process_hier
|
1051 |
|
|
{
|
1052 |
|
|
my @params = @_;
|
1053 |
|
|
my $spirit_design_file = pop(@params);
|
1054 |
|
|
my $hierConn_busref_name = pop(@params);
|
1055 |
|
|
my $hierConn_name = pop(@params);
|
1056 |
|
|
my $hierConn_comref_name = pop(@params);
|
1057 |
131 |
jt_eaton |
|
1058 |
|
|
|
1059 |
|
|
|
1060 |
135 |
jt_eaton |
foreach my $i_name ($spirit_design_file->findnodes("//ipxact:design/ipxact:componentInstances/ipxact:componentInstance/ipxact:instanceName[text() = '$hierConn_comref_name']"))
|
1061 |
|
|
{
|
1062 |
|
|
#/**********************************************************************/
|
1063 |
|
|
#/* */
|
1064 |
|
|
#/* Lookup VLNV for each instantiated component */
|
1065 |
|
|
#/* */
|
1066 |
|
|
#/**********************************************************************/
|
1067 |
|
|
|
1068 |
|
|
my($vendor_name) = $i_name ->findnodes('../ipxact:componentRef/@vendor')->to_literal ;
|
1069 |
|
|
my($library_name) = $i_name ->findnodes('../ipxact:componentRef/@library')->to_literal ;
|
1070 |
|
|
my($component_name) = $i_name ->findnodes('../ipxact:componentRef/@name')->to_literal ;
|
1071 |
|
|
my($version_name) = $i_name ->findnodes('../ipxact:componentRef/@version')->to_literal ;
|
1072 |
|
|
|
1073 |
|
|
my $child_file = yp::lib::get_io_busses_db_filename($vendor_name,$library_name,$component_name,$version_name,"default");
|
1074 |
|
|
$child_ports_db = new BerkeleyDB::Hash( -Filename => $child_file, -Flags => DB_CREATE ) or die "Cannot open ${child_file}: $!";
|
1075 |
|
|
my $child_cursor = $child_ports_db->db_cursor() ;
|
1076 |
|
|
while ($child_cursor->c_get($key, $value, DB_NEXT) == 0)
|
1077 |
|
|
{
|
1078 |
|
|
( ${log_name},${direction},${type},${vector},${left},${right}) = split ':', $value;
|
1079 |
|
|
if(($key eq "BusRef.${hierConn_busref_name}.${log_name}"))
|
1080 |
|
|
{
|
1081 |
|
|
if(${vector} eq "vector")
|
1082 |
|
|
{
|
1083 |
|
|
unless( looks_like_number($left) ) { $left=0;}
|
1084 |
|
|
}
|
1085 |
|
|
uplift_busref(${hierConn_name},${log_name},${direction},"wire",${vector},${left},${right},"${hierConn_name}_${log_name}");
|
1086 |
|
|
$busses_db->db_put( "IXstance.${hierConn_comref_name}.${hierConn_busref_name}.${log_name}","${value}" );
|
1087 |
|
|
}
|
1088 |
|
|
elsif (($key eq "AbsDef.${hierConn_busref_name}.master"))
|
1089 |
|
|
{
|
1090 |
|
|
( ${xx_vendor},${xx_library},${xx_name},${xx_version}) = split ':', $value;
|
1091 |
|
|
$busses_db->db_put( "AbsDef.${hierConn_name}.master","${xx_vendor}:${xx_library}:${xx_name}:${xx_version}" );
|
1092 |
|
|
$busses_db->db_put( "AbsDef.${hierConn_name}.interconnect","${hierConn_comref_name}..${hierConn_busref_name}::" );
|
1093 |
|
|
$busses_db->db_put( "Instance.${hierConn_comref_name}.${hierConn_busref_name}","${hierConn_name}" );
|
1094 |
|
|
}
|
1095 |
|
|
elsif (($key eq "AbsDef.${hierConn_busref_name}.slave"))
|
1096 |
|
|
{
|
1097 |
|
|
( ${xx_vendor},${xx_library},${xx_name},${xx_version}) = split ':', $value;
|
1098 |
|
|
$busses_db->db_put( "AbsDef.${hierConn_name}.slave","${xx_vendor}:${xx_library}:${xx_name}:${xx_version}" );
|
1099 |
|
|
$busses_db->db_put( "AbsDef.${hierConn_name}.interconnect","${hierConn_comref_name}..${hierConn_busref_name}::" );
|
1100 |
|
|
$busses_db->db_put( "Instance.${hierConn_comref_name}.${hierConn_busref_name}","${hierConn_name}" );
|
1101 |
|
|
}
|
1102 |
|
|
}
|
1103 |
|
|
my $status = $child_cursor->c_close() ;
|
1104 |
|
|
$child_ports_db -> db_close();
|
1105 |
|
|
}
|
1106 |
|
|
|
1107 |
|
|
|
1108 |
|
|
|
1109 |
|
|
}
|
1110 |
|
|
|
1111 |
|
|
|
1112 |
131 |
jt_eaton |
1
|