| 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 | 135 | jt_eaton |  
 | 
      
         | 35 |  |  |  
 | 
      
         | 36 |  |  |  
 | 
      
         | 37 | 131 | jt_eaton | ############################################################################
 | 
      
         | 38 |  |  | # General PERL config
 | 
      
         | 39 |  |  | ############################################################################
 | 
      
         | 40 |  |  | use Getopt::Long;
 | 
      
         | 41 |  |  | use English;
 | 
      
         | 42 |  |  | use File::Basename;
 | 
      
         | 43 |  |  | use Cwd;
 | 
      
         | 44 |  |  | use XML::LibXML;
 | 
      
         | 45 |  |  | use lib './tools';
 | 
      
         | 46 |  |  | use sys::lib;
 | 
      
         | 47 |  |  | use yp::lib;
 | 
      
         | 48 | 133 | jt_eaton | use Parallel::ForkManager;
 | 
      
         | 49 | 131 | jt_eaton |  
 | 
      
         | 50 |  |  | $OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
 | 
      
         | 51 |  |  |  
 | 
      
         | 52 |  |  |  
 | 
      
         | 53 |  |  | ############################################################################
 | 
      
         | 54 |  |  | ### Process the options
 | 
      
         | 55 |  |  | ############################################################################
 | 
      
         | 56 |  |  | Getopt::Long::config("require_order", "prefix=-");
 | 
      
         | 57 |  |  | GetOptions("h","help",
 | 
      
         | 58 |  |  | ) || die "(use '$program_name -h' for help)";
 | 
      
         | 59 |  |  |  
 | 
      
         | 60 |  |  |  
 | 
      
         | 61 |  |  |  
 | 
      
         | 62 |  |  |  
 | 
      
         | 63 |  |  | ##############################################################################
 | 
      
         | 64 |  |  | ## Help option
 | 
      
         | 65 |  |  | ##############################################################################
 | 
      
         | 66 |  |  | if ( $opt_h or $opt_help  )
 | 
      
         | 67 |  |  |   { print "\n build_master";
 | 
      
         | 68 |  |  |     print "\n";
 | 
      
         | 69 |  |  |     exit 1;
 | 
      
         | 70 |  |  |   }
 | 
      
         | 71 |  |  |  
 | 
      
         | 72 |  |  |  
 | 
      
         | 73 |  |  | my $parser = XML::LibXML->new();
 | 
      
         | 74 |  |  |  
 | 
      
         | 75 |  |  |  
 | 
      
         | 76 |  |  | my      @kids          = (  );
 | 
      
         | 77 |  |  | my      @filelist      = (  );
 | 
      
         | 78 |  |  |  
 | 
      
         | 79 |  |  |  
 | 
      
         | 80 |  |  |  
 | 
      
         | 81 |  |  | #/**********************************************************************/
 | 
      
         | 82 |  |  | #/*  Process each library by finding any ip-xact file in any component */
 | 
      
         | 83 |  |  | #/*                                                                    */
 | 
      
         | 84 |  |  | #/*  Each ip-xact file is parsed and it's filename and the names of any*/
 | 
      
         | 85 |  |  | #/*  modules that it uses are saved.                                   */
 | 
      
         | 86 |  |  | #/*                                                                    */
 | 
      
         | 87 |  |  | #/*                                                                    */
 | 
      
         | 88 |  |  | #/**********************************************************************/
 | 
      
         | 89 |  |  |  
 | 
      
         | 90 |  |  | my $home = cwd();
 | 
      
         | 91 |  |  |  
 | 
      
         | 92 |  |  | my $prefix   = yp::lib::get_workspace();
 | 
      
         | 93 |  |  |    $prefix   = "/${prefix}";
 | 
      
         | 94 |  |  |  
 | 
      
         | 95 |  |  | my @vendors = yp::lib::find_vendors();
 | 
      
         | 96 |  |  |  
 | 
      
         | 97 |  |  | foreach my $vendor (@vendors)
 | 
      
         | 98 |  |  |  {
 | 
      
         | 99 |  |  |  my $vendor_status    =  yp::lib::get_vendor_status($vendor);
 | 
      
         | 100 |  |  |  if($vendor_status eq "active")
 | 
      
         | 101 |  |  |    {
 | 
      
         | 102 |  |  |    my @libraries = yp::lib::find_libraries($vendor);
 | 
      
         | 103 |  |  |    foreach my $library (@libraries)
 | 
      
         | 104 |  |  |      {
 | 
      
         | 105 |  |  |      my $library_status   =  yp::lib::get_library_status($vendor,$library);
 | 
      
         | 106 |  |  |      if($library_status eq "active")
 | 
      
         | 107 |  |  |          {
 | 
      
         | 108 |  |  |          run_vendor_library ( $vendor ,  $library)
 | 
      
         | 109 |  |  |          }
 | 
      
         | 110 |  |  |      }
 | 
      
         | 111 |  |  |    }
 | 
      
         | 112 |  |  |  }
 | 
      
         | 113 |  |  |  
 | 
      
         | 114 |  |  |  
 | 
      
         | 115 |  |  |  
 | 
      
         | 116 |  |  |  
 | 
      
         | 117 |  |  | sub run_vendor_library
 | 
      
         | 118 |  |  |    {
 | 
      
         | 119 |  |  |    my @params     = @_;
 | 
      
         | 120 |  |  |    my $library    = pop(@params);
 | 
      
         | 121 |  |  |    my $vendor     = pop(@params);
 | 
      
         | 122 | 133 | jt_eaton |    my $prefix          = yp::lib::get_workspace();
 | 
      
         | 123 |  |  |    my $number_of_cpus  = yp::lib::get_number_of_cpus();
 | 
      
         | 124 |  |  |  
 | 
      
         | 125 |  |  |    my @components   = yp::lib::find_components($vendor,$library);
 | 
      
         | 126 |  |  |  
 | 
      
         | 127 |  |  |    foreach my $component (@components)
 | 
      
         | 128 |  |  |       {
 | 
      
         | 129 |  |  |       my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
 | 
      
         | 130 |  |  |  
 | 
      
         | 131 |  |  |       if($socgen_filename)
 | 
      
         | 132 |  |  |         {
 | 
      
         | 133 |  |  |         my $socgen_file     = $parser->parse_file($socgen_filename);
 | 
      
         | 134 |  |  |         my $syn_library_path ;
 | 
      
         | 135 |  |  |         my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$library,$component);
 | 
      
         | 136 |  |  |         my $syn_comp_path   = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:comp_path/text()")->to_literal;
 | 
      
         | 137 |  |  |  
 | 
      
         | 138 |  |  |         if ($syn_comp_path)
 | 
      
         | 139 |  |  |            {
 | 
      
         | 140 |  |  |            $syn_library_path ="${lib_comp_sep}${syn_comp_path}";
 | 
      
         | 141 |  |  |            }
 | 
      
         | 142 |  |  |         else
 | 
      
         | 143 |  |  |            {
 | 
      
         | 144 |  |  |            $syn_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:library_path/text()")->to_literal;
 | 
      
         | 145 |  |  |            }
 | 
      
         | 146 |  |  |  
 | 
      
         | 147 |  |  |       #   print "XXXX-   $vendor $library $component  $syn_library_path   \n";
 | 
      
         | 148 |  |  |  
 | 
      
         | 149 |  |  |         #/*********************************************************************************************/
 | 
      
         | 150 |  |  |         #/   files for synthesys                                                                      */
 | 
      
         | 151 |  |  |         #/                                                                                            */
 | 
      
         | 152 |  |  |         #/*********************************************************************************************/
 | 
      
         | 153 |  |  |         my $cmd;
 | 
      
         | 154 |  |  |         my @cmds =();
 | 
      
         | 155 |  |  |         my $manager = new Parallel::ForkManager( $number_of_cpus );
 | 
      
         | 156 |  |  |  
 | 
      
         | 157 |  |  |  
 | 
      
         | 158 | 135 | jt_eaton |         foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:syn/socgen:fpgas/socgen:fpga/socgen:variant"))
 | 
      
         | 159 | 133 | jt_eaton |            {
 | 
      
         | 160 |  |  |            my($chip_variant)     = $i_name ->findnodes('./text()')->to_literal ;
 | 
      
         | 161 |  |  |            my($chip_part)        = $i_name ->findnodes('../socgen:target/socgen:part/text()')->to_literal ;
 | 
      
         | 162 | 135 | jt_eaton |            my($chip_tool)        = $i_name ->findnodes('../socgen:tool/text()')->to_literal ;
 | 
      
         | 163 |  |  |            print "  FPGAs     $chip_variant       $chip_part  |||| $chip_tool   \n";
 | 
      
         | 164 |  |  |            if($chip_tool eq "ise")
 | 
      
         | 165 |  |  |             {
 | 
      
         | 166 |  |  |             $cmd ="./tools/synthesys/run_ise   $vendor $library $syn_library_path  $chip_variant    $chip_part  $chip_tool     \n";
 | 
      
         | 167 |  |  |             push @cmds,$cmd;
 | 
      
         | 168 |  |  |             }
 | 
      
         | 169 |  |  |            elsif($chip_tool eq "ara")
 | 
      
         | 170 |  |  |             {
 | 
      
         | 171 |  |  |             $cmd ="./tools/synthesys/run_ara   $vendor $library $syn_library_path  $chip_variant    $chip_part  $chip_tool     \n";
 | 
      
         | 172 |  |  |             push @cmds,$cmd;
 | 
      
         | 173 |  |  |             }
 | 
      
         | 174 | 133 | jt_eaton |            }
 | 
      
         | 175 |  |  |  
 | 
      
         | 176 |  |  |         foreach $cmd (@cmds)
 | 
      
         | 177 |  |  |            {
 | 
      
         | 178 |  |  |            $manager->start and next;
 | 
      
         | 179 |  |  |            system($cmd);
 | 
      
         | 180 |  |  |            $manager->finish;
 | 
      
         | 181 |  |  |            }
 | 
      
         | 182 |  |  |  
 | 
      
         | 183 |  |  |         #   $manager->wait_all_children;
 | 
      
         | 184 |  |  |         print "build_fpgas COMPLETE \n";
 | 
      
         | 185 |  |  |  
 | 
      
         | 186 |  |  |         }
 | 
      
         | 187 |  |  |       }
 | 
      
         | 188 | 131 | jt_eaton |    }
 | 
      
         | 189 | 133 | jt_eaton |  
 | 
      
         | 190 |  |  |  
 |