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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [read_ports] - Blame information for rev 134

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
           "debug","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   ";
83
    print "\n";
84
    exit 1;
85
  }
86
 
87
 
88
 
89
 
90
 
91
 
92
#############################################################################
93
##
94
##
95
#############################################################################
96
 
97
 
98
$home = cwd();
99
 
100
 
101
my $variant;
102
 
103
if($version)       {$variant   = "${component}_${version}";}
104
else               {$variant   = "${component}";}
105
 
106
 
107
my $main_module_name = yp::lib::get_module_name($vendor,$library,$component,$version) ;
108
my $parser = XML::LibXML->new();
109
 
110
 
111
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
112
 
113
print "\n READ_ports     $vendor $library $component $version         \n";
114
 
115
 
116
 
117
my $io_ports  = yp::lib::get_io_ports() ;
118
 
119
   my $gen_port_outfile = yp::lib::get_io_ports_db_filename($vendor,$library,$component,$version);
120
   $ports_db   = new BerkeleyDB::Hash( -Filename => $gen_port_outfile, -Flags => DB_CREATE ) or die "Cannot open ${gen_port_outfile}: $!";
121
#   print "XXXXXXXX   $gen_port_outfile           READ PORTS  \n";
122
 
123
 
124 134 jt_eaton
   my $gen_bus_outfile = yp::lib::get_io_busses_db_filename($vendor,$library,$component,$version,"default");
125 131 jt_eaton
   $busses_db   = new BerkeleyDB::Hash( -Filename => $gen_bus_outfile, -Flags => DB_CREATE ) or die "Cannot open ${gen_bus_outfile}: $!";
126
#   print "XXXXXXXX   $gen_bus_outfile           READ PORTS  \n";
127
 
128
 
129
 
130
   my $key;
131
   my $value;
132
 
133
 
134
 
135
   my @bus_list;
136
   my @adhoc_list;
137
 
138
   my $cursor = $busses_db ->db_cursor() ;
139
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
140
   {
141
#   print "INPUT  $key,   $value  \n";
142
                 ( ${key_type},${busref},${conn}) = split( /\./ , $key);
143
                 ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
144
                 if(($key_type eq "BusRef"))
145
                    {
146
                    push (@bus_list,  "${busref}_${conn}     ${phy_name}  ${log_name}   ${direction}  ${type}  ${vector}   ${left}:${right}    ");
147
 
148
                    }
149
                 else
150
                    {
151
 
152
                    }
153
 
154
   }
155
 
156
   my $status = $cursor->c_close() ;
157
 
158
 
159
 
160
   $cursor = $ports_db ->db_cursor() ;
161
   while ($cursor->c_get($key, $value, DB_NEXT) == 0)
162
   {
163
   ( ${key_type},${busref},${conn}) = split( /\./ , $key);
164
   ( ${log_name},${direction},${type},${vector},${left},${right},${phy_name}) = split ':', $value;
165
   print "OUTPUT $key,   $value  \n";
166
                 if(($key_type eq "BusRef"))
167
                    {
168
                    }
169
                 else
170
                    {
171
                    push (@adhoc_list,"              ${log_name}   ${direction}   ${type}  ${vector}   ${left}:${right}  ");
172
                    }
173
   }
174
 
175
   my $status = $cursor->c_close() ;
176
 
177
 
178
   $ports_db   -> db_close();
179
   $busses_db   -> db_close();
180
 
181
 
182
 
183
   @bus_list      = sys::lib::trim_sort(@bus_list);
184
   @adhoc_list    = sys::lib::trim_sort(@adhoc_list);
185
 
186
    foreach $list (@bus_list)   { print   "${list}\n";}
187
#
188
 
189
 
190
my @busses  = yp::lib::get_busses($vendor,$library,$component,$version);
191
 
192
    foreach $list (@busses) {  print   "${list}\n";  }
193
 
194
 
195
 
196
 
197
1

powered by: WebSVN 2.1.0

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