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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [simulation/] [run_sims] - Blame information for rev 135

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 119 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 119 jt_eaton
 
32
 
33
############################################################################
34
# General PERL config
35
############################################################################
36
use Getopt::Long;
37
use English;
38
use File::Basename;
39
use Cwd;
40
use XML::LibXML;
41
use lib './tools';
42
use sys::lib;
43
use yp::lib;
44 131 jt_eaton
use Parallel::ForkManager;
45 119 jt_eaton
 
46
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
47
 
48
 
49
############################################################################
50
### Process the options
51
############################################################################
52
Getopt::Long::config("require_order", "prefix=-");
53
GetOptions("h","help",
54
) || die "(use '$program_name -h' for help)";
55
 
56
 
57
 
58
 
59
##############################################################################
60
## Help option
61
##############################################################################
62
if ( $opt_h or $opt_help  )
63 131 jt_eaton
  { print "\n run_sims vendor  library";
64 119 jt_eaton
    print "\n";
65
    exit 1;
66
  }
67
 
68
 
69
#/**********************************************************************/
70 131 jt_eaton
#/*  Process each library by finding any ip-xact file in any component */
71 119 jt_eaton
#/*                                                                    */
72
#/*  Each ip-xact file is parsed and it's filename and the names of any*/
73
#/*  modules that it uses are saved.                                   */
74
#/*                                                                    */
75
#/*                                                                    */
76
#/**********************************************************************/
77
 
78
 
79
my $home              = cwd();
80
my $vendor ;
81 131 jt_eaton
my $library  ;
82 119 jt_eaton
 
83
 
84 131 jt_eaton
my $prefix = yp::lib::get_workspace();
85 133 jt_eaton
my $number_of_cpus = yp::lib::get_number_of_cpus();
86 119 jt_eaton
 
87
$_               = $ARGV[0];
88
 
89
 
90 131 jt_eaton
 
91 119 jt_eaton
if(/(\S+)__(\S+)/)
92
     {
93
     $vendor           = $1;
94 131 jt_eaton
     $library         = $2;
95 119 jt_eaton
     }
96
 
97
my $parser = XML::LibXML->new();
98
 
99
 
100
 
101 131 jt_eaton
my @components   = yp::lib::find_components($vendor,$library);
102 119 jt_eaton
 
103
foreach my $component (@components)
104
   {
105 131 jt_eaton
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
106
 
107
   if($socgen_filename)
108
   {
109
   my $socgen_file     = $parser->parse_file($socgen_filename);
110 130 jt_eaton
   my $sim_library_path ;
111 131 jt_eaton
   my $lib_comp_sep             = yp::lib::find_lib_comp_sep($vendor,$library,$component);
112 130 jt_eaton
   my $sim_comp_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
113 119 jt_eaton
 
114 130 jt_eaton
   if ($sim_comp_path)
115
      {
116
      $sim_library_path            ="${lib_comp_sep}${sim_comp_path}";
117
      }
118
   else
119
      {
120
      $sim_library_path            = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
121
      }
122 128 jt_eaton
 
123
 
124 130 jt_eaton
 
125
 
126 119 jt_eaton
   #/*********************************************************************************************/
127
   #/   files for simulation                                                                     */
128
   #/                                                                                            */
129
   #/*********************************************************************************************/
130 131 jt_eaton
my $cmd;
131
my @cmds = ();
132 133 jt_eaton
my $manager = new Parallel::ForkManager( $number_of_cpus );
133 119 jt_eaton
 
134 131 jt_eaton
 
135 130 jt_eaton
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test/socgen:name"))
136 119 jt_eaton
      {
137
      my($sim_name)     = $i_name ->findnodes('./text()')->to_literal ;
138
      my($sim_configuration)  = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
139
      my($sim_variant)  = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
140 131 jt_eaton
      $cmd ="./tools/simulation/run_icarus  $vendor   $library $sim_library_path $sim_name     $sim_variant \n";
141
      push @cmds,$cmd;
142
     }
143 119 jt_eaton
 
144
 
145
 
146 131 jt_eaton
    foreach  my   $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:verilator/socgen:test/socgen:name"))
147 126 jt_eaton
      {
148
      my($sim_name)     = $i_name ->findnodes('./text()')->to_literal ;
149
      my($sim_configuration)  = $i_name ->findnodes('../socgen:configuration/text()')->to_literal ;
150
      my($sim_variant)  = $i_name ->findnodes('../socgen:variant/text()')->to_literal ;
151 131 jt_eaton
      $cmd ="./tools/simulation/run_verilator  $vendor   $library $sim_library_path $sim_name     $sim_variant \n";
152
      if(system($cmd)){};
153 119 jt_eaton
      }
154
 
155 131 jt_eaton
 
156
     foreach $cmd (@cmds)
157
      {
158
      $manager->start and next;
159
      system($cmd);
160
      $manager->finish;
161
      }
162
 
163
     $manager->wait_all_children;
164
print "run_sims COMPLETE \n";
165
 
166 119 jt_eaton
   }
167
 
168 131 jt_eaton
}
169 119 jt_eaton
 

powered by: WebSVN 2.1.0

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