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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [padring/] [create_padring.safe] - 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
#/*                                                                    */
6
#/*             -------                                                */
7
#/*            /   SOC  \                                              */
8
#/*           /    GEN   \                                             */
9
#/*          /    TOOL    \                                            */
10
#/*          ==============                                            */
11
#/*          |            |                                            */
12
#/*          |____________|                                            */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*  Author(s):                                                        */
17
#/*      - John Eaton, jt_eaton@opencores.org                          */
18
#/*                                                                    */
19
#/**********************************************************************/
20
#/*                                                                    */
21
#/*    Copyright (C) <2010-2016>                */
22
#/*                                                                    */
23
#/*  This source file may be used and distributed without              */
24
#/*  restriction provided that this copyright statement is not         */
25
#/*  removed from the file and that any derivative work contains       */
26
#/*  the original copyright notice and the associated disclaimer.      */
27
#/*                                                                    */
28
#/*  This source file is free software; you can redistribute it        */
29
#/*  and/or modify it under the terms of the GNU Lesser General        */
30
#/*  Public License as published by the Free Software Foundation;      */
31
#/*  either version 2.1 of the License, or (at your option) any        */
32
#/*  later version.                                                    */
33
#/*                                                                    */
34
#/*  This source is distributed in the hope that it will be            */
35
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
36
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
37
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
38
#/*  details.                                                          */
39
#/*                                                                    */
40
#/*  You should have received a copy of the GNU Lesser General         */
41
#/*  Public License along with this source; if not, download it        */
42
#/*  from http://www.opencores.org/lgpl.shtml                          */
43
#/*                                                                    */
44
#/**********************************************************************/
45
 
46
 
47
 
48
 
49
############################################################################
50
# General PERL config
51
############################################################################
52
use Getopt::Long;
53
use English;
54
use File::Basename;
55
use Cwd;
56
use XML::LibXML;
57
use lib './tools';
58
use sys::lib;
59
use yp::lib;
60
 
61
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
62
 
63
############################################################################
64
### Process the options
65
############################################################################
66
Getopt::Long::config("require_order", "prefix=-");
67
GetOptions("h","help",
68
           "vendor=s" => \$vendor,
69
           "library=s" => \$library,
70
           "component=s" => \$component,
71
           "version=s" => \$version,
72
           "rtl=s" => \$rtl,
73
           "xml=s" => \$xml
74
) || die "(use '$program_name -h' for help)";
75
 
76
 
77
 
78
##############################################################################
79
## Help option
80
##############################################################################
81
if ( $opt_h  or $opt_help)
82
  { print "\n create_padring -vendor vendor_name  -library library_name  -component component_name path_to_pads_csv_from_cfgfile   ";
83
    print "\nEX: create_padring -vendor foo  -library bar  -component chip  ./pads/padring.csv   ";
84
    exit 1;
85
  }
86
 
87
 
88
##############################################################################
89
##
90
##############################################################################
91
 
92
$home = cwd();
93
 
94
 
95
my    $pads_csv     = $ARGV[0];
96
 
97
chomp($pads_csv);
98
 
99
 
100
 
101
 
102
unless(defined $rtl)       {$rtl = "rtl";}
103
unless(defined $xml)       {$xml = "xml";}
104
 
105
unless(defined $pads_csv)  {print "pads_csv file missing \n";exit}
106
 
107
unless(defined $vendor)    { print "vendor missing \n";exit}
108
unless(defined $library)   { print "library missing \n";exit}
109
unless(defined $component) { print "component missing \n";exit}
110
unless(defined $version)   { $version = "padring";}
111
 
112
my $parser = XML::LibXML->new();
113
 
114
 
115
my $component_repo           = yp::lib::find_component_repo($vendor,$library,$component);
116
my $lib_comp_sep             = yp::lib::find_lib_comp_sep($vendor,$library,$component);
117
 
118
$pads_csv ="${home}${component_repo}/${vendor}/${library}${lib_comp_sep}${component}/${pads_csv}";
119
 
120
unless(-e $pads_csv)
121
{
122
print "file not exist:  $pads_csv  \n";
123
exit;
124
 
125
}
126
print " Processing  $vendor $library $component  $rtl  $xml \n ---->>  ${pads_csv} \n";
127
 
128
my $xml_file = "${home}${component_repo}/${vendor}/${library}${lib_comp_sep}${component}/${rtl}";
129
mkdir $xml_file,0755   unless( -e $xml_file );
130
 
131
my $xml_file = "${xml_file}/${xml}";
132
mkdir $xml_file,0755   unless( -e $xml_file );
133
 
134
 
135
my $outfile = "${xml_file}/${component}_padring.xml";
136
 
137
my $cmd = "cp ${home}/tools/padring/boilerplate ${outfile}\n";
138
 
139
if(system($cmd)){}
140
 
141
open DEST_FILE,">>$outfile" or die "unable to open $outfile";
142
 
143
print DEST_FILE  "${vendor} \n";
144
print DEST_FILE  "${library} \n";
145
print DEST_FILE  "${component} \n";
146
print DEST_FILE  "${version} \n";
147
 
148
 
149
my @scaler_list;
150
my @vector_list;
151
 
152
$SRCFILE ="$pads_csv";
153
open(SRCFILE) or die("Could not open src file.  $SRCFILE ");
154
foreach $line ()
155
    {
156
    chomp($line);
157
    $_ = $line;
158
    if(/(\S+),(\S+),(\S+),(\S+)/)
159
      {
160
      $pin_name    = $1;
161
      $pin_dir     = $2;
162
      $pin_reset   = $3;
163
      $pin_ucf     = $4;
164
 
165
      $_ = $pin_name;
166
 
167
      if(/(\w+)[\[](\d+)[\]]/)
168
        {
169
        $pin_name    = $1;
170
        $pin_bit     = $2;
171
        $pin_type    = "vector";
172
        push (@vector_list,  "${pin_name}::${pin_bit}::${pin_dir}::${pin_reset}::${pin_ucf}");
173
        }
174
       else
175
        {
176
        push (@scaler_list,  "${pin_name}::${pin_dir}::${pin_reset}::${pin_ucf}");
177
        }
178
      }
179
 
180
    }
181
 
182
 
183
 
184
 
185
 
186
 
187
print DEST_FILE  "\n  \n";
188
 
189
foreach $list (@scaler_list)
190
  {
191
 
192
 
193
  ( ${pin_name},${pin_dir},${pin_reset},${pin_ucf}) = split( /::/ , $list);
194
 
195
  $pin_name   =  uc $pin_name;
196
  if   ($pin_dir eq  "in")     {$pin_port ="in" ;}
197
  elsif($pin_dir eq "out")     {$pin_port ="out";}
198
  elsif($pin_dir eq "inout")   {$pin_port ="io";}
199
  elsif($pin_dir eq "tsout")   {$pin_port ="out";}
200
  elsif($pin_dir eq "odout")   {$pin_port ="out";}
201
  elsif($pin_dir eq "odinout") {$pin_port ="io";}
202
  else                         {$pin_port ="XX";}
203
  print DEST_FILE  "                                                                                   \n";
204
  print DEST_FILE  " ${pin_name}                                                                       \n";
205
  print DEST_FILE  "             \n";
206
  print DEST_FILE  "                                                       \n";
207
  print DEST_FILE  "    \n";
208
  print DEST_FILE  "                                                                                       \n";
209
  print DEST_FILE  "                                                                                        \n";
210
  print DEST_FILE  "      PAD_${pin_port}                       \n";
211
  print DEST_FILE  "          ${pin_name}                   \n";
212
  print DEST_FILE  "                                                                                       \n";
213
  print DEST_FILE  "                                                                                      \n";
214
  print DEST_FILE  "                                                     \n";
215
  print DEST_FILE  "                                                                                        \n";
216
  print DEST_FILE  "                                                                                  \n\n";
217
 
218
  }
219
 
220
 
221
 
222
 
223
 
224
foreach $list (@vector_list)   {  print DEST_FILE  "++>  $list      \n";}
225
 
226
print DEST_FILE  "\n  \n ";
227
 
228
 
229
 
230
 
231
 
232
 
233
 
234
 
235
 
236
 
237
 
238
 
239
 
240
 
241
 
242
 
243
 
244
 
245
 
246
print DEST_FILE  "\n  \n";
247
 
248
 
249
 
250
 
251
print DEST_FILE  "   \n";
252
print DEST_FILE  "    \n";
253
print DEST_FILE  "     Padring \n";
254
print DEST_FILE  "     \n";
255
print DEST_FILE  "    \n";
256
print DEST_FILE  "   \n";
257
print DEST_FILE  " \n";
258
print DEST_FILE  "   \n";
259
print DEST_FILE  "     \n";
260
print DEST_FILE  "      Padring \n";
261
print DEST_FILE  "      Padring \n";
262
print DEST_FILE  "       \n";
263
print DEST_FILE  "   \n";
264
 
265
 
266
 
267
 
268
 
269
 
270
 
271
print DEST_FILE  "\n  \n";
272
 
273
foreach $list (@scaler_list)
274
  {
275
 
276
 
277
  ( ${pin_name},${pin_dir},${pin_reset},${pin_ucf}) = split( /::/ , $list);
278
 
279
  $pin_name   =  uc $pin_name;
280
  if   ($pin_dir eq  "in")     {$pin_port ="in" ;}
281
  elsif($pin_dir eq "out")     {$pin_port ="out";}
282
  elsif($pin_dir eq "inout")   {$pin_port ="inout";}
283
  elsif($pin_dir eq "tsout")   {$pin_port ="out";}
284
  elsif($pin_dir eq "odout")   {$pin_port ="out";}
285
  elsif($pin_dir eq "odinout") {$pin_port ="inout";}
286
  else                         {$pin_port ="XX";}
287
  print DEST_FILE  "   ${pin_name}                                                 \n";
288
  print DEST_FILE  " wire         \n";
289
  print DEST_FILE  "  ${pin_port}                                                     \n";
290
  print DEST_FILE  "                                                                                  \n\n";
291
 
292
  }
293
 
294
 
295
 
296
foreach $list (@vector_list)   {  print DEST_FILE  "++>  $list      \n";}
297
 
298
 
299
print DEST_FILE  "\n  \n ";
300
 
301
print DEST_FILE  "\n  \n ";
302
 
303
 
304
 
305
 
306
 
307
 
308
 
309
 
310
 
311
 
312
 
313
 
314
 
315
 
316
print DEST_FILE  "\n  \n ";
317
 
318
1
319
 
320
 
321
 

powered by: WebSVN 2.1.0

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