OpenCores
URL https://opencores.org/ocsvn/socgen/socgen/trunk

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [geda/] [build_geda] - Blame information for rev 135

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 135 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
#/****************************************************************************/
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
 
32
 
33
############################################################################
34
# General PERL config
35
############################################################################
36
use Getopt::Long;
37
use English;
38
use File::Basename;
39
use Cwd;
40
use XML::LibXML;
41
use lib './tools';
42
use sys::lib;
43
use yp::lib;
44
 
45
 
46
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
47
 
48
 
49
############################################################################
50
### Process the options
51
############################################################################
52
 
53
Getopt::Long::config("require_order", "prefix=-");
54
GetOptions("h","help",
55
) || die "(use '$program_name -h' for help)";
56
 
57
 
58
##############################################################################
59
## Help option
60
##############################################################################
61
if (  $opt_h or $opt_help  )
62
  { print "\n build_geda vendor_name library_name [component_name]";
63
    print "\n";
64
    exit 1;
65
  }
66
 
67
 
68
##############################################################################
69
##
70
##############################################################################
71
 
72
 
73
 
74
my $parser = XML::LibXML->new();
75
 
76
$home = cwd();
77
 
78
 
79
#############################################################################
80
##
81
##
82
#############################################################################
83
 
84
  my $vendor         = $ARGV[0];
85
  my $library        = $ARGV[1];
86
  my $component      = $ARGV[2];
87
 
88
 
89
my @components = ();
90
 
91
if( $component)
92
{
93
push (@components,$component);
94
}
95
else
96
{
97
@components   = yp::lib::find_components($vendor,$library);
98
}
99
 
100
 
101
foreach  $component (@components)
102
 
103
{
104
 
105
#############################################################################
106
##
107
##
108
#############################################################################
109
 
110
my @versions =       yp::lib::find_component_versions($vendor,$library,$component);
111
 
112
my($comp_name)        = $component;
113
my($comp_library)     = $library;
114
my($comp_vendor)      = $vendor;
115
 
116
foreach  $comp_version   (@versions)
117
   {
118
 
119
 
120
   my $comp_variant;
121
   if($comp_version) {$comp_variant = "${comp_name}_${comp_version}"}
122
   else              {$comp_variant = "${comp_name}"}
123
 
124
 
125
 
126
 
127
   print "gEDA directories  for    $library - $component  . ${comp_version}.     $comp_name -  $comp_variant \n";
128
 
129
   #/*********************************************************************************************/
130
   #/                                                                                            */
131
   #/                                                                                            */
132
   #/                                                                                            */
133
   #/                                                                                            */
134
   #/                                                                                            */
135
   #/                                                                                            */
136
   #/*********************************************************************************************/
137
 
138
 
139
   my $path  = "${home}/doc/geda";
140
   mkdir $path,0755             unless( -e $path );
141
 
142
   my $path  = "${home}/doc/geda/sch";
143
   mkdir $path,0755             unless( -e $path );
144
 
145
   my $path  = "${home}/doc/geda/sym";
146
   mkdir $path,0755             unless( -e $path );
147
 
148
   my $outfile ="${home}/doc/geda/sch/${comp_variant}.sch";
149
   open SCH_FILE,">$outfile" or die "unable to open $outfile";
150
 
151
   my $outfile ="${home}/doc/geda/sym/${comp_variant}.sym";
152
   open SYM_FILE,">$outfile" or die "unable to open $outfile";
153
 
154
 
155
 
156
   my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($comp_vendor,$comp_library,$comp_name,$comp_version));
157
 
158
   my($vendor)   = $spirit_component_file->findnodes('//ipxact:component/ipxact:vendor/text()')->to_literal ;
159
   my($library)  = $spirit_component_file->findnodes('//ipxact:component/ipxact:library/text()')->to_literal ;
160
   my($name)     = $spirit_component_file->findnodes('//ipxact:component/ipxact:name/text()')->to_literal ;
161
   my($version)  = $spirit_component_file->findnodes('//ipxact:component/ipxact:version/text()')->to_literal ;
162
 
163
   #/**********************************************************************/
164
   #/*                                                                    */
165
   #/* Every hier cell is constructed from the ipxact file with seperate  */
166
   #/* versions for simulation and synthesys                              */
167
   #/*                                                                    */
168
   #/*                                                                    */
169
   #/**********************************************************************/
170
 
171
   my $in_count   = 0;
172
   my $out_count  = 0;
173
   my $in_length  = 0;
174
   my $out_length = 0;
175
 
176
   #   parse master bus interfaces
177
 
178
   foreach  my   $comp  ($spirit_component_file->findnodes('//ipxact:component/ipxact:busInterfaces/ipxact:busInterface/ipxact:master'))
179
         {
180
         my($pin_name)        = $comp ->findnodes('../ipxact:name/text()')->to_literal ;
181
         my($mmm_name)          = $comp->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@name')->to_literal ;
182
         my($mmm_version)       = $comp->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@version')->to_literal ;
183
 
184
         $pin_name   = $mmm_name."__".$pin_name;
185
         push(@out_bus,$pin_name);
186
         $out_count = $out_count+1;
187
         if( length($pin_name) > $out_length){  $out_length =  length($pin_name)            }
188
         }
189
 
190
 
191
 
192
   #   parse slave bus interfaces
193
 
194
   foreach  my   $comp  ($spirit_component_file->findnodes('//ipxact:component/ipxact:busInterfaces/ipxact:busInterface/ipxact:slave'))
195
         {
196
         my($pin_name)        = $comp ->findnodes('../ipxact:name/text()')->to_literal ;
197
         my($mmm_name)          = $comp->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@name')->to_literal ;
198
         my($mmm_version)       = $comp->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@version')->to_literal ;
199
         $pin_name   = $mmm_name."__".$pin_name;
200
 
201
         push(@in_bus,$pin_name);
202
         $in_count = $in_count+1;
203
         if( length($pin_name) > $in_length) { $in_length =  length($pin_name)};
204
         }
205
 
206
 
207
 
208
   #   parse adhoc ports
209
 
210
   foreach  my   $comp  ($spirit_component_file->findnodes('//ipxact:component/ipxact:model/ipxact:ports/ipxact:port/ipxact:name'))
211
         {
212
         my($port_name)       = $comp ->findnodes('./text()')->to_literal ;
213
         my($direction)       = $comp ->findnodes('../ipxact:wire/ipxact:direction/text()')->to_literal ;
214
         my($left)            = $comp ->findnodes('../ipxact:wire/ipxact:vectors/ipxact:vector/ipxact:left/text()')->to_literal ;
215
         my($right)           = $comp ->findnodes('../ipxact:wire/ipxact:vectors/ipxact:vector/ipxact:right/text()')->to_literal ;
216
         my($type)            = $comp ->findnodes('../ipxact:wire/ipxact:wireTypeDefs/ipxact:wireTypeDef/ipxact:typeName/text()')->to_literal ;
217
 
218
         unless (defined $type)  {$type ="wire";}
219
 
220
         if($left)  {$width = "[${left}:${right}]";}
221
         else       {$width  = " ";}
222
 
223
         my $pin_name = "${port_name}${width}";
224
 
225
         if("in" eq  $direction)
226
           {
227
           push(@in_sig,$pin_name);
228
           $in_count = $in_count+1;
229
           if( length($pin_name) > $in_length) { $in_length =  length($pin_name)};
230
           }
231
         if("out" eq  $direction)
232
           {
233
           push(@out_sig,$pin_name);
234
           $out_count = $out_count+1;
235
           if( length($pin_name) > $out_length){  $out_length =  length($pin_name)            }
236
           }
237
         if("inout" eq  $direction)
238
           {
239
           push(@inout_bus,$pin_name);
240
           $out_count = $out_count+1;
241
           if( length($pin_name) > $out_length){  $out_length =  length($pin_name)            }
242
           }
243
         }
244
 
245
   my $max_pins;
246
 
247
   if($in_count > $out_count) {$max_pins = $in_count ;} else  {$max_pins = $out_count ;}
248
 
249
   my $sch_color =  5;
250
   my $sch_size  = 10;
251
   my $sch_pin_y = 300;
252
 
253
   my $sch_in_edg  = ($in_length)*10*$sch_size +200;
254
   my $sch_in_pad  = ($in_length)*10*$sch_size +200;
255
   my $sch_out_edg = ($in_length +$out_length)*10*$sch_size +4500;
256
   my $sch_out_pad = ($in_length +$out_length)*10*$sch_size +3500;
257
 
258
   printf SCH_FILE ("v 20100214 1\n");
259
   printf SCH_FILE ("T 40 40 8 10 1 1 0 0 1 1\n%srefdes=U?\n");
260
 
261
   my $sym_color =  5;
262
   my $sym_size  = 10;
263
   my $sym_box_h   = ($max_pins * 200) +300;
264
   my $sym_box_w   = ($in_length +$out_length)*10*$sym_size +400;
265
   my $sym_out_title = ($in_length +$out_length)*10*$sym_size +600;
266
   my $sym_out_edg = ($in_length +$out_length)*10*$sym_size +700;
267
   my $sym_out_pad = ($in_length +$out_length)*10*$sym_size +1000;
268
   my $sym_title   = $sym_box_h +150;
269
   my $sym_ref_des = $sym_box_h +350;
270
 
271
 
272
   printf SYM_FILE ("v 20100214 1\n");
273
   printf SYM_FILE ("B 300 0  $sym_box_w $sym_box_h 3 60 0 0 -1 -1 0 -1 -1 -1 -1 -1\n");
274
   printf SYM_FILE ("T 400 $sym_title   5 10 1 1 0 0 1 1\ndevice=%s\n", $comp_variant);
275
   printf SYM_FILE ("T 400 -300   5 10 0 1 0 0 1 1\nsource=%s.sch\n", $comp_variant);
276
   printf SYM_FILE ("T 400 $sym_ref_des 8 10 1 1 0 0 1 1\n%srefdes=U?\n");
277
 
278
   my $sym_pin_y = 200;
279
   my $sym_pin_seq = 1;
280
 
281
   while( $name =pop(@in_sig))
282
      {
283
      printf SCH_FILE ("C $sch_in_pad $sch_pin_y 1 0 0 in_port.sym   \n{\nT $sch_in_edg $sch_pin_y $sch_color $sch_size 1 1 0 6 1 1\nrefdes=%s\n}\n",$name);
284
      $sch_pin_y = $sch_pin_y +400;
285
      printf SYM_FILE ("P 300 $sym_pin_y 0 $sym_pin_y 4 0 1 \n");
286
      printf SYM_FILE ("{\nT 400 $sym_pin_y $sym_color $sym_size 1 1 0 1 1 1\npinnumber=%s\n",$name);
287
      printf SYM_FILE ("T 400 $sym_pin_y $sym_color $sym_size 0 1 0 1 1 1\npinseq=%s\n}\n",$sym_pin_seq);
288
      $sym_pin_seq = $sym_pin_seq +1;
289
      $sym_pin_y = $sym_pin_y +200;
290
      }
291
 
292
 
293
   while( $name =pop(@in_bus))
294
      {
295
      printf SCH_FILE ("C $sch_in_pad $sch_pin_y 1 0 0 in_port_v.sym   \n{\nT $sch_in_edg $sch_pin_y $sch_color $sch_size 1 1 0 6 1 1\nrefdes=%s\n}\n",$name);
296
      $sch_pin_y = $sch_pin_y +400;
297
      printf SYM_FILE ("P 300 $sym_pin_y 0 $sym_pin_y 10 1 1 \n");
298
      printf SYM_FILE ("{\nT 400 $sym_pin_y $sym_color $sym_size 1 1 0 1 1 1\npinnumber=%s\n",$name);
299
      printf SYM_FILE ("T 400 $sym_pin_y $sym_color $sym_size 0 1 0 1 1 1\npinseq=%s\n}\n",$sym_pin_seq);
300
      $sym_pin_seq = $sym_pin_seq +1;
301
      $sym_pin_y = $sym_pin_y +200;
302
      }
303
 
304
      $sym_pin_y = 200;
305
 
306
      while( $name =pop(@inpads))
307
         {
308
         printf SCH_FILE ("C $sch_in_pad $sch_pin_y 1 0 0 in_port.sym  \n{\nT $sch_in_edg $sch_pin_y $sch_color $sch_size 1 1 0 6 1 1 \nrefdes=%s\n}\n",$name);
309
         $sch_pin_y = $sch_pin_y +400;
310
         printf SYM_FILE ("P 300 $sym_pin_y 0 $sym_pin_y 4 0 1  \n");
311
         printf SYM_FILE ("{\nT 400 $sym_pin_y $sym_color $sym_size 1 1 0 1 1 1 \npinnumber=%s\n",$name);
312
         printf SYM_FILE ("T 400 $sym_pin_y $sym_color $sym_size 0 1 0 1 1 1 \npinseq=%s\n}\n",$sym_pin_seq);
313
         $sym_pin_seq = $sym_pin_seq +1;
314
         $sym_pin_y = $sym_pin_y +200;
315
         }
316
 
317
      while( $name =pop(@inout_bus))
318
         {
319
         printf SCH_FILE ("C $sch_in_pad $sch_pin_y 1 0 0 io_port_v.sym   \n{\nT $sch_in_edg $sch_pin_y $sch_color $sch_size 1 1 0 6 1 1\nrefdes=%s\n}\n",$name);
320
         $sch_pin_y = $sch_pin_y +400;
321
         printf SYM_FILE ("P $sym_out_edg $sym_pin_y $sym_out_pad $sym_pin_y 10 1 1\n");
322
         printf SYM_FILE ("{\nT $sym_out_title $sym_pin_y $sym_color  $sym_size 1 1 0 7 1 1 \npinnumber=%s\n",$name);
323
         printf SYM_FILE ("T $sym_out_title $sym_pin_y $sym_color  $sym_size 0 1 0 7 1 1 \npinseq=%s\n}\n",$sym_pin_seq);
324
         $sym_pin_seq = $sym_pin_seq +1;
325
         $sym_pin_y = $sym_pin_y +200;
326
         }
327
 
328
 
329
      while( $name =pop(@inoutpads))
330
         {
331
         printf SCH_FILE ("C $sch_in_pad $sch_pin_y 1 0 0 io_port.sym  \n{\nT $sch_in_edg $sch_pin_y $sch_color $sch_size 1 1 0 6 1 1 \nrefdes=%s\n}\n",$name);
332
         $sch_pin_y = $sch_pin_y +400;
333
         printf SYM_FILE ("P $sym_out_edg $sym_pin_y $sym_out_pad $sym_pin_y 4 0 1\n");
334
         printf SYM_FILE ("{\nT $sym_out_title $sym_pin_y $sym_color  $sym_size 1 1 0 7 1 1\npinnumber=%s\n",$name);
335
         printf SYM_FILE ("T $sym_out_edg $sym_pin_y $sym_color  $sym_size 0 1 0 7 1 1\npinseq=%s\n}\n",$sym_pin_seq);
336
         $sym_pin_seq = $sym_pin_seq +1;
337
         $sym_pin_y = $sym_pin_y +200;
338
         }
339
 
340
      $sch_pin_y = 300;
341
      while( $name =pop(@out_sig))
342
         {
343
         printf SCH_FILE ("C $sch_out_pad $sch_pin_y  1 0  0 out_port.sym\n{\nT $sch_out_edg $sch_pin_y $sch_color  $sch_size 1 1 0 0 1 1 \nrefdes=%s\n}\n",$name);
344
         $sch_pin_y = $sch_pin_y +400;
345
         printf SYM_FILE ("P $sym_out_edg $sym_pin_y $sym_out_pad $sym_pin_y 4 0 1\n");
346
         printf SYM_FILE ("{\nT $sym_out_title $sym_pin_y $sym_color  $sym_size 1 1 0 7 1 1 \npinnumber=%s\n",$name);
347
         printf SYM_FILE ("T $sym_out_title $sym_pin_y $sym_color  $sym_size 0 1 0 7 1 1 \npinseq=%s\n}\n",$sym_pin_seq);
348
         $sym_pin_seq = $sym_pin_seq +1;
349
         $sym_pin_y = $sym_pin_y +200;
350
         }
351
 
352
 
353
      while( $name =pop(@out_bus))
354
         {
355
         printf SCH_FILE ("C $sch_out_pad $sch_pin_y  1 0  0 out_port_v.sym\n{\nT $sch_out_edg $sch_pin_y $sch_color  $sch_size 1 1 0 0 1 1 \nrefdes=%s\n}\n",$name);
356
         $sch_pin_y = $sch_pin_y +400;
357
         printf SYM_FILE ("P $sym_out_edg $sym_pin_y $sym_out_pad $sym_pin_y 10 1 1\n");
358
         printf SYM_FILE ("{\nT $sym_out_title $sym_pin_y $sym_color  $sym_size 1 1 0 7 1 1 \npinnumber=%s\n",$name);
359
         printf SYM_FILE ("T $sym_out_title $sym_pin_y $sym_color  $sym_size 0 1 0 7 1 1 \npinseq=%s\n}\n",$sym_pin_seq);
360
         $sym_pin_seq = $sym_pin_seq +1;
361
         $sym_pin_y = $sym_pin_y +200;
362
         }
363
 
364
      while( $name =pop(@outpads))
365
         {
366
         printf SCH_FILE ("C $sch_out_pad $sch_pin_y  1 0 0 out_port.sym\n{\nT $sch_out_edg $sch_pin_y $sch_color  $sch_size 1 1 0 0 1 1\nrefdes=%s\n}\n",$name);
367
         $sch_pin_y = $sch_pin_y +400;
368
         printf SYM_FILE ("P $sym_out_edg $sym_pin_y $sym_out_pad $sym_pin_y 4 0 1\n");
369
         printf SYM_FILE ("{\nT $sym_out_title $sym_pin_y $sym_color  $sym_size 1 1 0 7 1 1\npinnumber=%s\n",$name);
370
         printf SYM_FILE ("T $sym_out_edg $sym_pin_y $sym_color  $sym_size 0 1 0 7 1 1\npinseq=%s\n}\n",$sym_pin_seq);
371
         $sym_pin_seq = $sym_pin_seq +1;
372
         $sym_pin_y = $sym_pin_y +200;
373
         }
374
 
375
 
376
}
377
 
378
}
379
 
380
 
381
 
382
 
383
 
384
 
385
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.