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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [gen_vhdl] - 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
#/*  Author(s):                                                        */
16
#/*      - John Eaton, jt_eaton@opencores.org                          */
17
#/*                                                                    */
18
#/**********************************************************************/
19
#/*                                                                    */
20
#/*    Copyright (C) <2010-2012>                */
21
#/*                                                                    */
22
#/*  This source file may be used and distributed without              */
23
#/*  restriction provided that this copyright statement is not         */
24
#/*  removed from the file and that any derivative work contains       */
25
#/*  the original copyright notice and the associated disclaimer.      */
26
#/*                                                                    */
27
#/*  This source file is free software; you can redistribute it        */
28
#/*  and/or modify it under the terms of the GNU Lesser General        */
29
#/*  Public License as published by the Free Software Foundation;      */
30
#/*  either version 2.1 of the License, or (at your option) any        */
31
#/*  later version.                                                    */
32
#/*                                                                    */
33
#/*  This source is distributed in the hope that it will be            */
34
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
35
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
36
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
37
#/*  details.                                                          */
38
#/*                                                                    */
39
#/*  You should have received a copy of the GNU Lesser General         */
40
#/*  Public License along with this source; if not, download it        */
41
#/*  from http://www.opencores.org/lgpl.shtml                          */
42
#/*                                                                    */
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 XML::LibXML;
55
use lib './tools';
56
use sys::lib;
57
use yp::lib;
58
 
59
 
60
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
61
 
62
 
63
############################################################################
64
### Process the options
65
############################################################################
66
 
67
Getopt::Long::config("require_order", "prefix=-");
68
GetOptions("h","help",
69
           "envidentifier=s" => \$envidentifier,
70
           "prefix=s" => \$prefix,
71
           "vendor=s" => \$vendor,
72
           "library=s" => \$library,
73
           "component=s" => \$component,
74
           "version=s" => \$version,
75
           "dest_dir=s" => \$dest_dir,
76
           "view=s" => \$view
77
) || die "(use '$program_name -h' for help)";
78
 
79
 
80
##############################################################################
81
## Help option
82
##############################################################################
83
if ( $opt_h  or ($opt_help) )
84
   {
85
   print "\n gen_verilogLib -envidentifier *simulation* -prefix /work  -vendor vendor_name -library  library_name  -component component_name -version version_name -dest_dir dest_dir";
86
   print "\n";
87
   exit 1;
88
   }
89
 
90
 
91
##############################################################################
92
##
93
##############################################################################
94
 
95
my $parser = XML::LibXML->new();
96
 
97
my $socgen_file               = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
98
my $ip_name_base_macro       = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:ip_name_base_macro/text()")->to_literal;
99
 
100
 
101
 
102
 
103
$home = cwd();
104
my @search_paths = ();
105
my $variant;
106
 
107
 
108
 if($version)       {$variant   = "${component}_${version}";}
109
 else               {$variant   = "${component}";}
110
 
111
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
112
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
113
my $module_name     = yp::lib::get_module_name($vendor,$library,$component,$version);
114
 
115
 
116
 
117
 
118
 
119
 
120
 
121
 
122
my $parser = XML::LibXML->new();
123
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
124
 
125
 
126
 
127
 
128
#print "\n XXXXXXXXX  Building $view  VHDL  RTL for  $prefix $library  $component $verison  $variant  $dest_dir  \n" ;
129
 
130
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}";
131
mkdir $path,0755             unless( -e $path );
132
 
133
 
134
 
135
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/../filelists";
136
mkdir $path,0755             unless( -e $path );
137
 
138
 
139
my $outfile ="${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/../filelists/${variant}.VHDL";
140
open FILELIST,">$outfile" or die "unable to open $outfile";
141
 
142
 
143
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
144
 
145
foreach $line (@filelist)
146
   {
147
   $_ = $line;
148
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
149
     {
150
     $new_library        = $2;
151
     $new_component      = $3;
152
     $new_vendor         = $1;
153
     $new_version        = $4;
154
 
155
#     print " FFFFFFFFFFFFFFFF  Brother      $new_vendor  $new_library  $new_component $new_version \n" ;
156
 
157
    my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
158
 
159
    foreach my $comp_view ($spirit_component_file->findnodes("//spirit:component/spirit:model/spirit:views/spirit:view/spirit:envIdentifier[./text() = '$envidentifier']"))
160
      {
161
      my($view_name)     = $comp_view->findnodes('../spirit:name/text()')->to_literal ;
162
      my($view_fileset)  = $comp_view->findnodes('../spirit:fileSetRef/spirit:localName/text()')->to_literal ;
163
#      print " FFFFFFFFFFFFFFFF  Found  $view_name  $view_fileset    \n" ;
164
 
165
 
166
 
167
 
168
 
169
    #/**********************************************************************/
170
    #/*                                                                    */
171
    #/* build a fileset in the following order                             */
172
    #/*                                                                    */
173
    #/* deflist for module names                                           */
174
    #/* all include files                                                  */
175
    #/* all module files                                                   */
176
    #/*                                                                    */
177
    #/*                                                                    */
178
    #/**********************************************************************/
179
 
180
 
181
 
182
    foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
183
       {
184
       my($file_name)          = $i_name ->findnodes('./text()')->to_literal ;
185
       my($file_logicalname)   = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
186
       my($file_type)          = $i_name ->findnodes('../spirit:fileType/text()')->to_literal ;
187
       my($file_usertype)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
188
       my($view_file)          = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
189
 
190
 
191
       if(($file_usertype eq "module") && ($view_file eq $view_fileset) &&   ($file_type eq "vhdlSource")                     )
192
         {
193
         print FILELIST         "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${file_name}\n";
194
         };
195
 
196
 
197
       }
198
 
199
 
200
 
201
 
202
    foreach  my   $i_name ($spirit_component_file->findnodes("//spirit:fileSets/spirit:fileSet/spirit:file/spirit:name"))
203
       {
204
       my($file_name)          = $i_name ->findnodes('./text()')->to_literal ;
205
       my($file_logicalname)   = $i_name ->findnodes('../spirit:logicalName/text()')->to_literal ;
206
       my($file_type)          = $i_name ->findnodes('../spirit:fileType/text()')->to_literal ;
207
       my($file_usertype)      = $i_name ->findnodes('../spirit:userFileType/text()')->to_literal ;
208
       my($view_file)          = $i_name ->findnodes('../../spirit:name/text()')->to_literal ;
209
 
210
 
211
 
212
       if(($file_usertype eq "module") && ($view_file eq $view_fileset) &&   ($file_type eq "vhdlSource")                     )
213
         {
214
 
215
 
216
         my $file_out  =  "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/${file_logicalname}.v";
217
 
218
 
219
         $cmd ="repeater   filelist $outfile    out $file_out  top  $file_logicalname   \n";
220
 
221
         print $cmd;
222
 
223
 
224
         if (system($cmd)) {}
225
 
226
         };
227
 
228
 
229
       }
230
 
231
 
232
      }
233
     }
234
   }
235
 
236
 
237
 
238
1
239
 
240
 
241
 
242
 
243
 
244
 
245
 
246
 
247
 
248
 
249
 
250
 
251
 
252
 
253
 

powered by: WebSVN 2.1.0

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