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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [tag_Index.db] - Blame information for rev 134

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 134 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 math::lib;
60
use BerkeleyDB;
61
 
62
 
63
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
64
 
65
 
66
 
67
 
68
 
69
###############################################################################
70
##                                                                            #
71
## Read all the parameters from an Index.db file and add its config_XX number #
72
##                                                                            #
73
###############################################################################
74
 
75
my $file_name         = $ARGV[0];
76
 
77
 
78
$home = cwd();
79
 
80
$design_db_file  = yp::lib::get_design_db_file;
81
my $design_db  = new BerkeleyDB::Hash( -Filename => "$design_db_file", -Flags => DB_CREATE ) or die "Cannot open $design_db_file: $!";
82
 
83
 
84
my $param_db  = new BerkeleyDB::Hash( -Filename => "$file_name", -Flags => DB_CREATE ) or die "Cannot open ${file_name}: $!";
85
 
86
 
87
 
88
 
89
 
90
 
91
$cursor = $param_db ->db_cursor() ;
92
 
93
 
94
my @out_param = ();
95
 
96
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
97
   {
98
   $_ = $key;
99
   if(/parameter_(\S+)__(\S+)/)
100
    {
101
    push @out_param , "${2}--${value}";
102
    }
103
   }
104
$status = $cursor->c_close() ;
105
 
106
 
107
@out_param      = sys::lib::trim_sort(@out_param);
108
 
109
my $param_str;
110
 
111
foreach my $param (@out_param)
112
        {
113
        $param_str ="${param}:::${param_str}";
114
        }
115
$param_str = "CONFIG___${param_str}";
116
 
117
 
118
my $config = "null";
119
 
120
$design_db->db_get($param_str, $config );
121
 
122
unless (defined $config && length $config > 0)
123
         {
124
         $config = "config_0";
125
         }
126
 
127
 
128
 
129
$param_db->db_put("CONFIG", "$config");
130
 
131
 
132
 
133
my $vlnv;
134
my $ven;
135
my $lib;
136
my $cmp;
137
my $ver;
138
my $cfg;
139
 
140
 
141
$param_db->db_get("VLNV", $vlnv );
142
 
143
 
144
( $ven,$lib,$cmp,$ver,$cfg) = split( /:/ , $vlnv);
145
 
146
 
147
my $main_module_name = yp::lib::get_module_name($ven,$lib,$cmp,$ver) ;
148
 
149
$Bus_filename = "./io_ports/${ven}__${lib}/${cmp}/${main_module_name}/BUSSES.dbm";
150
my $Busses_db  = new BerkeleyDB::Hash( -Filename => "$Bus_filename", -Flags => DB_CREATE ) or die "Cannot open $Bus_filename: $!";
151
 
152
my $key;
153
my $value;
154
 
155
 
156
 
157
 
158
   $B_cursor = $Busses_db ->db_cursor() ;
159
   while ($B_cursor->c_get($key, $value, DB_NEXT) == 0)
160
     {
161
     $param_db->db_put($key,$value);
162
     $_ = $key;
163
     if(/BusRef/)
164
       {
165
       my $v1;
166
       my $v2;
167
       my $v3;
168
       my $v4;
169
       my $v5;
170
       my $v6;
171
       my $v7;
172
       my $v5a;
173
       ( $v1,$v2,$v3,$v4,$v5,$v6,$v7) = split( /:/ , $value);
174
       if($v4 eq "vector")
175
            {  # resolve PARAMETERS Here
176
         #    print "RESOLVE  $key   $value  \n";
177
 
178
            foreach my $parameter (@out_param)
179
               {
180
               my $parameter_name;
181
               my $parameter_value;
182
               ( $parameter_name,$parameter_value) = split( /--/ , $parameter);
183
               $v5a   = math::lib::parse($v5,$parameter_name,$parameter_value);
184
        #       print "RESOLVE   $v5 to $v5a  from  $parameter_name  $parameter_value  \n";
185
               if( $v5 ne $v5a )
186
                 {
187
                 $param_db->db_put($key,"$v1:$v2:$v3:$v4:$v5a:$v6:$v7");
188
                 $v5 = $v5a;
189
                 }
190
               }
191
            }
192
       }
193
     }
194
     $status = $B_cursor->c_close() ;
195
 
196
 
197
 
198
 
199
 
200
 
201
 
202
 
203
 
204
$Busses_db->db_close();
205
 
206
$param_db->db_close();
207
$design_db->db_close();
208
 
209
1

powered by: WebSVN 2.1.0

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