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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [verilog/] [gen_vhdl] - Blame information for rev 135

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 135 jt_eaton
#/****************************************************************************/
4
#/*                                                                          */
5
#/*   SOCGEN Design for Reuse toolset                                        */
6
#/*                                                                          */
7
#/*   Version 1.0.0                                                          */
8
#/*                                                                          */
9
#/*   Author(s):                                                             */
10
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
11
#/*                                                                          */
12
#/****************************************************************************/
13
#/*                                                                          */
14
#/*                                                                          */
15
#/*             Copyright 2016 John T Eaton                                  */
16
#/*                                                                          */
17
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
18
#/* you may not use this file except in compliance with the License.         */
19
#/* You may obtain a copy of the License at                                  */
20
#/*                                                                          */
21
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
22
#/*                                                                          */
23
#/* Unless required by applicable law or agreed to in writing, software      */
24
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
25
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
26
#/* See the License for the specific language governing permissions and      */
27
#/* limitations under the License.                                           */
28
#/*                                                                          */
29
#/*                                                                          */
30
#/****************************************************************************/
31 131 jt_eaton
 
32
 
33
 
34
############################################################################
35
# General PERL config
36
############################################################################
37
use Getopt::Long;
38
use English;
39
use File::Basename;
40
use Cwd;
41
use XML::LibXML;
42
use lib './tools';
43
use sys::lib;
44
use yp::lib;
45
 
46
 
47
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
48
 
49
 
50
############################################################################
51
### Process the options
52
############################################################################
53
 
54
Getopt::Long::config("require_order", "prefix=-");
55
GetOptions("h","help",
56
           "envidentifier=s" => \$envidentifier,
57
           "prefix=s" => \$prefix,
58
           "vendor=s" => \$vendor,
59
           "library=s" => \$library,
60
           "component=s" => \$component,
61
           "version=s" => \$version,
62
           "dest_dir=s" => \$dest_dir,
63
           "view=s" => \$view
64
) || die "(use '$program_name -h' for help)";
65
 
66
 
67
##############################################################################
68
## Help option
69
##############################################################################
70
if ( $opt_h  or ($opt_help) )
71
   {
72
   print "\n gen_verilogLib -envidentifier *simulation* -prefix /work  -vendor vendor_name -library  library_name  -component component_name -version version_name -dest_dir dest_dir";
73
   print "\n";
74
   exit 1;
75
   }
76
 
77
 
78
##############################################################################
79
##
80
##############################################################################
81
 
82
my $parser = XML::LibXML->new();
83
 
84
my $socgen_file               = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
85
my $ip_name_base_macro       = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:ip_name_base_macro/text()")->to_literal;
86
 
87
 
88
 
89
 
90
$home = cwd();
91
my @search_paths = ();
92
my $variant;
93
 
94
 
95
 if($version)       {$variant   = "${component}_${version}";}
96
 else               {$variant   = "${component}";}
97
 
98
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
99
my $comp_xml_sep    = yp::lib::find_comp_xml_sep($vendor,$library,$component,$version);
100
my $module_name     = yp::lib::get_module_name($vendor,$library,$component,$version);
101
 
102
 
103
 
104
 
105
 
106
 
107
 
108
 
109
my $parser = XML::LibXML->new();
110
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
111
 
112
 
113
 
114
 
115
#print "\n XXXXXXXXX  Building $view  VHDL  RTL for  $prefix $library  $component $verison  $variant  $dest_dir  \n" ;
116
 
117
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}";
118
mkdir $path,0755             unless( -e $path );
119
 
120
 
121
 
122
my $path  = "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/../filelists";
123
mkdir $path,0755             unless( -e $path );
124
 
125
 
126
my $outfile ="${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/../filelists/${variant}.VHDL";
127
open FILELIST,">$outfile" or die "unable to open $outfile";
128
 
129
 
130
my  @filelist =       yp::lib::parse_component_brothers("$vendor","$library","$component","$version");
131
 
132
foreach $line (@filelist)
133
   {
134
   $_ = $line;
135
   if(/::(\S+)::(\S+)::(\S+)::(\S+)::/)
136
     {
137
     $new_library        = $2;
138
     $new_component      = $3;
139
     $new_vendor         = $1;
140
     $new_version        = $4;
141
 
142
#     print " FFFFFFFFFFFFFFFF  Brother      $new_vendor  $new_library  $new_component $new_version \n" ;
143
 
144
    my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($new_vendor,$new_library,$new_component,$new_version));
145
 
146 135 jt_eaton
    foreach my $comp_view ($spirit_component_file->findnodes("//ipxact:component/ipxact:model/ipxact:views/ipxact:view/ipxact:envIdentifier[./text() = '$envidentifier']"))
147 131 jt_eaton
      {
148 135 jt_eaton
      my($view_name)     = $comp_view->findnodes('../ipxact:name/text()')->to_literal ;
149
      my($view_fileset)  = $comp_view->findnodes('../ipxact:fileSetRef/ipxact:localName/text()')->to_literal ;
150 131 jt_eaton
#      print " FFFFFFFFFFFFFFFF  Found  $view_name  $view_fileset    \n" ;
151
 
152
 
153
 
154
 
155
 
156
    #/**********************************************************************/
157
    #/*                                                                    */
158
    #/* build a fileset in the following order                             */
159
    #/*                                                                    */
160
    #/* deflist for module names                                           */
161
    #/* all include files                                                  */
162
    #/* all module files                                                   */
163
    #/*                                                                    */
164
    #/*                                                                    */
165
    #/**********************************************************************/
166
 
167
 
168
 
169 135 jt_eaton
    foreach  my   $i_name ($spirit_component_file->findnodes("//ipxact:fileSets/ipxact:fileSet/ipxact:file/ipxact:name"))
170 131 jt_eaton
       {
171
       my($file_name)          = $i_name ->findnodes('./text()')->to_literal ;
172 135 jt_eaton
       my($file_logicalname)   = $i_name ->findnodes('../ipxact:logicalName/text()')->to_literal ;
173
       my($file_type)          = $i_name ->findnodes('../ipxact:fileType/text()')->to_literal ;
174
       my($file_usertype)      = $i_name ->findnodes('../ipxact:userFileType/text()')->to_literal ;
175
       my($view_file)          = $i_name ->findnodes('../../ipxact:name/text()')->to_literal ;
176 131 jt_eaton
 
177
 
178
       if(($file_usertype eq "module") && ($view_file eq $view_fileset) &&   ($file_type eq "vhdlSource")                     )
179
         {
180
         print FILELIST         "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${file_name}\n";
181
         };
182
 
183
 
184
       }
185
 
186
 
187
 
188
 
189 135 jt_eaton
    foreach  my   $i_name ($spirit_component_file->findnodes("//ipxact:fileSets/ipxact:fileSet/ipxact:file/ipxact:name"))
190 131 jt_eaton
       {
191
       my($file_name)          = $i_name ->findnodes('./text()')->to_literal ;
192 135 jt_eaton
       my($file_logicalname)   = $i_name ->findnodes('../ipxact:logicalName/text()')->to_literal ;
193
       my($file_type)          = $i_name ->findnodes('../ipxact:fileType/text()')->to_literal ;
194
       my($file_usertype)      = $i_name ->findnodes('../ipxact:userFileType/text()')->to_literal ;
195
       my($view_file)          = $i_name ->findnodes('../../ipxact:name/text()')->to_literal ;
196 131 jt_eaton
 
197
 
198
 
199
       if(($file_usertype eq "module") && ($view_file eq $view_fileset) &&   ($file_type eq "vhdlSource")                     )
200
         {
201
 
202
 
203
         my $file_out  =  "${home}${prefix}/${vendor}__${library}${lib_comp_sep}${component}${comp_xml_sep}/${dest_dir}/${file_logicalname}.v";
204
 
205
 
206
         $cmd ="repeater   filelist $outfile    out $file_out  top  $file_logicalname   \n";
207
 
208
         print $cmd;
209
 
210
 
211
         if (system($cmd)) {}
212
 
213
         };
214
 
215
 
216
       }
217
 
218
 
219
      }
220
     }
221
   }
222
 
223
 
224
 
225
1
226
 
227
 
228
 
229
 
230
 
231
 
232
 
233
 
234
 
235
 
236
 
237
 
238
 
239
 
240
 

powered by: WebSVN 2.1.0

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