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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [gen_signals] - Blame information for rev 131

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
#/**********************************************************************/
4
#/*                                                                    */
5
#/*             -------                                                */
6
#/*            /   SOC  \                                              */
7
#/*           /    GEN   \                                             */
8
#/*          /    TOOL    \                                            */
9
#/*          ==============                                            */
10
#/*          |            |                                            */
11
#/*          |____________|                                            */
12
#/*                                                                    */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*  Author(s):                                                        */
17
#/*      - John Eaton, jt_eaton@opencores.org                          */
18
#/*                                                                    */
19
#/**********************************************************************/
20
#/*                                                                    */
21
#/*    Copyright (C) <2010-2011>                */
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
# General PERL config
49
############################################################################
50
use Getopt::Long;
51
use English;
52
use File::Basename;
53
use Cwd;
54
use Scalar::Util qw(looks_like_number);
55
use XML::LibXML;
56
use lib './tools';
57
use sys::lib;
58
use yp::lib;
59
use BerkeleyDB;
60
 
61
 
62
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
63
 
64
 
65
############################################################################
66
### Process the options
67
############################################################################
68
Getopt::Long::config("require_order", "prefix=-");
69
GetOptions("h","help",
70
           "vendor=s" => \$vendor,
71
           "library=s" => \$library,
72
           "version=s" => \$version,
73
           "component=s" => \$component,
74
           "verbose"
75
) || die "(use '$program_name -h' for help)";
76
 
77
 
78
##############################################################################
79
## Help option
80
##############################################################################
81
if ( $opt_h  or $opt_help  )
82
  { print "\n read_ports    -vendor vendor_name -library library_name  -component component_name  -version version_name \n";
83
    exit 1;
84
  }
85
 
86
 
87
 
88
 
89
 
90
 
91
#############################################################################
92
##
93
##
94
#############################################################################
95
 
96
 
97
$home = cwd();
98
 
99
 
100
my $variant;
101
 
102
if($version)       {$variant   = "${component}_${version}";}
103
else               {$variant   = "${component}";}
104
 
105
 
106
my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
107
my $parser = XML::LibXML->new();
108
 
109
 
110
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
111
 
112
if($opt_verbose) {print "\n READ_ports     $vendor $library $component $version         \n";}
113
 
114
 
115
 
116
my $io_ports  = yp::lib::get_io_ports() ;
117
 
118
   my $gen_port_outfile = yp::lib::get_io_ports_db_filename($vendor,$library,$component,$version);
119
   $ports_db   = new BerkeleyDB::Hash( -Filename => $gen_port_outfile, -Flags => DB_CREATE ) or die "Cannot open ${gen_port_outfile}: $!";
120
#   print "XXXXXXXX   $gen_port_outfile           READ PORTS  \n";
121
 
122
 
123
   my $gen_bus_outfile = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version);
124
   $busses_db   = new BerkeleyDB::Hash( -Filename => $gen_bus_outfile, -Flags => DB_CREATE ) or die "Cannot open ${gen_bus_outfile}: $!";
125
#   print "XXXXXXXX   $gen_bus_outfile           READ PORTS  \n";
126
 
127
 
128
 
129
   my $key;
130
   my $value;
131
 
132
 
133
 
134
   my @bus_list;
135
   my @adhoc_list;
136
 
137
   my $cursor = $busses_db ->db_cursor() ;
138
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
139
   {
140
#   print "INPUT  $key,   $value  \n";
141
                 ( ${key_type},${busref},${conn}) = split( /\./ , $key);
142
                 ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
143
                 if(($key_type eq "BusRef"))
144
                    {
145
                    push (@bus_list,  "${busref}_${conn}     ${phy_name}  ${log_name}   ${direction}  ${type}  ${vector}   ${left}:${right}    ");
146
                    uplift_port(  ${phy_name}  , ${direction}, ${type} , ${vector}, ${left} , ${right} );
147
                    }
148
                 else
149
                    {
150
 
151
                    }
152
 
153
   }
154
 
155
   my $status = $cursor->c_close() ;
156
 
157
 
158
 
159
   $cursor = $ports_db ->db_cursor() ;
160
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
161
   {
162
   ( ${key_type},${busref},${conn}) = split( /\./ , $key);
163
   ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
164
#   print "OUTPUT $key,   $value  \n";
165
                 if(($key_type eq "BusRef"))
166
                    {
167
                    }
168
                 else
169
                    {
170
                    push (@adhoc_list,"              ${log_name}   ${direction}   ${type}  ${vector}   ${left}:${right}  ");
171
                    }
172
   }
173
 
174
   my $status = $cursor->c_close() ;
175
 
176
 
177
   $ports_db   -> db_close();
178
   $busses_db   -> db_close();
179
 
180
 
181
 
182
   @bus_list      = sys::lib::trim_sort(@bus_list);
183
   @adhoc_list    = sys::lib::trim_sort(@adhoc_list);
184
my @busses  = yp::lib::get_busses($vendor,$library,$component,$version);
185
 
186
if($opt_verbose)
187
  {
188
    foreach $list (@bus_list)   {  print   "${list}\n";  }
189
    foreach $list (@adhoc_list) {  print   "${list}\n";  }
190
    foreach $list (@busses)     {  print   "${list}\n";  }
191
  }
192
 
193
 
194
 
195
#/*********************************************************************************************/
196
#/                                                                                            */
197
#/                                                                                            */
198
#/                                                                                            */
199
#/                                                                                            */
200
#/                                                                                            */
201
#/                                                                                            */
202
#/*********************************************************************************************/
203
 
204
 
205
sub uplift_port
206
   {
207
   my @params     = @_;
208
   my $right            = pop(@params);
209
   my $left             = pop(@params);
210
   my $vector           = pop(@params);
211
   my $type             = pop(@params);
212
   my $direction        = pop(@params);
213
   my $log_name         = pop(@params);
214
 
215
if($opt_verbose){   print "PORT_UPLIFT  $log_name  $direction  $type  $vector  $left  $right  \n";}
216
   $ports_db->db_put( "kxcd","${log_name}:${direction}:${type}:${vector}:${left}:${right}:HIER_HOLD"  );
217
 
218
 
219
   my $uplift_data;
220
   my $uplift_log_name ;
221
   my $uplift_direction ;
222
   my $uplift_type;
223
   my $uplift_vector;
224
   my $uplift_left;
225
   my $uplift_right;
226
 
227
   $ports_db->db_get("$log_name", $uplift_data );
228
   (${uplift_log_name},${uplift_direction},${uplift_type},${uplift_vector},${uplift_left},${uplift_right}  ) = split ':', $uplift_data;
229
 
230
   $ports_db->db_get("kxcd", $uplift_data );
231
   (${log_name},${direction},${type},${vector},${left},${right}  ) = split ':', $uplift_data;
232
   $ports_db->db_del("kxcd");
233
 
234
   if(${uplift_log_name})
235
     {
236
#     print "REPLACING    ${uplift_log_name}  ${uplift_direction}  ${uplift_type}  ${uplift_vector}  ${uplift_left}  ${uplift_right}  \n";
237
     if(${uplift_direction} ne "node"   ) {        $direction =${uplift_direction};}
238
 
239
     if(${type} eq "wire" )   { $type =${uplift_type};}
240
 
241
     if(${uplift_vector} eq "vector")
242
          {
243
          if( $vector eq "vector" )
244
              {
245
              if( looks_like_number($uplift_left))
246
                  {
247
                  if( looks_like_number($left) )
248
                    {
249
                    if($uplift_left  > $left ) {$left  = $uplift_left;}
250
                    }
251
 
252
                  }
253
              else
254
                 {
255
                 if( looks_like_number($left) ) {$left  = ${uplift_left}; }
256
                 unless(${direction} ne "node") {$left  = ${uplift_left}; }
257
                 }
258
               if( looks_like_number($uplift_right) &&  looks_like_number($right) )  { if($uplift_right  < $right ) {$right  = $uplift_right;}}
259
               }
260
          else
261
             {
262
             $vector = "vector";
263
             $left   = ${uplift_left};
264
             $right  = ${uplift_right};
265
             }
266
          }
267
      }
268
#   print "WITH         $log_name  $direction  $type  $vector  $left  $right  \n";
269
   $ports_db->db_put( "${log_name}","${log_name}:${direction}:${type}:${vector}:${left}:${right}"  );
270
if($opt_verbose) {  print "XXXXXXXX   WROTE ${log_name}   ${log_name}:${direction}:${type}:${vector}:${left}:${right}  \n";}
271
   }
272
 
273
 
274
 
275
 
276
 
277
 
278
 
279
 
280
 
281
1

powered by: WebSVN 2.1.0

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