| 1 |
125 |
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 |
125 |
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 |
134 |
jt_eaton |
use BerkeleyDB;
|
| 45 |
125 |
jt_eaton |
|
| 46 |
134 |
jt_eaton |
|
| 47 |
125 |
jt_eaton |
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
|
| 48 |
|
|
|
| 49 |
|
|
|
| 50 |
|
|
############################################################################
|
| 51 |
|
|
### Process the options
|
| 52 |
|
|
############################################################################
|
| 53 |
|
|
Getopt::Long::config("require_order", "prefix=-");
|
| 54 |
|
|
GetOptions("h","help",
|
| 55 |
|
|
"work_site=s" => \$work_site,
|
| 56 |
|
|
"vendor=s" => \$vendor,
|
| 57 |
131 |
jt_eaton |
"library=s" => \$library,
|
| 58 |
125 |
jt_eaton |
"component=s" => \$component,
|
| 59 |
|
|
"version=s" => \$version
|
| 60 |
|
|
) || die "(use '$program_name -h' for help)";
|
| 61 |
|
|
|
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
##############################################################################
|
| 65 |
|
|
## Help option
|
| 66 |
|
|
##############################################################################
|
| 67 |
|
|
if ( $opt_h or $opt_help)
|
| 68 |
131 |
jt_eaton |
{ print "\n build_icarus_filelists -work_site /work -vendor vendor_name -library library_name -component component_name ";
|
| 69 |
125 |
jt_eaton |
print "\n";
|
| 70 |
|
|
exit 1;
|
| 71 |
|
|
}
|
| 72 |
|
|
|
| 73 |
|
|
|
| 74 |
|
|
##############################################################################
|
| 75 |
|
|
##
|
| 76 |
|
|
##############################################################################
|
| 77 |
|
|
|
| 78 |
|
|
|
| 79 |
|
|
|
| 80 |
|
|
$home = cwd();
|
| 81 |
|
|
|
| 82 |
|
|
my $variant = "";
|
| 83 |
|
|
if($version) {$variant = "${component}_${version}"}
|
| 84 |
|
|
else {$variant = "${component}"}
|
| 85 |
|
|
|
| 86 |
|
|
#############################################################################
|
| 87 |
|
|
##
|
| 88 |
|
|
##
|
| 89 |
|
|
#############################################################################
|
| 90 |
|
|
|
| 91 |
|
|
my $parser = XML::LibXML->new();
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
|
| 95 |
|
|
#/*********************************************************************************************/
|
| 96 |
|
|
#/ */
|
| 97 |
|
|
#/ Create filelists for simulation, code coverage */
|
| 98 |
|
|
#/ */
|
| 99 |
|
|
#/ */
|
| 100 |
|
|
#/*********************************************************************************************/
|
| 101 |
|
|
|
| 102 |
|
|
@filelist_sim = ( );
|
| 103 |
|
|
|
| 104 |
|
|
|
| 105 |
|
|
|
| 106 |
|
|
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
|
|
|
| 110 |
|
|
|
| 111 |
|
|
#############################################################################
|
| 112 |
|
|
##
|
| 113 |
|
|
##
|
| 114 |
|
|
#############################################################################
|
| 115 |
|
|
|
| 116 |
131 |
jt_eaton |
print "Building SIM filelists for $work_site $vendor $library $component $version $variant \n" ;
|
| 117 |
130 |
jt_eaton |
my $sim_library_path ;
|
| 118 |
131 |
jt_eaton |
my $spirit_component_file = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
|
| 119 |
|
|
my $socgen_file = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
|
| 120 |
|
|
my $lib_comp_sep = yp::lib::find_lib_comp_sep($vendor,$library,$component);
|
| 121 |
125 |
jt_eaton |
|
| 122 |
130 |
jt_eaton |
my $sim_comp_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:comp_path/text()")->to_literal;
|
| 123 |
125 |
jt_eaton |
|
| 124 |
130 |
jt_eaton |
if ($sim_comp_path)
|
| 125 |
|
|
{
|
| 126 |
|
|
$sim_library_path ="${lib_comp_sep}${sim_comp_path}";
|
| 127 |
|
|
}
|
| 128 |
|
|
else
|
| 129 |
|
|
{
|
| 130 |
|
|
$sim_library_path = $socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:library_path/text()")->to_literal;
|
| 131 |
|
|
}
|
| 132 |
125 |
jt_eaton |
|
| 133 |
|
|
|
| 134 |
|
|
#/*********************************************************************************************/
|
| 135 |
|
|
#/ */
|
| 136 |
|
|
#/ */
|
| 137 |
|
|
#/ Read each variants parameters and defaults into an array and their order into an array */
|
| 138 |
|
|
#/ order must be preservered so that parameters can use the values of other parameters */
|
| 139 |
|
|
#/ */
|
| 140 |
|
|
#/*********************************************************************************************/
|
| 141 |
|
|
|
| 142 |
|
|
my %default_parameters = ();
|
| 143 |
|
|
my @parameter_order = ();
|
| 144 |
|
|
|
| 145 |
|
|
|
| 146 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:configurations/socgen:configuration[socgen:name/text() = '$variant']/socgen:parameters/socgen:parameter"))
|
| 147 |
125 |
jt_eaton |
{
|
| 148 |
|
|
my($parameter_name) = $i_name ->findnodes('socgen:name/text()')->to_literal ;
|
| 149 |
|
|
my($parameter_default) = $i_name ->findnodes('socgen:value/text()')->to_literal ;
|
| 150 |
|
|
$default_parameters{$parameter_name} = $parameter_default;
|
| 151 |
|
|
push @parameter_order ,$parameter_name ;
|
| 152 |
|
|
}
|
| 153 |
|
|
|
| 154 |
|
|
|
| 155 |
|
|
|
| 156 |
|
|
|
| 157 |
|
|
|
| 158 |
|
|
|
| 159 |
|
|
|
| 160 |
|
|
|
| 161 |
|
|
|
| 162 |
135 |
jt_eaton |
foreach my $comp ($spirit_component_file->findnodes('//ipxact:component'))
|
| 163 |
125 |
jt_eaton |
{
|
| 164 |
135 |
jt_eaton |
my($vendor) = $comp->findnodes('./ipxact:vendor/text()')->to_literal ;
|
| 165 |
|
|
my($library) = $comp->findnodes('./ipxact:library/text()')->to_literal ;
|
| 166 |
|
|
my($name) = $comp->findnodes('./ipxact:name/text()')->to_literal ;
|
| 167 |
|
|
my($version) = $comp->findnodes('./ipxact:version/text()')->to_literal ;
|
| 168 |
125 |
jt_eaton |
my $variant = "";
|
| 169 |
|
|
if($version) {$variant = "${name}_${version}"}
|
| 170 |
|
|
else {$variant = "${name}"}
|
| 171 |
131 |
jt_eaton |
print "rtl/gen directories for $library - $component VLNV $vendor - $library - $name - $variant \n";
|
| 172 |
126 |
jt_eaton |
$module_name = yp::lib::get_module_name($vendor,$library,$name,$version);
|
| 173 |
125 |
jt_eaton |
}
|
| 174 |
|
|
|
| 175 |
|
|
|
| 176 |
131 |
jt_eaton |
print "CREATING componentRef filelists for $library $component $name $variant \n";
|
| 177 |
125 |
jt_eaton |
|
| 178 |
|
|
|
| 179 |
|
|
#/*********************************************************************************************/
|
| 180 |
|
|
#/ */
|
| 181 |
|
|
#/ */
|
| 182 |
|
|
#/ */
|
| 183 |
|
|
#/ */
|
| 184 |
|
|
#/ */
|
| 185 |
|
|
#/ */
|
| 186 |
|
|
#/*********************************************************************************************/
|
| 187 |
|
|
|
| 188 |
|
|
|
| 189 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:testbench[socgen:variant/text() = '$variant']/socgen:code_coverage"))
|
| 190 |
125 |
jt_eaton |
{
|
| 191 |
|
|
|
| 192 |
131 |
jt_eaton |
my $path ="${home}${work_site}/${vendor}__${library}${sim_library_path}/cov";
|
| 193 |
125 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 194 |
131 |
jt_eaton |
$path ="${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}";
|
| 195 |
125 |
jt_eaton |
mkdir $path,0755 unless( -e $path );
|
| 196 |
|
|
|
| 197 |
128 |
jt_eaton |
|
| 198 |
131 |
jt_eaton |
my $outfile ="${home}${work_site}/${vendor}__${library}${sim_library_path}/cov/${variant}/TestBench";
|
| 199 |
125 |
jt_eaton |
open DUTFILE,">$outfile" or die "unable to open $outfile";
|
| 200 |
|
|
print DUTFILE "`timescale 1ns/1ns \n";
|
| 201 |
|
|
print DUTFILE " module TB(); \n";
|
| 202 |
128 |
jt_eaton |
|
| 203 |
134 |
jt_eaton |
|
| 204 |
|
|
|
| 205 |
|
|
|
| 206 |
128 |
jt_eaton |
print DUTFILE " $module_name \n";
|
| 207 |
|
|
my $first =1;
|
| 208 |
|
|
foreach my $parameter_name (@parameter_order)
|
| 209 |
|
|
{
|
| 210 |
|
|
my($parameter_default) = $default_parameters{$parameter_name};
|
| 211 |
|
|
if($first)
|
| 212 |
|
|
{
|
| 213 |
|
|
print DUTFILE " #( .${parameter_name}(${parameter_default})";
|
| 214 |
|
|
$first = 0;
|
| 215 |
|
|
}
|
| 216 |
|
|
else
|
| 217 |
|
|
{
|
| 218 |
|
|
print DUTFILE ",\n .${parameter_name}(${parameter_default})";
|
| 219 |
|
|
}
|
| 220 |
|
|
}
|
| 221 |
|
|
if($first)
|
| 222 |
|
|
{
|
| 223 |
134 |
jt_eaton |
print DUTFILE "\n test \n (); \n\n\n\n";
|
| 224 |
128 |
jt_eaton |
}
|
| 225 |
|
|
else
|
| 226 |
|
|
{
|
| 227 |
134 |
jt_eaton |
print DUTFILE ") \n test \n (); \n\n\n\n";
|
| 228 |
128 |
jt_eaton |
}
|
| 229 |
|
|
|
| 230 |
|
|
|
| 231 |
125 |
jt_eaton |
print DUTFILE " endmodule \n";
|
| 232 |
128 |
jt_eaton |
|
| 233 |
|
|
|
| 234 |
|
|
|
| 235 |
|
|
|
| 236 |
|
|
|
| 237 |
|
|
|
| 238 |
|
|
|
| 239 |
|
|
|
| 240 |
|
|
|
| 241 |
|
|
|
| 242 |
|
|
|
| 243 |
|
|
|
| 244 |
125 |
jt_eaton |
}
|
| 245 |
|
|
|
| 246 |
|
|
|
| 247 |
|
|
|
| 248 |
|
|
#/*********************************************************************************************/
|
| 249 |
|
|
#/ */
|
| 250 |
|
|
#/ Make simulation file set */
|
| 251 |
|
|
#/ */
|
| 252 |
|
|
#/ */
|
| 253 |
|
|
#/ */
|
| 254 |
|
|
#/ */
|
| 255 |
|
|
#/*********************************************************************************************/
|
| 256 |
|
|
|
| 257 |
131 |
jt_eaton |
print "CREATING sim files for $library $component $chip $name $variant \n";
|
| 258 |
125 |
jt_eaton |
|
| 259 |
|
|
|
| 260 |
|
|
|
| 261 |
|
|
|
| 262 |
|
|
|
| 263 |
|
|
|
| 264 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test[socgen:variant/text() = '$variant']"))
|
| 265 |
125 |
jt_eaton |
{
|
| 266 |
|
|
my($simulation) = $i_name ->findnodes('socgen:name/text()')->to_literal ;
|
| 267 |
|
|
my($configuration) = $i_name ->findnodes('socgen:configuration/text()')->to_literal ;
|
| 268 |
131 |
jt_eaton |
print " sim files for $library $component $variant $simulation $configuration \n";
|
| 269 |
125 |
jt_eaton |
|
| 270 |
|
|
|
| 271 |
134 |
jt_eaton |
|
| 272 |
|
|
|
| 273 |
|
|
|
| 274 |
|
|
my $design_db_filename = yp::lib::get_design_db_file;
|
| 275 |
|
|
my $design_db = new BerkeleyDB::Hash( -Filename => $design_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${design_db_filename}: $!";
|
| 276 |
|
|
|
| 277 |
|
|
|
| 278 |
|
|
|
| 279 |
|
|
my $data_db_filename = yp::lib::get_elab_db_filename($vendor,$library,$component,$version,$simulation);
|
| 280 |
|
|
my $data_db = new BerkeleyDB::Hash( -Filename => $data_db_filename, -Flags => DB_CREATE ) or die "Cannot open ${data_db_filename}: $!";
|
| 281 |
|
|
|
| 282 |
|
|
|
| 283 |
|
|
my $key;
|
| 284 |
|
|
my $value;
|
| 285 |
|
|
|
| 286 |
|
|
|
| 287 |
|
|
my @configs = ();
|
| 288 |
|
|
|
| 289 |
|
|
|
| 290 |
|
|
my $cursor = $data_db ->db_cursor() ;
|
| 291 |
|
|
while ($cursor->c_get($key, $value, DB_NEXT) == 0)
|
| 292 |
|
|
{
|
| 293 |
|
|
|
| 294 |
|
|
|
| 295 |
|
|
$_ = $key;
|
| 296 |
|
|
if(/parameter_root__(\S+)/)
|
| 297 |
|
|
{
|
| 298 |
|
|
# print "$key $value \n";
|
| 299 |
|
|
push @configs,"${1}--${value}:::";
|
| 300 |
|
|
}
|
| 301 |
|
|
|
| 302 |
|
|
}
|
| 303 |
|
|
|
| 304 |
|
|
my $status = $cursor->c_close() ;
|
| 305 |
|
|
|
| 306 |
|
|
$data_db -> db_close();
|
| 307 |
|
|
|
| 308 |
|
|
@configs = sys::lib::trim_sort(@configs);
|
| 309 |
|
|
|
| 310 |
|
|
my $config_n;
|
| 311 |
|
|
|
| 312 |
|
|
foreach my $config (@configs)
|
| 313 |
|
|
{
|
| 314 |
|
|
$config_n = "${config}${config_n}";
|
| 315 |
|
|
}
|
| 316 |
|
|
|
| 317 |
|
|
my $new_value;
|
| 318 |
|
|
$config_n="CONFIG___${config_n}";
|
| 319 |
|
|
$design_db->db_get($config_n, $new_value );
|
| 320 |
|
|
$config_n=$new_value;
|
| 321 |
|
|
|
| 322 |
|
|
|
| 323 |
|
|
|
| 324 |
131 |
jt_eaton |
my $outfile ="${home}${work_site}/${vendor}__${library}${sim_library_path}/icarus/${simulation}/TestBench";
|
| 325 |
125 |
jt_eaton |
open SIM_PARM_FILE,">$outfile" or die "unable to open $outfile";
|
| 326 |
|
|
|
| 327 |
|
|
|
| 328 |
|
|
my %local_parameters = %default_parameters;
|
| 329 |
|
|
my @local_order = @parameter_order;
|
| 330 |
|
|
|
| 331 |
|
|
|
| 332 |
|
|
|
| 333 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:testbenches/socgen:testbench[socgen:variant/text() = '$variant']/./socgen:parameters/socgen:parameter/socgen:name"))
|
| 334 |
125 |
jt_eaton |
{
|
| 335 |
|
|
my($par_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 336 |
|
|
my($par_value) = $i_name ->findnodes('../socgen:value/text()')->to_literal ;
|
| 337 |
|
|
if ( $local_parameters{$par_name} eq '' ) { push @local_order , $par_name; }
|
| 338 |
|
|
$local_parameters{$par_name} = $par_value;
|
| 339 |
|
|
}
|
| 340 |
|
|
|
| 341 |
|
|
|
| 342 |
|
|
|
| 343 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:configurations/socgen:configuration[socgen:name/text() = '$configuration']/./socgen:parameters/socgen:parameter/socgen:name"))
|
| 344 |
125 |
jt_eaton |
{
|
| 345 |
|
|
my($par_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 346 |
|
|
my($par_value) = $i_name ->findnodes('../socgen:value/text()')->to_literal ;
|
| 347 |
|
|
if($local_parameters{$par_name} eq '' ) { push @local_order , $par_name; }
|
| 348 |
|
|
$local_parameters{$par_name} = $par_value;
|
| 349 |
|
|
}
|
| 350 |
|
|
|
| 351 |
|
|
|
| 352 |
|
|
|
| 353 |
130 |
jt_eaton |
foreach my $i_name ($socgen_file->findnodes("//socgen:componentConfiguration/socgen:sim/socgen:icarus/socgen:test[socgen:name/text() = '$simulation']/./socgen:parameters/socgen:parameter/socgen:name"))
|
| 354 |
125 |
jt_eaton |
{
|
| 355 |
|
|
my($par_name) = $i_name ->findnodes('./text()')->to_literal ;
|
| 356 |
|
|
my($par_value) = $i_name ->findnodes('../socgen:value/text()')->to_literal ;
|
| 357 |
|
|
if ( $local_parameters{$par_name} eq '' ) { push @local_order , $par_name; }
|
| 358 |
|
|
$local_parameters{$par_name} = $par_value;
|
| 359 |
|
|
}
|
| 360 |
|
|
|
| 361 |
|
|
|
| 362 |
|
|
|
| 363 |
|
|
|
| 364 |
|
|
|
| 365 |
|
|
|
| 366 |
|
|
|
| 367 |
|
|
|
| 368 |
|
|
|
| 369 |
131 |
jt_eaton |
print SIM_PARM_FILE "// Testbench for $library $component $variant $configuration $simulation\n";
|
| 370 |
125 |
jt_eaton |
print SIM_PARM_FILE "`ifndef TIMESCALE \n";
|
| 371 |
|
|
print SIM_PARM_FILE "`define TIMESCALE 1ns/1ns \n";
|
| 372 |
|
|
print SIM_PARM_FILE "`endif \n";
|
| 373 |
|
|
print SIM_PARM_FILE " \n";
|
| 374 |
|
|
print SIM_PARM_FILE "`ifndef TIMEFORMAT \n";
|
| 375 |
|
|
print SIM_PARM_FILE "`define TIMEFORMAT \$timeformat(-6, 2, \" us\", 14); \n";
|
| 376 |
|
|
print SIM_PARM_FILE "`endif \n";
|
| 377 |
|
|
print SIM_PARM_FILE " \n";
|
| 378 |
|
|
print SIM_PARM_FILE "`timescale `TIMESCALE \n";
|
| 379 |
|
|
print SIM_PARM_FILE " \n";
|
| 380 |
|
|
print SIM_PARM_FILE "module TB(); \n";
|
| 381 |
|
|
print SIM_PARM_FILE " \n";
|
| 382 |
|
|
print SIM_PARM_FILE "initial \n";
|
| 383 |
|
|
print SIM_PARM_FILE "begin \n";
|
| 384 |
|
|
print SIM_PARM_FILE "`TIMEFORMAT \n";
|
| 385 |
|
|
print SIM_PARM_FILE "end \n";
|
| 386 |
|
|
print SIM_PARM_FILE " \n";
|
| 387 |
|
|
print SIM_PARM_FILE "`ifdef VCD \n";
|
| 388 |
|
|
print SIM_PARM_FILE "initial \n";
|
| 389 |
|
|
print SIM_PARM_FILE " begin \n";
|
| 390 |
|
|
print SIM_PARM_FILE "`include \"./dmp_define\" \n";
|
| 391 |
|
|
print SIM_PARM_FILE " end \n";
|
| 392 |
|
|
print SIM_PARM_FILE "`endif \n";
|
| 393 |
|
|
print SIM_PARM_FILE " reg clk,START; \n";
|
| 394 |
|
|
print SIM_PARM_FILE " wire FAIL,FINISH; \n";
|
| 395 |
|
|
print SIM_PARM_FILE " reg failed; \n";
|
| 396 |
|
|
print SIM_PARM_FILE " reg [31:0] failcount; \n";
|
| 397 |
|
|
print SIM_PARM_FILE "initial \n";
|
| 398 |
|
|
print SIM_PARM_FILE "begin \n";
|
| 399 |
|
|
print SIM_PARM_FILE "clk=0; \n";
|
| 400 |
|
|
print SIM_PARM_FILE "START=0; \n";
|
| 401 |
|
|
print SIM_PARM_FILE "@ (posedge clk); \n";
|
| 402 |
|
|
print SIM_PARM_FILE "@ (posedge clk); \n";
|
| 403 |
|
|
print SIM_PARM_FILE "@ (posedge clk) ; \n";
|
| 404 |
|
|
print SIM_PARM_FILE "START = 1; \n";
|
| 405 |
|
|
print SIM_PARM_FILE "end \n";
|
| 406 |
|
|
print SIM_PARM_FILE "always@(posedge clk) \n";
|
| 407 |
|
|
print SIM_PARM_FILE "if(START && FINISH) \n";
|
| 408 |
|
|
print SIM_PARM_FILE "begin \n";
|
| 409 |
|
|
print SIM_PARM_FILE " if(failed) \n";
|
| 410 |
|
|
print SIM_PARM_FILE " begin \n";
|
| 411 |
|
|
print SIM_PARM_FILE " \$display(\"%t SIM over: ERROR %d failures\",\$realtime ,failcount ); \n";
|
| 412 |
|
|
print SIM_PARM_FILE " end \n";
|
| 413 |
|
|
print SIM_PARM_FILE " else \n";
|
| 414 |
|
|
print SIM_PARM_FILE " begin \n";
|
| 415 |
|
|
print SIM_PARM_FILE " \$display(\"%t SIM over: PASSED\",\$realtime ); \n";
|
| 416 |
|
|
print SIM_PARM_FILE " end // else: !if(failed) \n";
|
| 417 |
|
|
print SIM_PARM_FILE "\$dumpflush; \n";
|
| 418 |
|
|
print SIM_PARM_FILE "\$finish; \n";
|
| 419 |
|
|
print SIM_PARM_FILE "end \n";
|
| 420 |
|
|
print SIM_PARM_FILE "always@(posedge clk or negedge START) \n";
|
| 421 |
|
|
print SIM_PARM_FILE "if(!START) \n";
|
| 422 |
|
|
print SIM_PARM_FILE "begin \n";
|
| 423 |
|
|
print SIM_PARM_FILE "failed <= 1\'b0; \n";
|
| 424 |
|
|
print SIM_PARM_FILE "failcount <= 32\'h0; \n";
|
| 425 |
|
|
print SIM_PARM_FILE "end \n";
|
| 426 |
|
|
print SIM_PARM_FILE "else \n";
|
| 427 |
|
|
print SIM_PARM_FILE "begin \n";
|
| 428 |
|
|
print SIM_PARM_FILE "if(FAIL) \n";
|
| 429 |
|
|
print SIM_PARM_FILE "begin \n";
|
| 430 |
|
|
print SIM_PARM_FILE "failed <= 1\'b1; \n";
|
| 431 |
|
|
print SIM_PARM_FILE "failcount <= failcount + 32\'h00000001; \n";
|
| 432 |
|
|
print SIM_PARM_FILE "end \n";
|
| 433 |
|
|
print SIM_PARM_FILE "else \n";
|
| 434 |
|
|
print SIM_PARM_FILE "begin \n";
|
| 435 |
|
|
print SIM_PARM_FILE "failed <= failed; \n";
|
| 436 |
|
|
print SIM_PARM_FILE "failcount <= failcount; \n";
|
| 437 |
|
|
print SIM_PARM_FILE "end \n";
|
| 438 |
|
|
print SIM_PARM_FILE "end \n";
|
| 439 |
|
|
|
| 440 |
|
|
print SIM_PARM_FILE "always \n";
|
| 441 |
|
|
print SIM_PARM_FILE " #($local_parameters{\"PERIOD\"}/2) clk = !clk; \n";
|
| 442 |
|
|
print SIM_PARM_FILE "`include \"./test_define\" \n";
|
| 443 |
|
|
|
| 444 |
|
|
|
| 445 |
126 |
jt_eaton |
|
| 446 |
125 |
jt_eaton |
print SIM_PARM_FILE " $module_name \n";
|
| 447 |
|
|
my $first =1;
|
| 448 |
|
|
foreach my $parameter_name (@local_order)
|
| 449 |
|
|
{
|
| 450 |
|
|
my($parameter_default) = $local_parameters{$parameter_name};
|
| 451 |
|
|
if($first)
|
| 452 |
|
|
{
|
| 453 |
|
|
print SIM_PARM_FILE " #( .${parameter_name}(${parameter_default})";
|
| 454 |
|
|
$first = 0;
|
| 455 |
|
|
}
|
| 456 |
|
|
else
|
| 457 |
|
|
{
|
| 458 |
|
|
print SIM_PARM_FILE ",\n .${parameter_name}(${parameter_default})";
|
| 459 |
|
|
}
|
| 460 |
|
|
}
|
| 461 |
134 |
jt_eaton |
print SIM_PARM_FILE ") \n test \n (.clk(clk),.START(START),.FAIL(FAIL),.FINISH(FINISH)); \n\n\n\n";
|
| 462 |
125 |
jt_eaton |
print SIM_PARM_FILE "task automatic next; \n";
|
| 463 |
|
|
print SIM_PARM_FILE " input [31:0] num; \n";
|
| 464 |
|
|
print SIM_PARM_FILE " repeat (num) @ (posedge clk); \n";
|
| 465 |
|
|
print SIM_PARM_FILE "endtask \n";
|
| 466 |
|
|
print SIM_PARM_FILE " \n";
|
| 467 |
|
|
print SIM_PARM_FILE " \n";
|
| 468 |
|
|
print SIM_PARM_FILE "initial \n";
|
| 469 |
|
|
print SIM_PARM_FILE " begin \n";
|
| 470 |
|
|
print SIM_PARM_FILE " next($local_parameters{\"TIMEOUT\"}); \n";
|
| 471 |
|
|
print SIM_PARM_FILE " \$display(\"%t Sim over :ERROR TIMEOUT\",\$realtime ); \n";
|
| 472 |
|
|
print SIM_PARM_FILE " @ (posedge clk) \n";
|
| 473 |
|
|
print SIM_PARM_FILE " \$dumpflush; \n";
|
| 474 |
|
|
print SIM_PARM_FILE " \$finish; \n";
|
| 475 |
|
|
print SIM_PARM_FILE " end \n";
|
| 476 |
|
|
print SIM_PARM_FILE " \n";
|
| 477 |
|
|
|
| 478 |
|
|
|
| 479 |
|
|
|
| 480 |
|
|
|
| 481 |
|
|
|
| 482 |
|
|
|
| 483 |
|
|
print SIM_PARM_FILE "endmodule \n";
|
| 484 |
|
|
|
| 485 |
|
|
|
| 486 |
|
|
|
| 487 |
|
|
|
| 488 |
|
|
|
| 489 |
|
|
}
|
| 490 |
|
|
|
| 491 |
|
|
|
| 492 |
|
|
|
| 493 |
|
|
|
| 494 |
|
|
|
| 495 |
|
|
|