1 |
131 |
jt_eaton |
eval 'exec `which perl` -S $0 ${1+"$@"}'
|
2 |
|
|
if 0;
|
3 |
|
|
|
4 |
135 |
jt_eaton |
#/****************************************************************************/
|
5 |
|
|
#/* */
|
6 |
|
|
#/* SOCGEN Design for Reuse toolset */
|
7 |
|
|
#/* */
|
8 |
|
|
#/* Version 1.0.0 */
|
9 |
|
|
#/* */
|
10 |
|
|
#/* Author(s): */
|
11 |
|
|
#/* - John Eaton, z3qmtr45@gmail.com */
|
12 |
|
|
#/* */
|
13 |
|
|
#/****************************************************************************/
|
14 |
|
|
#/* */
|
15 |
|
|
#/* */
|
16 |
|
|
#/* Copyright 2016 John T Eaton */
|
17 |
|
|
#/* */
|
18 |
|
|
#/* Licensed under the Apache License, Version 2.0 (the "License"); */
|
19 |
|
|
#/* you may not use this file except in compliance with the License. */
|
20 |
|
|
#/* You may obtain a copy of the License at */
|
21 |
|
|
#/* */
|
22 |
|
|
#/* http://www.apache.org/licenses/LICENSE-2.0 */
|
23 |
|
|
#/* */
|
24 |
|
|
#/* Unless required by applicable law or agreed to in writing, software */
|
25 |
|
|
#/* distributed under the License is distributed on an "AS IS" BASIS, */
|
26 |
|
|
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
|
27 |
|
|
#/* See the License for the specific language governing permissions and */
|
28 |
|
|
#/* limitations under the License. */
|
29 |
|
|
#/* */
|
30 |
|
|
#/* */
|
31 |
|
|
#/****************************************************************************/
|
32 |
131 |
jt_eaton |
|
33 |
|
|
use Getopt::Long;
|
34 |
|
|
use English;
|
35 |
|
|
use File::Basename;
|
36 |
|
|
use Cwd;
|
37 |
|
|
use XML::LibXML;
|
38 |
|
|
use lib './tools';
|
39 |
|
|
use sys::lib;
|
40 |
|
|
use yp::lib;
|
41 |
|
|
use BerkeleyDB;
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
45 |
|
|
|
46 |
|
|
my $parser = XML::LibXML->new();
|
47 |
|
|
my $home = cwd();
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
#/*********************************************************************************************/
|
51 |
|
|
#/ */
|
52 |
|
|
#/ */
|
53 |
|
|
#/ */
|
54 |
|
|
#/ */
|
55 |
|
|
#/*********************************************************************************************/
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
my @abstractionDefinitions = yp::lib::find_abstractionDefinitions();
|
59 |
|
|
|
60 |
|
|
my $version;
|
61 |
|
|
my $component;
|
62 |
|
|
my $library;
|
63 |
|
|
my $vendor;
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
foreach my $abstractionDefinition (@abstractionDefinitions)
|
67 |
|
|
{
|
68 |
|
|
( $vendor,$library, $component ,$version) = split ':', $abstractionDefinition;
|
69 |
|
|
|
70 |
|
|
print "${vendor}:${library}:${component}:${version}\n";
|
71 |
|
|
print "\t--------------------------------------------------------------------------------------------------------\n";
|
72 |
|
|
|
73 |
|
|
$filename ="tools/busdefs/Berkeley/${vendor}_${library}_${component}_${version}.dbm";
|
74 |
|
|
|
75 |
|
|
$absDef_db = new BerkeleyDB::Hash( -Filename => $filename, -Flags => DB_CREATE ) or die "Cannot open file: $!";
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
my $spirit_file = yp::lib::find_ipxact_abstractionDefinition($vendor,$library,$component,$version);
|
81 |
|
|
|
82 |
|
|
print "\tFilename: ${spirit_file}\n";
|
83 |
|
|
unless ($spirit_file) {print "Error absDef file does not exist";}
|
84 |
|
|
|
85 |
|
|
my $spirit_absDef_file = $parser->parse_file($spirit_file);
|
86 |
135 |
jt_eaton |
foreach my $absDef ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:vendor"))
|
87 |
131 |
jt_eaton |
{
|
88 |
|
|
my($bd_vendor) = $absDef->findnodes('./text()')->to_literal ;
|
89 |
135 |
jt_eaton |
my($bd_library) = $absDef->findnodes('../ipxact:library/text()')->to_literal ;
|
90 |
|
|
my($bd_name) = $absDef->findnodes('../ipxact:name/text()')->to_literal ;
|
91 |
|
|
my($bd_version) = $absDef->findnodes('../ipxact:version/text()')->to_literal ;
|
92 |
131 |
jt_eaton |
print "\tVLNV-ad ${bd_vendor}_${bd_library}_${bd_name}_${bd_version}\n";
|
93 |
|
|
|
94 |
|
|
my %systemGroupNames = ();
|
95 |
|
|
|
96 |
|
|
|
97 |
135 |
jt_eaton |
foreach my $bus_type ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:busType"))
|
98 |
131 |
jt_eaton |
{
|
99 |
135 |
jt_eaton |
my($bt_vendor) = $bus_type->findnodes('./@ipxact:vendor')->to_literal ;
|
100 |
|
|
my($bt_library) = $bus_type->findnodes('./@ipxact:library')->to_literal ;
|
101 |
|
|
my($bt_name) = $bus_type->findnodes('./@ipxact:name')->to_literal ;
|
102 |
|
|
my($bt_version) = $bus_type->findnodes('./@ipxact:version')->to_literal ;
|
103 |
131 |
jt_eaton |
print "\tVLNV-bt ${bt_vendor}_${bt_library}_${bt_name}_${bt_version}\n";
|
104 |
|
|
|
105 |
|
|
my $spirit_file = yp::lib::find_ipxact_busDefinition($bt_vendor,$bt_library,$bt_name,$bt_version);
|
106 |
|
|
|
107 |
|
|
unless ($spirit_file) {print "ERROR: No bus definition\n";}
|
108 |
|
|
else
|
109 |
|
|
{
|
110 |
|
|
my $spirit_busDef_file = $parser->parse_file($spirit_file);
|
111 |
135 |
jt_eaton |
foreach my $i_name ($spirit_busDef_file->findnodes("//ipxact:busDefinition/ipxact:systemGroupNames/ipxact:systemGroupName"))
|
112 |
131 |
jt_eaton |
{
|
113 |
|
|
my($sysgroup_name) = $i_name ->findnodes('./text()')->to_literal;
|
114 |
|
|
print "\t SystemGroup Name $sysgroup_name \n";
|
115 |
|
|
$systemGroupNames{$sysgroup_name} = 1;
|
116 |
|
|
}
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
|
120 |
135 |
jt_eaton |
foreach my $absDef ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName"))
|
121 |
131 |
jt_eaton |
{
|
122 |
|
|
my($logical_name) = $absDef->findnodes('./text()')->to_literal ;
|
123 |
135 |
jt_eaton |
my($is_clock) = $absDef->findnodes('../ipxact:wire/ipxact:qualifier/ipxact:isClock/text()')->to_literal ;
|
124 |
|
|
my($is_reset) = $absDef->findnodes('../ipxact:wire/ipxact:qualifier/ipxact:isReset/text()')->to_literal ;
|
125 |
|
|
my($is_address) = $absDef->findnodes('../ipxact:wire/ipxact:qualifier/ipxact:isAddress/text()')->to_literal ;
|
126 |
|
|
my($is_data) = $absDef->findnodes('../ipxact:wire/ipxact:qualifier/ipxact:isData/text()')->to_literal ;
|
127 |
|
|
my($requires_driver) = $absDef->findnodes('../ipxact:wire/ipxact:requiresDriver/text()')->to_literal ;
|
128 |
|
|
my($driver_type) = $absDef->findnodes('../ipxact:wire/ipxact:requiresDriver/@ipxact:driverType')->to_literal ;
|
129 |
|
|
my($default_value) = $absDef->findnodes('../ipxact:wire/ipxact:defaultValue/text()')->to_literal ;
|
130 |
131 |
jt_eaton |
|
131 |
|
|
print "\nPort: ${logical_name} ";
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
my $Key = "port__${logical_name}" ;
|
135 |
|
|
my @info = ("$logical_name","$is_clock","$is_reset","$is_address","$is_data","$requires_driver","$driver_type","$default_value" );
|
136 |
|
|
$absDef_db->db_put( $Key, join(':', @info) );
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
if($is_clock)
|
143 |
|
|
{
|
144 |
|
|
if($is_reset) { print " BOTH CLOCK and RESET ";}
|
145 |
|
|
else { print " CLOCK ";}
|
146 |
|
|
}
|
147 |
|
|
elsif($is_reset) { print " RESET ";}
|
148 |
|
|
else { print " ";}
|
149 |
|
|
|
150 |
|
|
if($is_address) { print " ADDRESS ";}
|
151 |
|
|
if($is_data) { print " DATA ";}
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
if($requires_driver) {print " Requires Driver $driver_type ";}
|
155 |
|
|
else {print " ";}
|
156 |
|
|
|
157 |
|
|
if($default_value) {print " Default Value $default_value \n";}
|
158 |
|
|
else {print " \n";}
|
159 |
|
|
|
160 |
|
|
my $master_presence;
|
161 |
|
|
my $master_width;
|
162 |
|
|
my $master_direction;
|
163 |
|
|
|
164 |
135 |
jt_eaton |
foreach my $onMaster ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName[text() = '$logical_name']/../ipxact:wire/ipxact:onMaster/ipxact:presence"))
|
165 |
131 |
jt_eaton |
{
|
166 |
|
|
$master_presence = $onMaster->findnodes('./text()')->to_literal ;
|
167 |
135 |
jt_eaton |
$master_width = $onMaster->findnodes('../ipxact:width/text()')->to_literal ;
|
168 |
|
|
$master_direction = $onMaster->findnodes('../ipxact:direction/text()')->to_literal ;
|
169 |
131 |
jt_eaton |
print " onMaster presence $master_presence \n";
|
170 |
|
|
#unless($master_width) {$master_width = 1;}
|
171 |
|
|
if($master_width) {print " onMaster width $master_width \n";}
|
172 |
|
|
if($master_direction) {print " onMaster direction $master_direction \n";}
|
173 |
|
|
print "\n";
|
174 |
|
|
|
175 |
|
|
my $Key = "master__${logical_name}" ;
|
176 |
|
|
my @info = ("$logical_name","$master_presence","$master_width","$master_direction" );
|
177 |
|
|
$absDef_db->db_put( $Key, join(':', @info) );
|
178 |
|
|
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
my $slave_presence;
|
182 |
|
|
my $slave_width;
|
183 |
|
|
my $slave_direction;
|
184 |
|
|
|
185 |
135 |
jt_eaton |
foreach my $onSlave ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName[text() = '$logical_name']/../ipxact:wire/ipxact:onSlave/ipxact:presence"))
|
186 |
131 |
jt_eaton |
{
|
187 |
|
|
$slave_presence = $onSlave->findnodes('./text()')->to_literal ;
|
188 |
135 |
jt_eaton |
$slave_width = $onSlave->findnodes('../ipxact:width/text()')->to_literal ;
|
189 |
|
|
$slave_direction = $onSlave->findnodes('../ipxact:direction/text()')->to_literal ;
|
190 |
131 |
jt_eaton |
print " onSlave presence $slave_presence \n";
|
191 |
|
|
#unless($slave_width) {$slave_width = 1;}
|
192 |
|
|
if($slave_width) {print " onSlave width $slave_width \n";}
|
193 |
|
|
if($slave_direction) {print " onSlave direction $slave_direction \n";}
|
194 |
|
|
print "\n";
|
195 |
|
|
|
196 |
|
|
my $Key = "slave__${logical_name}" ;
|
197 |
|
|
my @info = ("$logical_name","$slave_presence","$slave_width","$slave_direction" );
|
198 |
|
|
$absDef_db->db_put( $Key, join(':', @info) );
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
}
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
my %systemGroupPresence= ();
|
205 |
|
|
my %systemGroupWidth= ();
|
206 |
|
|
my %systemGroupDirection= ();
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
135 |
jt_eaton |
foreach my $onSystem ($spirit_absDef_file->findnodes("//ipxact:abstractionDefinition/ipxact:ports/ipxact:port/ipxact:logicalName[text() = '$logical_name']/../ipxact:wire/ipxact:onSystem/ipxact:group"))
|
211 |
131 |
jt_eaton |
{
|
212 |
|
|
my($system_group) = $onSystem->findnodes('./text()')->to_literal ;
|
213 |
135 |
jt_eaton |
my($presence) = $onSystem->findnodes('../ipxact:presence/text()')->to_literal ;
|
214 |
|
|
my($width) = $onSystem->findnodes('../ipxact:width/text()')->to_literal ;
|
215 |
|
|
my($direction) = $onSystem->findnodes('../ipxact:direction/text()')->to_literal ;
|
216 |
131 |
jt_eaton |
print " onSystem Group $system_group \n";
|
217 |
|
|
print " onSystem presence $presence \n";
|
218 |
|
|
#unless($width) {$width = 1;}
|
219 |
|
|
if($width){print " onSystem width $width \n";}
|
220 |
|
|
if($direction){print " onSystem direction $direction \n";}
|
221 |
|
|
print "\n";
|
222 |
|
|
|
223 |
|
|
my $Key = "syste,__${logical_name}" ;
|
224 |
|
|
my @info = ("$logical_name","$system_group","$presence","$width","$direction" );
|
225 |
|
|
$absDef_db->db_put( $Key, join(':', @info) );
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
$systemGroupPresence{$system_group} =$presence ;
|
229 |
|
|
$systemGroupWidth{$system_group} =$width ;
|
230 |
|
|
$systemGroupDirection{$system_group} =$direction ;
|
231 |
|
|
unless( $systemGroupNames{$system_group}) {print "Group $system_group not defined in busDefinition \n"; }
|
232 |
|
|
}
|
233 |
|
|
# insert DRC checks here
|
234 |
|
|
|
235 |
|
|
}
|
236 |
|
|
}
|
237 |
|
|
|
238 |
|
|
$absDef_db->db_close();
|
239 |
|
|
print "\n";
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
|
|
|