Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | #!/usr/bin/perl |
2 | ################################################################################ | |
3 | # OpenSPARC T2 build/regression script | |
4 | ################################################################################ | |
5 | # | |
6 | # %sims -help | |
7 | # OR | |
8 | # %sims -h | |
9 | # for help | |
10 | # | |
11 | # sims | |
12 | # | | |
13 | # | | |
14 | # | | |
15 | # +----------------+---------+--------+--------+--------+-----+-------+ | |
16 | # | | | | | | | | | |
17 | # | | | | | | | | | |
18 | # | | | | | | | | | |
19 | # | | | | | | | | | |
20 | # ncverilog ncverilog+sas vcs vcs+sas sas build run regression | |
21 | # | |
22 | # | |
23 | ################################################################################ | |
24 | ||
25 | use warnings; | |
26 | use strict; | |
27 | # use diagnostics; | |
28 | use Cwd; | |
29 | use Cwd 'chdir'; | |
30 | use File::Basename ; | |
31 | use File::Find ; | |
32 | use File::Spec ; | |
33 | use File::stat ; | |
34 | use Getopt::Long ; | |
35 | use TRELoad 'DiagList', 'Sims' => [':all'] ; | |
36 | use Fcntl ':flock' ; | |
37 | use Socket; | |
38 | use Digest::MD5 qw(md5); | |
39 | ||
40 | #define SYSTEMC_SUPPORT | |
41 | ||
42 | ################################################################################ | |
43 | # patch PWD just in case | |
44 | ################################################################################ | |
45 | ||
46 | $ENV{PWD} = Cwd::cwd () ; | |
47 | $| = 1 ; | |
48 | ||
49 | ################################################################################ | |
50 | # install signal handlers | |
51 | ################################################################################ | |
52 | ||
53 | $SIG{INT} = \&sighandler ; | |
54 | $SIG{TERM} = \&sighandler ; | |
55 | $SIG{QUIT} = \&sighandler ; | |
56 | $SIG{__DIE__} = \&sighandler ; | |
57 | ||
58 | ################################################################################ | |
59 | # declare all global variables {{{ | |
60 | ################################################################################ | |
61 | ||
62 | my $prg = $0 ; | |
63 | $prg =~ s/.*\/// ; | |
64 | my $version = $prg ; | |
65 | $prg =~ s/,.*// ; # name of this program | |
66 | $version =~ s/.*,// ; # tre version of script | |
67 | my $pid = $$ ; # process id of this job | |
68 | my $sas_pid = 0 ; # process id of simics run | |
69 | my $tcl_pid = 0 ; # process id of tcl_tap expect process | |
70 | my $opt_debug = 0 ; # debug flag | |
71 | my $user = $ENV{USER} ; # user name | |
72 | my $work_dir = undef ; # work directory | |
73 | my $launch_dir = $ENV{PWD}; # work directory | |
74 | my $home_dir = (exists $ENV{HOME}) ? $ENV{HOME} : "~"; | |
75 | my %opt = () ; # all command line arguments | |
76 | # + config file arguments are concatenated | |
77 | # and stored here | |
78 | my $orig_tre_search = $ENV{TRE_SEARCH} ; | |
79 | ||
80 | ## for ClearCase usage | |
81 | my $CLEARCASE_ROOT; | |
82 | my $CC_VIEW_NAME; | |
83 | my $CLEARTOOL = "/usr/atria/bin/cleartool"; | |
84 | my $PROJ_CSHRC = File::Spec->catfile( | |
85 | $home_dir, | |
86 | ".cshrc." . uc( $proj_vars{proj} ) | |
87 | ); | |
88 | if ( exists $ENV{CLEARCASE_ROOT} ) { | |
89 | $CLEARCASE_ROOT = $ENV{CLEARCASE_ROOT}; | |
90 | my @fields = split(/\//, $CLEARCASE_ROOT); | |
91 | $CC_VIEW_NAME = $fields[2]; | |
92 | } | |
93 | my $cc_dv_root ; | |
94 | my $pre_process_done = 0; | |
95 | my $cache_clean_time=24; | |
96 | my $sas_timer=10; | |
97 | #############################################################################}}} | |
98 | # configure Getopt::Long {{{ | |
99 | ################################################################################ | |
100 | ||
101 | # Getopt::Long::Configure ('debug') ; | |
102 | Getopt::Long::Configure ('prefix=-') ; | |
103 | Getopt::Long::Configure ('no_ignore_case') ; | |
104 | Getopt::Long::Configure ('permute') ; | |
105 | Getopt::Long::Configure ('pass_through') ; | |
106 | Getopt::Long::Configure ('no_auto_abbrev') ; | |
107 | ||
108 | #############################################################################}}} | |
109 | # declare hash to hold command line arguments + config arguments {{{ | |
110 | ################################################################################ | |
111 | ||
112 | %opt = ( | |
113 | 'alias' => "", | |
114 | 'asm_diag_name' => "", | |
115 | 'asm_diag_path' => "", | |
116 | 'asm_diag_root' => [], | |
117 | 'auditr_args' => [], | |
118 | 'build' => 1, | |
119 | 'cc_dv_root' => "", | |
120 | 'cdms_rel_name' => "", | |
121 | 'clearcase' => 0, | |
122 | 'config_rtl' => [], | |
123 | 'config_cpp_args' => [], | |
124 | 'debug' => \$opt_debug, | |
125 | 'debussy' => 0, | |
126 | 'dftvert' => 0, | |
127 | 'diag_pl_args' => [], | |
128 | 'diaglist' => "", | |
129 | 'diaglist_cpp_args' => [], | |
130 | 'diff_cdms_rel' => 0, | |
131 | 'diff_cdms_curr' => 0, | |
132 | 'drmlog' => 1, | |
133 | 'drmlog_name' => "dream.log", | |
134 | 'drmcommand_name' => "drm_command", | |
135 | 'drmconstraints_name' => "drm_constraints", | |
136 | 'drm_constraints_file' => "", | |
137 | 'drm_cpufreq' => "", | |
138 | 'drm_disk' => "", | |
139 | 'drm_freeprocessor' => "1.0", | |
140 | 'drm_freeram' => "1000", | |
141 | 'drm_freeswap' => "1000", | |
142 | 'drm_license' => "[vcs=1,vera=1]", | |
143 | 'drm_priority' => "", | |
144 | 'drm_project' => $proj_vars{proj}, | |
145 | 'drm_totprocessor' => "", | |
146 | 'drm_type' => "vcs", | |
147 | 'drm_on' => 0, | |
148 | 'drm_osver' => "", | |
149 | 'drm_window' => "", | |
150 | 'dv_root' => "", | |
151 | 'efc' => 0, | |
152 | 'efc_args' => [], | |
153 | 'efuse_image_name' => "", | |
154 | 'efuse_image_path' => "", | |
155 | 'efuse_image_root' => [], | |
156 | 'env_base' => "", | |
157 | 'fast_boot' => 0, | |
158 | 'finish_mask' => "", | |
159 | 'flist' => [], | |
160 | 'fsdb2vcd' => 0, | |
161 | 'fsdbfile' => "", | |
162 | 'fsdbDumplimit' => "", | |
163 | 'fsdb_glitch' => 0, | |
164 | 'graft_flist' => "", | |
165 | 'group' => [], | |
166 | 'group_name' => "", | |
167 | 'gzip' => 1, | |
168 | 'h' => 0, | |
169 | 'hcs_build' => 0, | |
170 | 'hcs_build_args' => [], | |
171 | 'hcs_run' => 0, | |
172 | 'hcs_run_args' => [], | |
173 | 'hcs_drm_tokens' => 1, | |
174 | 'axis_build' => 0, | |
175 | 'axis_build_args' => [], | |
176 | 'axis_run' => 0, | |
177 | 'axis_run_args' => [], | |
178 | 'help' => 0, | |
179 | 'image_diag_name' => "", | |
180 | 'image_diag_path' => "", | |
181 | 'image_diag_root' => [], | |
182 | 'indrm' => -1, | |
183 | 'max_cycle' => 0, | |
184 | 'midas_args' => [], | |
185 | 'midas_only' => 0, | |
186 | 'midas_use_tgseed' => 0, | |
187 | 'model_dir' => "", | |
188 | 'ntb_lib' => 0, | |
189 | 'overwrite' => 0, | |
190 | 'palladium_build' => 0, | |
191 | 'palladium_build_args' => [], | |
192 | 'palladium_run' => 0, | |
193 | 'palladium_run_args' => [], | |
194 | 'pal_use_tgseed' => 0, | |
195 | 'pci' => 0, | |
196 | 'pci_args' => [], | |
197 | 'pci_diag_name' => "", | |
198 | 'pci_diag_path' => "", | |
199 | 'pci_diag_root' => [], | |
200 | 'post_process_cmd' => [], | |
201 | 'pre_process_cmd' => [], | |
202 | 'reg_count' => 0, | |
203 | 'regress' => 0, | |
204 | 'regress_date' => "", | |
205 | 'regress_id' => "", | |
206 | 'regress_time' => "", | |
207 | 'report' => 0, | |
208 | 'rerun' => 0, | |
209 | 'result_dir' => "", | |
210 | 'rtl_timeout' => 5000, | |
211 | 'run_diag_pl' => 1, | |
212 | 'sas' => 0, | |
213 | 'saslog' => 1, | |
214 | 'sas_run_args' => [], | |
215 | 'sims_config' => "", | |
216 | 'sims_env' => [], | |
217 | 'simslog' => 1, | |
218 | 'simslog_name' => "sims.log", | |
219 | 'sjm' => 0, | |
220 | 'sjm_args' => [], | |
221 | 'sjm_diag_name' => "", | |
222 | 'sjm_diag_path' => "", | |
223 | 'sjm_diag_root' => [], | |
224 | 'spis_diag_name' => "", | |
225 | 'spis_diag_path' => "", | |
226 | 'spis_diag_root' => [], | |
227 | 'start_dump' => 0, | |
228 | 'stop_dump' => 0, | |
229 | 'stub_mask' => "", | |
230 | 'sunv_args' => [], | |
231 | 'sunv_nonprim_list' => "", | |
232 | 'sunv_run' => 0, | |
233 | 'sunv_use_nonprim' => 0, | |
234 | 'sys' => "", | |
235 | #ifdef SYSTEMC_SUPPORT | |
236 | 'sysc_build' => 0, | |
237 | 'syscan_build_args' => [], | |
238 | #endif | |
239 | 'tap_diag_name' => "", | |
240 | 'tap_diag_path' => "", | |
241 | 'tap_diag_root' => [], | |
242 | 'tcl_tap' => 0, | |
243 | 'tcl_tap_diag' => "", | |
244 | 'tg_seed' => -1, | |
245 | 'tomatillo' => 0, | |
246 | 'tpt_diag_name' => "", | |
247 | 'tpt_diag_path' => "", | |
248 | 'tpt_diag_root' => [], | |
249 | 'use_auditr' => 0, | |
250 | 'use_cdms_iver' => 1, | |
251 | 'use_config' => 1, | |
252 | 'use_denalirc' => "", | |
253 | 'use_iver' => "", | |
254 | 'use_sims_iver' => 1, | |
255 | 'vcd' => 0, | |
256 | 'vcdfile' => "", | |
257 | 'sim' => "vcs", # default simulator is assumed to be VCS from synopsys | |
258 | 'ncv_build'=>0, | |
259 | 'ncv_build_args'=>[], | |
260 | 'ncv_clean'=>0, | |
261 | 'ncv_run'=>0, | |
262 | 'ncv_run_args'=>[], | |
263 | 'vcs_build' => 0, | |
264 | 'vcs_build_args' => [], | |
265 | 'vcs_clean' => 0, | |
266 | 'vcs_cm_args' => "", | |
267 | 'vcs_cm_cond' => "", | |
268 | 'vcs_cm_config' => "", | |
269 | 'vcs_cm_fsmcfg' => "", | |
270 | 'vcs_cm_merge' => 0, | |
271 | 'vcs_cm_name' => "cm_data", | |
272 | 'vcs_finish' => 0, | |
273 | 'vcs_full64' => 0, | |
274 | 'vcs_prof' => 0, | |
275 | 'model_rel_name' => "", | |
276 | 'vcs_run' => 0, | |
277 | 'vcs_run_args' => [], | |
278 | 'vcs_use_cm' => 0, | |
279 | 'vcs_use_cli' => 0, | |
280 | 'vcs_use_ucli' => 0, | |
281 | 'vcs_use_fsdb' => 1, | |
282 | 'vcs_use_initreg' => 0, | |
283 | 'vcs_use_ntb' => 0, | |
284 | 'vcs_use_rad' => 0, | |
285 | 'vcs_use_radincr' => 0, | |
286 | 'vcs_use_sdf' => 0, | |
287 | 'vcs_use_vcsd' => 1, | |
288 | 'vcs_use_vera' => 0, | |
289 | 'vera_build' => -1, | |
290 | 'vera_build_args' => [], | |
291 | 'vera_clean' => 0, | |
292 | 'vera_config_name' => "", | |
293 | 'vera_config_path' => "", | |
294 | 'vera_config_root' => [], | |
295 | 'vera_cov_obj' => [], | |
296 | 'vera_diag_args' => [], | |
297 | 'vera_dummy_diag' => "", | |
298 | 'vera_pal_diag_args' => [], | |
299 | 'vera_diag_name' => "", | |
300 | 'vera_diag_path' => "", | |
301 | 'vera_diag_root' => [], | |
302 | 'vera_gmake' => 1, | |
303 | 'vera_proj_args' => [], | |
304 | 'vera_run' => 1, | |
305 | 'vera_vcon_file' => "", | |
306 | 'version' => 0, | |
307 | 'vfile' => [], | |
308 | 'vlint_args' => [], | |
309 | 'vlint_run' => 0, | |
310 | 'vlint_top' => "", | |
311 | 'illust_run' => 0, | |
312 | 'illust_args' => [], | |
313 | 'verix_args' => [], | |
314 | 'verix_libs' => [], | |
315 | 'verix_run' => 0, | |
316 | 'verix_top' => "", | |
317 | 'wait_cycle_to_kill' => 0, | |
318 | 'zeroIn_build' => 0, | |
319 | 'zeroIn_dbg_args' => [], | |
320 | 'zeroIn_checklist' => 0, | |
321 | 'zeroInSearch_build' => 0, | |
322 | 'zeroIn_build_args' => [], | |
323 | 'sim_q_command' => "/bin/sh", | |
324 | 'parallel' => 0, | |
325 | 'exe_dir' => "", | |
326 | 'cache' => 0, | |
327 | ); | |
328 | ||
329 | #############################################################################}}} | |
330 | # parse initial command line options {{{ | |
331 | ################################################################################ | |
332 | ||
333 | GetOptions (\%opt, | |
334 | 'h!', | |
335 | 'help!', | |
336 | 'version!', | |
337 | 'use_iver=s', | |
338 | ) ; | |
339 | ||
340 | #############################################################################}}} | |
341 | # relaunch sims with a new iver {{{ | |
342 | ################################################################################ | |
343 | ||
344 | if ($opt{sim} eq 'ncv') { | |
345 | foreach (@ARGV) { | |
346 | if (m/-vcs_build/) { s/-vcs_build/-ncv_build/; } | |
347 | elsif (m/-vcs_run/) { s/-vcs_run/-ncv_run/; } | |
348 | } | |
349 | } | |
350 | my @argv_copy = @ARGV ; # copy of original command line arguments | |
351 | ||
352 | if ($opt{use_iver} ne "") { | |
353 | ||
354 | die ("DIE. Could not read specified iver \"file\" $opt{use_iver}") if (! -r $opt{use_iver}) ; | |
355 | ||
356 | $ENV{TRE_SEARCH} = "$opt{use_iver} $ENV{TRE_SEARCH}" ; | |
357 | ||
358 | my $cmd ; | |
359 | $cmd .= "$prg " ; | |
360 | $cmd .= "-h " if ($opt{h}) ; | |
361 | $cmd .= "-help " if ($opt{help}) ; | |
362 | $cmd .= "-version " if ($opt{version}) ; | |
363 | $cmd .= "-cache = 1"; | |
364 | ||
365 | foreach my $x (@ARGV) | |
366 | { | |
367 | ($x =~ s/(-.*?)=(.*)/$1=\"$2\"/) if (($x =~ /\s/) and ($x !~ /-.*?="/)) ; | |
368 | ($x =~ s/"/\\"/go) if ($opt{use_auditr}); # Escape quote if using auditr " | |
369 | $cmd .= "$x " ; | |
370 | } | |
371 | ||
372 | # Don't use cdms_iver if using use_iver .. | |
373 | $cmd .= "-nouse_cdms_iver "; | |
374 | system ($cmd) ; | |
375 | exit (0) ; | |
376 | } | |
377 | ||
378 | #############################################################################}}} | |
379 | # print out version {{{ | |
380 | ################################################################################ | |
381 | ||
382 | if ($opt{version}) { | |
383 | print "$prg version: $version\n"; | |
384 | exit (0); | |
385 | } | |
386 | ||
387 | #############################################################################}}} | |
388 | # print out help {{{ | |
389 | ################################################################################ | |
390 | ||
391 | if ($opt{help} or $opt{h}) { | |
392 | # system ("perldoc $0") ; | |
393 | &usage; | |
394 | exit (0); | |
395 | } | |
396 | ||
397 | #############################################################################}}} | |
398 | # rerun a diag {{{ | |
399 | ################################################################################ | |
400 | ||
401 | GetOptions (\%opt, | |
402 | 'overwrite!', | |
403 | 'rerun!', | |
404 | 'dv_root=s', | |
405 | 'use_sims_iver!', | |
406 | 'use_cdms_iver!', | |
407 | ) ; | |
408 | ||
409 | if ($opt{rerun}) { | |
410 | &rerun () ; | |
411 | exit (0) ; | |
412 | } | |
413 | ||
414 | ||
415 | #############################################################################}}} | |
416 | # define $dv_root {{{ | |
417 | ################################################################################ | |
418 | ||
419 | my $dv_root ; | |
420 | ||
421 | if ($opt{dv_root} ne "") { $dv_root = $opt{dv_root} ; } | |
422 | elsif (defined $ENV{DV_ROOT}) { $dv_root = $ENV{DV_ROOT} ; } | |
423 | else { die ("DIE. could not initialize dv_root") ; } | |
424 | ||
425 | $ENV{DV_ROOT} = $dv_root; | |
426 | ||
427 | #############################################################################}}} | |
428 | # use a set of tools frozen under cdms {{{ | |
429 | ################################################################################ | |
430 | ||
431 | # DRP 3/22/07 - comment out the following 2 lines to disable using the sims.iver/tver files | |
432 | ||
433 | # my $iver_file = "$dv_root/verif/env/config/tre/sims.iver" ; | |
434 | # $ENV{TRE_SEARCH} = $iver_file if ((-f $iver_file) and $opt{use_cdms_iver}) ; | |
435 | ||
436 | #############################################################################}}} | |
437 | # if this diag must be run in DReAM send ourselves back out {{{ | |
438 | ################################################################################ | |
439 | ||
440 | GetOptions (\%opt, | |
441 | 'indrm!', | |
442 | 'interactive!', | |
443 | ) ; | |
444 | ||
445 | if (($opt{indrm} == 1) or $opt{interactive}) | |
446 | { | |
447 | run_indrm (\@argv_copy, []) ; | |
448 | exit (0) ; | |
449 | } | |
450 | ||
451 | ||
452 | #############################################################################}}} | |
453 | # parse second set of command line options {{{ | |
454 | ################################################################################ | |
455 | ||
456 | GetOptions (\%opt, | |
457 | 'alias=s', | |
458 | 'cc_dv_root=s', | |
459 | 'clearcase!', | |
460 | 'config_cpp_args=s@', | |
461 | 'debug' => \$opt_debug, | |
462 | 'diaglist=s', | |
463 | 'diaglist_cpp_args=s@', | |
464 | 'group=s@', | |
465 | 'model_dir=s', | |
466 | 'regress!', | |
467 | 'regress_id=s', | |
468 | 'report!', | |
469 | 'result_dir=s', | |
470 | 'sim_q_command=s', | |
471 | 'sims_config=s', | |
472 | ) ; | |
473 | ||
474 | ||
475 | #############################################################################}}} | |
476 | # define $cc_dv_root {{{ | |
477 | ################################################################################ | |
478 | ||
479 | if ( $opt{clearcase} ) { | |
480 | if ($opt{cc_dv_root} ne "") { $cc_dv_root = $opt{cc_dv_root} ; } | |
481 | elsif (defined $ENV{CC_DV_ROOT}) { $cc_dv_root = $ENV{CC_DV_ROOT} ; } | |
482 | elsif (defined $proj_vars{cc_dv_root}) { | |
483 | $cc_dv_root = $proj_vars{cc_dv_root}; } | |
484 | else { die ("DIE. could not initialize cc_dv_root") ; } | |
485 | } | |
486 | ||
487 | #############################################################################}}} | |
488 | # define $result_dir {{{ | |
489 | ################################################################################ | |
490 | ||
491 | my $result_dir ; | |
492 | ||
493 | if ($opt{result_dir} ne "") { $result_dir = $opt{result_dir} ; } | |
494 | else { if (exists $ENV{PWD}) { $result_dir = $ENV{PWD} ; } } | |
495 | ||
496 | #############################################################################}}} | |
497 | # define $sims_config {{{ | |
498 | ################################################################################ | |
499 | ||
500 | GetOptions (\%opt, 'sys=s') ; | |
501 | if ($opt{sys} ne "") { | |
502 | push (@ARGV, "-sys=$opt{sys}"); # Restore argv | |
503 | } | |
504 | my $sims_config ; | |
505 | ||
506 | if ($opt{sims_config} ne "") { | |
507 | $sims_config = $opt{sims_config} ; | |
508 | } elsif ($opt{sys} ne "" && -r "$dv_root/$proj_vars{sims_config}/$opt{sys}.config") { | |
509 | $sims_config = "$dv_root/$proj_vars{sims_config}/$opt{sys}.config"; | |
510 | } else { | |
511 | $sims_config = "$dv_root/$proj_vars{sims_config}/sims.config" ; | |
512 | } | |
513 | ||
514 | #############################################################################}}} | |
515 | # define $model_dir {{{ | |
516 | ################################################################################ | |
517 | ||
518 | my $model_dir ; | |
519 | ||
520 | if ($opt{model_dir} ne "") { $model_dir = $opt{model_dir} ; } | |
521 | elsif (defined $ENV{MODEL_DIR}) { $model_dir = $ENV{MODEL_DIR}; } | |
522 | else { die ("DIE. could not initialize model_dir") ; } | |
523 | ||
524 | $ENV{MODEL_DIR} = $model_dir ; | |
525 | ||
526 | #############################################################################}}} | |
527 | # define $diaglist {{{ | |
528 | ################################################################################ | |
529 | ||
530 | my $diaglist ; | |
531 | if ($opt{diaglist} ne "") | |
532 | { | |
533 | $diaglist = $opt{diaglist} ; | |
534 | ||
535 | if (!($diaglist =~ /^\//)) | |
536 | { | |
537 | $diaglist = "$ENV{PWD}/$diaglist" ; | |
538 | } | |
539 | } | |
540 | elsif ($opt{sys} ne "" && | |
541 | -r "$dv_root/$proj_vars{diaglist}/$opt{sys}.diaglist") { | |
542 | $diaglist = "$dv_root/$proj_vars{diaglist}/$opt{sys}.diaglist" ; | |
543 | } | |
544 | else | |
545 | { | |
546 | $diaglist = "$dv_root/$proj_vars{diaglist}/master_diaglist" ; | |
547 | } | |
548 | ||
549 | #############################################################################}}} | |
550 | # get diag options from diaglist {{{ | |
551 | ################################################################################ | |
552 | ||
553 | if (($#{$opt{group}} != -1) and ($opt{alias} ne "")) | |
554 | { | |
555 | &get_opt_from_diaglist () ; | |
556 | } | |
557 | ||
558 | ||
559 | #############################################################################}}} | |
560 | # Regular run, get opt{sys} {{{ | |
561 | ################################################################################ | |
562 | ||
563 | GetOptions (\%opt, | |
564 | 'sys=s', | |
565 | ) ; | |
566 | ||
567 | #############################################################################}}} | |
568 | # Header and Logs {{{ | |
569 | ################################################################################ | |
570 | ||
571 | &redirect () ; | |
572 | &print_header () ; | |
573 | ||
574 | #############################################################################}}} | |
575 | # if this is not a regression a sys must be defined {{{ | |
576 | ################################################################################ | |
577 | ||
578 | die ("DIE. -sys argument not defined") if ($opt{sys} eq "") ; | |
579 | &parse_args ($opt{sys}, 1) ; | |
580 | print "$prg: group_name = $opt{group_name}\n" if ($opt{regress}) ; | |
581 | print "$prg: regress_date = $opt{regress_date}\n" if ($opt{regress}) ; | |
582 | print "$prg: regress_time = $opt{regress_time}\n" if ($opt{regress}) ; | |
583 | ||
584 | #############################################################################}}} | |
585 | # first check that the model and model_rel_name are defined {{{ | |
586 | ################################################################################ | |
587 | ||
588 | my $model_path ; my $model_def_name = "rel-0.1" ; | |
589 | ||
590 | if ($opt{model_rel_name} eq "") { $model_path = "$model_dir/$opt{sys}/$model_def_name" ; } | |
591 | else { $model_path = "$model_dir/$opt{sys}/$opt{model_rel_name}" ; } | |
592 | ||
593 | if ( $opt{vera_build} ) { $opt{vera_clean}=1; } | |
594 | if ( $opt{vcs_build} ) { $opt{vcs_clean}=1; } | |
595 | elsif ( $opt{ncv_build} ) { $opt{ncv_clean}=1; } | |
596 | ||
597 | if ( $opt{vcs_run} or $opt{ncv_run} ) | |
598 | { # do not build by default | |
599 | $opt{build}=0; | |
600 | $opt{vera_build}=0; $opt{vera_clean}=0; | |
601 | if ($opt{sim} eq 'ncv') | |
602 | { | |
603 | $opt{ncv_build}=0; $opt{ncv_clean}=0; | |
604 | } | |
605 | elsif ($opt{sim} eq 'vcs') | |
606 | { | |
607 | $opt{vcs_build}=0; $opt{vcs_clean}=0; | |
608 | } | |
609 | } | |
610 | if ( $opt{build} ) | |
611 | { | |
612 | $opt{vera_clean}=1; | |
613 | if ( ($opt{sys} =~ m/fpga/)) { ###vera not required for fpga models | |
614 | $opt{vera_build}=0; | |
615 | } | |
616 | else { | |
617 | $opt{vera_build}=1; | |
618 | } | |
619 | if ($opt{sim} eq 'ncv') | |
620 | { | |
621 | $opt{ncv_clean}=1; | |
622 | $opt{ncv_build}=1; | |
623 | } | |
624 | elsif ($opt{sim} eq 'vcs') | |
625 | { | |
626 | $opt{vcs_clean}=1; | |
627 | $opt{vcs_build}=1; | |
628 | } | |
629 | } | |
630 | # push @{$opt{config_cpp_args}},"-DT2"; | |
631 | my $uname=`uname -s`;chomp $uname; | |
632 | if ($uname eq "Linux") { push @{$opt{config_cpp_args}},"-DLINUX"; } | |
633 | ||
634 | if ( ($opt{sys} eq "fc1") or ($opt{sys} eq "fc8") ) | |
635 | { | |
636 | # if ( !(grep {$_ eq '-DFC_NO_NIU_T2'} @{$opt{config_cpp_args}}) ) | |
637 | # { | |
638 | # if ($uname ne "SunOS") { | |
639 | # print "$prg: >>>>> The option you are trying to run is NOT presently supported!\n"; exit(0); | |
640 | # } | |
641 | # } | |
642 | } | |
643 | ||
644 | #############################################################################}}} | |
645 | # run a regression instead of a single diag {{{ | |
646 | ################################################################################ | |
647 | ||
648 | if (scalar @{$opt{group}} != 0) | |
649 | { | |
650 | $opt{report}=1; $opt{gzip}=0; | |
651 | ®ress(); | |
652 | exit (0) ; | |
653 | } | |
654 | ||
655 | #############################################################################}}} | |
656 | # create the model area if necessary {{{ | |
657 | ################################################################################ | |
658 | ||
659 | &create_model_path () if (($opt{zeroIn_build}) or | |
660 | ($opt{zeroInSearch_build}) or | |
661 | ($opt{zeroIn_checklist}) or | |
662 | ($opt{sunv_run}) or | |
663 | ($opt{vera_build}) or | |
664 | ($opt{vcs_build}) or | |
665 | ($opt{ncv_build}) or | |
666 | ($opt{hcs_build}) or | |
667 | ($opt{axis_build})or | |
668 | ($opt{palladium_build})) ; | |
669 | ||
670 | #############################################################################}}} | |
671 | # run sunv {{{ | |
672 | ################################################################################ | |
673 | ||
674 | &sunv_run () if ($opt{sunv_run}) ; | |
675 | ||
676 | #############################################################################}}} | |
677 | # build the vera/ntb testbench {{{ | |
678 | ################################################################################ | |
679 | ||
680 | &vera_build () if (( (($opt{vcs_build}) and ($opt{vera_build} == -1)) or | |
681 | (($opt{ncv_build}) and ($opt{vera_build} == -1)) or | |
682 | ($opt{vera_build} == 1)) and | |
683 | (! $opt{dftvert})) ; | |
684 | ||
685 | ##&vera_build () if (($opt{vera_build} == 1) and | |
686 | ## (! $opt{dftvert})) ; | |
687 | ||
688 | #############################################################################}}} | |
689 | # do some pre building stuff - generate flist and graft model {{{ | |
690 | ################################################################################ | |
691 | ||
692 | &pre_build () if (($opt{vlint_run}) or ($opt{vcs_build}) or ($opt{ncv_build}) or ($opt{hcs_build}) | |
693 | or ($opt{verix_run}) or $opt{axis_build} or | |
694 | $opt{palladium_build}) ; | |
695 | ||
696 | #############################################################################}}} | |
697 | # compile zeroIn {{{ | |
698 | ################################################################################ | |
699 | ||
700 | &zeroIn_build () if (($opt {zeroIn_build}) or ($opt {zeroInSearch_build}) or ($opt {zeroIn_checklist})) ; | |
701 | ||
702 | #############################################################################}}} | |
703 | # run vlint on the model {{{ | |
704 | ################################################################################ | |
705 | ||
706 | &vlint_run () if ($opt{vlint_run}) ; | |
707 | ||
708 | #############################################################################}}} | |
709 | # run verix on the model {{{ | |
710 | ################################################################################ | |
711 | ||
712 | &verix_run () if ($opt{verix_run}) ; | |
713 | ||
714 | #############################################################################}}} | |
715 | # build the ncverilog/vcs model {{{ | |
716 | ################################################################################ | |
717 | ||
718 | &vcs_build () if ($opt{vcs_build}); | |
719 | ||
720 | &ncv_build () if ($opt{ncv_build}); | |
721 | ||
722 | ||
723 | #############################################################################}}} | |
724 | # assemble .s diag {{{ | |
725 | ################################################################################ | |
726 | ||
727 | &assemble_diag () if ($opt{asm_diag_name} ne "") ; | |
728 | ||
729 | #############################################################################}}} | |
730 | # assemble .tap diag {{{ | |
731 | ################################################################################ | |
732 | ||
733 | &assemble_tap_diag () if ($opt{tap_diag_name} ne "") ; | |
734 | ||
735 | #############################################################################}}} | |
736 | # copy .image diag {{{ | |
737 | ################################################################################ | |
738 | ||
739 | ©_image () if ($opt{image_diag_name} ne "") ; | |
740 | ||
741 | #############################################################################}}} | |
742 | # copy efuse image {{{ | |
743 | ################################################################################ | |
744 | ||
745 | ©_efuse_image () if ($opt{efuse_image_name} ne "" and | |
746 | ($opt{vcs_run} or | |
747 | $opt{ncv_run} or $opt{hcs_run} or $opt{axis_run} or | |
748 | $opt{palladium_run})) ; | |
749 | ||
750 | #############################################################################}}} | |
751 | # generate an efuse image {{{ | |
752 | ################################################################################ | |
753 | ||
754 | &generate_efuse_image () if ($opt{efc}) ; | |
755 | ||
756 | #############################################################################}}} | |
757 | # partition test mem image for fpga model memory configuration {{{ | |
758 | ################################################################################ | |
759 | ||
760 | if ( ($opt{sys} =~ m/fpga/)) | |
761 | { | |
762 | ||
763 | my $uname=`uname -s`;chomp $uname; | |
764 | if ($uname eq "Linux") { | |
765 | system("$dv_root/tools/fpga/Linux/partition_mem") ; | |
766 | } | |
767 | else { | |
768 | system("$dv_root/tools/fpga/partition_mem") ; | |
769 | } | |
770 | } | |
771 | ||
772 | #############################################################################}}} | |
773 | # copy .tpt diag {{{ | |
774 | ################################################################################ | |
775 | ||
776 | ©_tpt () if ($opt{tpt_diag_name} ne "") ; | |
777 | ||
778 | #############################################################################}}} | |
779 | # compile .vr config {{{ | |
780 | ################################################################################ | |
781 | ||
782 | &compile_vera_config () if ($opt{vera_config_name} ne "") ; | |
783 | ||
784 | #############################################################################}}} | |
785 | # compile .vr diag when -dftvert is also present {{{ | |
786 | ################################################################################ | |
787 | ||
788 | &compile_dftvert_diag () if (($opt{vera_diag_name} ne "") and | |
789 | ($opt{dftvert})) ; | |
790 | ||
791 | #############################################################################}}} | |
792 | # compile .vr diag {{{ | |
793 | ################################################################################ | |
794 | ||
795 | ||
796 | &compile_vera_diag () if (($opt{vera_diag_name} ne "" or | |
797 | $opt{vera_dummy_diag} ne "") and | |
798 | !$opt{dftvert}) ; | |
799 | ||
800 | #############################################################################}}} | |
801 | # generate an sjm diag {{{ | |
802 | ################################################################################ | |
803 | ||
804 | &generate_sjm_diag () if ($opt{sjm} or $opt{tomatillo} or ($opt{sjm_diag_name} ne "")) ; | |
805 | ||
806 | #############################################################################}}} | |
807 | # generate a pci diag {{{ | |
808 | ################################################################################ | |
809 | ||
810 | &generate_pci_diag () if ($opt{pci} or $opt{tomatillo} or ($opt{pci_diag_name} ne "")) ; | |
811 | ||
812 | #############################################################################}}} | |
813 | # launch sas/simics {{{ | |
814 | ################################################################################ | |
815 | ||
816 | &sas_run () if ($opt{sas}) ; | |
817 | ||
818 | #############################################################################}}} | |
819 | # launch tcl_tap {{{ | |
820 | ################################################################################ | |
821 | ||
822 | if ( $opt{tcl_tap} and $opt{vcs_run} ){ &tcl_tap_run (); } | |
823 | ||
824 | ||
825 | #############################################################################}}} | |
826 | # dram specific stuff {{{ | |
827 | ################################################################################ | |
828 | ||
829 | if ($opt{vcs_run} or $opt{ncv_run} or $opt{hcs_run} or $opt{axis_run} or $opt{palladium_run}) | |
830 | { | |
831 | my $file; | |
832 | if ($opt{use_denalirc} eq "") { | |
833 | $file = "$opt{env_base}/.denalirc" ; | |
834 | } else { | |
835 | $file = "$opt{use_denalirc}" ; | |
836 | die ("DIE. could not find \"$file\" for -use_denalirc") if (! -f $file); | |
837 | } | |
838 | ||
839 | if (-f $file) { | |
840 | `cp $file .denalirc` ; | |
841 | die ("DIE. could not copy $file to run area\n") if ($?) ; | |
842 | `chmod +w .denalirc` ; | |
843 | die ("DIE. could not change permission of .denalirc\n") if ($?) ; | |
844 | } | |
845 | } | |
846 | ||
847 | if (($opt{sys} eq "dram") and ($opt{vcs_run} or $opt{ncv_run} or $opt{hcs_run} or $opt{axis_run} or $opt{palladium_run})) | |
848 | { | |
849 | ||
850 | print("$prg: Add this to your config file instead: -pre_process_cmd=\"ln -s \$DV_ROOT/verif/env/whatever/mem.data .\"\n"); | |
851 | print("$prg: Remove the code in sims that does the bench specific copy!\n"); | |
852 | ||
853 | my @files = ("dram_config.doc", "mem.data", "mem1.data", "mem2.data") ; | |
854 | ||
855 | foreach my $file (@files) | |
856 | { | |
857 | die ("DIE. $opt{env_base}/$file not found") if (!(-f "$opt{env_base}/$file")) ; | |
858 | `cp $opt{env_base}/$file .` ; | |
859 | die ("DIE. could not copy $file to $ENV{PWD}\n") if ($?) ; | |
860 | `chmod +w $file` ; | |
861 | die ("DIE. could not change permission of $file\n") if ($?) ; | |
862 | } | |
863 | } | |
864 | ||
865 | #############################################################################}}} | |
866 | # launch ncsim/simv {{{ | |
867 | ################################################################################ | |
868 | ||
869 | &vcs_run () if ($opt{vcs_run}) ; | |
870 | ||
871 | &ncv_run () if ($opt{ncv_run}) ; | |
872 | ||
873 | ||
874 | #############################################################################}}} | |
875 | # run diag.pl if present {{{ | |
876 | ################################################################################ | |
877 | ||
878 | if ( -e "diag.pl" and | |
879 | ( $opt{vcs_run} or $opt{ncv_run} or $opt{hcs_run} or $opt{sas} or $opt{axis_run} or | |
880 | $opt{palladium_run}) and $opt{run_diag_pl} | |
881 | ) | |
882 | { | |
883 | my $diag_pl_args = join (" ", @{$opt{diag_pl_args}}) ; | |
884 | ||
885 | print "$prg: executing diag.pl $diag_pl_args\n"; | |
886 | ||
887 | my $waitstatus = call_program("perl diag.pl $diag_pl_args","diag_pl.log"); | |
888 | print ("$prg: Warning diag.pl run exited with error\n") if ($waitstatus) ; | |
889 | } | |
890 | ||
891 | #############################################################################}}} | |
892 | # post process the output {{{ | |
893 | ################################################################################ | |
894 | ||
895 | print "$prg: stop_time "; | |
896 | system ("date") ; | |
897 | ||
898 | exit (0); | |
899 | ||
900 | #############################################################################}}} | |
901 | # run simulation in dream {{{ | |
902 | ################################################################################ | |
903 | ||
904 | sub run_indrm | |
905 | { | |
906 | my $argv_ref = shift ; | |
907 | my $drm_opt_ref = shift ; | |
908 | my @argv_copy = @ARGV ; | |
909 | # Save global options because they get modified by drm_opt .. | |
910 | my %opt_copy = %{&deep_copy(\%opt)} ; | |
911 | ||
912 | unshift (@ARGV, @{$drm_opt_ref}) ; | |
913 | ||
914 | GetOptions (\%opt, | |
915 | 'auditr_args=s@', | |
916 | 'clearcase!', | |
917 | 'drmlog!', | |
918 | 'drmlog_name=s', | |
919 | 'drmcommand_name=s', | |
920 | 'drmconstraints_name=s', | |
921 | 'drm_constraints_file=s', | |
922 | 'drm_cpufreq=s', | |
923 | 'drm_disk=s', | |
924 | 'drm_freeram=s', | |
925 | 'drm_freeswap=s', | |
926 | 'drm_freeprocessor=s', | |
927 | 'drm_license=s', | |
928 | 'drm_on!', | |
929 | 'drm_osver=s', | |
930 | 'drm_project=s', | |
931 | 'drm_priority=s', | |
932 | 'drm_type=s', | |
933 | 'drm_totprocessor=s', | |
934 | 'drm_window=s', | |
935 | 'group=s', | |
936 | 'use_auditr!', | |
937 | 'sim_q_command=s', | |
938 | ) ; | |
939 | ||
940 | @ARGV = @argv_copy ; | |
941 | ||
942 | if ( $opt{clearcase} ) { | |
943 | if ($opt{cc_dv_root} ne "") { $cc_dv_root = $opt{cc_dv_root} ; } | |
944 | elsif (defined $ENV{CC_DV_ROOT}) { $cc_dv_root = $ENV{CC_DV_ROOT} ; } | |
945 | elsif ($opt{dv_root} ne "") { $cc_dv_root = $opt{dv_root}; } | |
946 | elsif (defined $proj_vars{cc_dv_root}) { | |
947 | $cc_dv_root = $proj_vars{cc_dv_root}; } | |
948 | else { die ("DIE. could not initialize cc_dv_root") ; } | |
949 | printf("sims: cc_dv_root is $cc_dv_root\n"); | |
950 | printf("sims: set to work with ClearCase view: $CC_VIEW_NAME\n"); | |
951 | } | |
952 | ||
953 | # create a dream constraint file | |
954 | ||
955 | if ($opt{drm_constraints_file} eq "") { | |
956 | ||
957 | # Add tharas license requirements | |
958 | if ($opt{hcs_build} || $opt{hcs_run}) { | |
959 | $opt{drm_license} =~ s/\]/,hcs=$opt{hcs_drm_tokens}]/; | |
960 | $opt{drm_type} = 'tharas' ; | |
961 | } | |
962 | ||
963 | if ($opt{vcs_use_ntb}) { | |
964 | $opt{drm_license} =~ s/,*vera=1//o; # No Vera license required .. | |
965 | } | |
966 | ||
967 | open (DRMCONST, "> $opt{drmconstraints_name}") or die ("DIE. Could not open DReAM constraints file") ; | |
968 | print DRMCONST "project=$opt{drm_project}\n" if ($opt{drm_project} ne "") ; | |
969 | print DRMCONST "type=$opt{drm_type}\n" if ($opt{drm_type} ne "") ; | |
970 | print DRMCONST "cpufreq=$opt{drm_cpufreq}\n" if ($opt{drm_cpufreq} ne "") ; | |
971 | print DRMCONST "disk=$opt{drm_disk}\n" if ($opt{drm_disk} ne "") ; | |
972 | print DRMCONST "freeram=$opt{drm_freeram}\n" if ($opt{drm_freeram} ne "") ; | |
973 | print DRMCONST "freeswap=$opt{drm_freeswap}\n" if ($opt{drm_freeswap} ne "") ; | |
974 | print DRMCONST "freeprocessor=$opt{drm_freeprocessor}\n" if ($opt{drm_freeprocessor} ne "") ; | |
975 | print DRMCONST "totprocessor=$opt{drm_totprocessor}\n" if ($opt{drm_totprocessor} ne "") ; | |
976 | print DRMCONST "priority=$opt{drm_priority}\n" if ($opt{drm_priority} ne "") ; | |
977 | # print DRMCONST "priority=-900\n" if ($opt{group} ne "") ; | |
978 | print DRMCONST "license=$opt{drm_license}\n" if ($opt{drm_license} ne "") ; | |
979 | print DRMCONST "window=$opt{drm_window}\n" if ($opt{drm_window} ne "") ; | |
980 | print DRMCONST "osver=$opt{drm_osver}\n" if ($opt{drm_osver} ne "") ; | |
981 | close (DRMCONST) ; | |
982 | ||
983 | } else { | |
984 | if (!($opt{drm_constraints_file} =~ /^\//)) { | |
985 | $opt{drm_constraints_file} = "$ENV{PWD}/$opt{drm_constraints_file}" ; | |
986 | } | |
987 | die ("DIE. Could not find DREAM constraints file $opt{drm_constraints_file}") if (! -r $opt{drm_constraints_file}) ; | |
988 | $opt{drmconstraints_name} = $opt{drm_constraints_file}; | |
989 | } | |
990 | # create the dream command | |
991 | ||
992 | `rm -rf $opt{drmcommand_name}` ; | |
993 | ||
994 | open (DRMCMD, "> $opt{drmcommand_name}") or die ("DIE. Could not open DReAM command file") ; | |
995 | ||
996 | if ( $opt{clearcase} ) { | |
997 | print DRMCMD "TRE_SEARCH='$ENV{TRE_SEARCH}';export TRE_SEARCH; "; | |
998 | } | |
999 | print DRMCMD "auditr \\\n" if ($opt{use_auditr}) ; | |
1000 | print DRMCMD (join (" \\\n", @{$opt{auditr_args}})) if ($opt{use_auditr}) ; | |
1001 | print DRMCMD " \\\n" if ($opt{use_auditr}) ; | |
1002 | ||
1003 | if ( $opt{clearcase} ) { | |
1004 | print DRMCMD "$prg " ; | |
1005 | } | |
1006 | else { | |
1007 | print DRMCMD "$prg \\\n" ; | |
1008 | } | |
1009 | ||
1010 | foreach my $x (@{$argv_ref}) | |
1011 | { | |
1012 | next if (($x =~ /-indrm/) or ($x =~ /-interactive/)); | |
1013 | ($x =~ s/(-.*?)=(.*)/$1=\"$2\"/) if (($x =~ /\s/) and ($x !~ /-.*?="/)); #" | |
1014 | ($x =~ s/"/\\"/go) if ($opt{use_auditr}); # Escape quote if using auditr | |
1015 | ||
1016 | if ( $opt{clearcase} ) { | |
1017 | print DRMCMD "$x " ; | |
1018 | } | |
1019 | else { | |
1020 | print DRMCMD "$x \\\n" ; | |
1021 | } | |
1022 | } | |
1023 | close (DRMCMD) ; | |
1024 | ||
1025 | `chmod 0777 $opt{drmcommand_name}` ; | |
1026 | ||
1027 | # submit to dream | |
1028 | ||
1029 | my $cmd ; | |
1030 | ||
1031 | if ($opt{drm_on}) | |
1032 | { | |
1033 | $cmd = "drmon " ; | |
1034 | } | |
1035 | else | |
1036 | { | |
1037 | if ( $opt{clearcase} ) { | |
1038 | $cmd = "cd ; drmsubmit " ; | |
1039 | } | |
1040 | else { | |
1041 | $cmd = "drmsubmit " ; | |
1042 | } | |
1043 | } # else !drm_on | |
1044 | ||
1045 | $cmd .= "-m -i " if ($opt{interactive}) ; | |
1046 | ||
1047 | ||
1048 | if (!($opt{drmconstraints_name} =~ /^\//)) { | |
1049 | $opt{drmconstraints_name} = "$ENV{PWD}/$opt{drmconstraints_name}" ; | |
1050 | } | |
1051 | if ( $opt{clearcase} ) { | |
1052 | $cmd .= " -f $opt{drmconstraints_name} "; | |
1053 | $cmd .= " $CLEARTOOL setview -exec \'source ${PROJ_CSHRC};"; | |
1054 | $cmd .= " setenv DV_ROOT $cc_dv_root; cd $ENV{PWD}; "; | |
1055 | # Don't know how to use constraints file | |
1056 | $cmd .= " $ENV{PWD}/$opt{drmcommand_name} " ; | |
1057 | $cmd .= "\' $CC_VIEW_NAME"; | |
1058 | print "sims: $cmd \n"; | |
1059 | } | |
1060 | else { | |
1061 | $cmd .= "-f $opt{drmconstraints_name} $ENV{PWD}/$opt{drmcommand_name} " ; | |
1062 | $cmd .= " \'>&\' $ENV{PWD}/$opt{drmlog_name} " if ($opt{drmlog} and (!$opt {interactive})) ; | |
1063 | print "sims: $cmd \n"; | |
1064 | } | |
1065 | ||
1066 | system ($cmd) ; | |
1067 | ||
1068 | # Restore global options .. | |
1069 | %opt = %opt_copy ; | |
1070 | } | |
1071 | ||
1072 | #############################################################################}}} | |
1073 | # update sims cycle database {{{ | |
1074 | ################################################################################ | |
1075 | ||
1076 | sub update_db | |
1077 | { | |
1078 | my $cycles = shift ; | |
1079 | my $start = shift ; | |
1080 | my $stop = shift ; | |
1081 | my $status = shift ; | |
1082 | chomp ($start) ; | |
1083 | chomp ($stop) ; | |
1084 | my $regress_date = sprintf "%4.4d_%2.2d_%2.2d", 1900 + (localtime) [5], 1 + (localtime) [4], (localtime) [3] ; | |
1085 | ||
1086 | my $db_dir = undef ; | |
1087 | ||
1088 | foreach my $x (@{$proj_vars{sims_db}}) | |
1089 | { | |
1090 | $db_dir = $x if (-d $x) ; | |
1091 | } | |
1092 | ||
1093 | return if (!defined $db_dir) ; | |
1094 | ||
1095 | my $dbfile = "$db_dir/$regress_date"; | |
1096 | ||
1097 | open (DB, ">> $dbfile") or return ; | |
1098 | flock (DB, LOCK_EX) ; | |
1099 | seek (DB, 0, 2) ; | |
1100 | print DB "$opt{sys}|$cycles|$start|$stop|$status\n" ; | |
1101 | flock (DB, LOCK_UN) ; | |
1102 | close (DB) ; | |
1103 | system("chmod -f go+rw $dbfile") if (-o $dbfile); | |
1104 | } | |
1105 | ||
1106 | #############################################################################}}} | |
1107 | # redirect all output to tee {{{ | |
1108 | ################################################################################ | |
1109 | ||
1110 | sub redirect | |
1111 | { | |
1112 | my $logfile = $opt{simslog_name} ; | |
1113 | ||
1114 | if ($opt{regress}) | |
1115 | { | |
1116 | $logfile = "$launch_dir/$opt{simslog_name}" ; | |
1117 | } | |
1118 | ||
1119 | if ($opt{simslog}) | |
1120 | { | |
1121 | tee_stdout ($logfile) ; | |
1122 | open(STDERR, ">&=STDOUT") or die "DIE. Could not make stderr an alias to stdout: $!"; | |
1123 | } | |
1124 | } | |
1125 | ||
1126 | #############################################################################}}} | |
1127 | # tee stdout to log file {{{ | |
1128 | ################################################################################ | |
1129 | ||
1130 | sub tee_stdout { | |
1131 | my $file = shift; | |
1132 | die "DIE. tee_stdout() called without a filename" unless defined $file; | |
1133 | return if my $pid = open(STDOUT, '|-'); | |
1134 | die "DIE. Cannot fork when trying to tee stdout: $!" unless defined $pid; | |
1135 | ||
1136 | open(SIMSLOG, ">$file") or die "DIE. Could not open $file for writing: $!"; | |
1137 | my $old_fh = select SIMSLOG; | |
1138 | $| = 1; | |
1139 | select $old_fh; | |
1140 | $| = 1; | |
1141 | while(<STDIN>) { | |
1142 | print; | |
1143 | print SIMSLOG; | |
1144 | } | |
1145 | exit(0); | |
1146 | } | |
1147 | ||
1148 | #############################################################################}}} | |
1149 | # print out a header when sims starts {{{ | |
1150 | ################################################################################ | |
1151 | ||
1152 | sub print_header | |
1153 | { | |
1154 | # print "$prg @argv_copy\n"; | |
1155 | open (SIMS_HISTORY, ">> history.sims") ; | |
1156 | my $date = `date` ; | |
1157 | chomp ($date) ; | |
1158 | ||
1159 | print "$prg "; | |
1160 | print SIMS_HISTORY "$date $prg "; | |
1161 | ||
1162 | foreach my $x (@argv_copy) | |
1163 | { | |
1164 | ($x =~ s/(-.*?)=(.*)/$1=\"$2\"/) if (($x =~ /\s/) and ($x !~ /-.*?="/)) ; | |
1165 | print "$x " ; | |
1166 | print SIMS_HISTORY "$x " ; | |
1167 | } | |
1168 | ||
1169 | print "\n" ; | |
1170 | print SIMS_HISTORY "\n" ; | |
1171 | ||
1172 | chomp(my $hostname = `hostname`); | |
1173 | ||
1174 | print "$prg: #####################################################################\n"; | |
1175 | print "$prg: \t SIMS 1.272 running for OpenSparc T2 \n"; | |
1176 | print "$prg: #####################################################################\n"; | |
1177 | ||
1178 | print "$prg: start_time $date\n"; | |
1179 | print "$prg: running on $hostname \n"; | |
1180 | print "$prg: uname is "; | |
1181 | system ("uname -a") ; | |
1182 | print "$prg: version $version (pid=$pid)\n"; | |
1183 | print "$prg: dv_root $dv_root\n"; | |
1184 | print "$prg: cc_dv_root $cc_dv_root\n" if $opt{clearcase}; | |
1185 | print "$prg: model_dir $model_dir\n"; | |
1186 | print "$prg: tre_search $ENV{TRE_SEARCH}\n" ; | |
1187 | print "$prg: Frozen tre_search $orig_tre_search\n" if (($#{$opt{group}} != -1) and ($opt{alias} eq "")) ; | |
1188 | } | |
1189 | ||
1190 | ||
1191 | #############################################################################}}} | |
1192 | # regress subroutine {{{ | |
1193 | ################################################################################ | |
1194 | ||
1195 | sub regress | |
1196 | { | |
1197 | # figure out the name of the regression | |
1198 | print "$prg: Starting regression...\n"; | |
1199 | ||
1200 | my $regress_date = sprintf "%4.4d_%2.2d_%2.2d", 1900 + (localtime) [5], 1 + (localtime) [4], (localtime) [3] ; | |
1201 | my $regress_time = sprintf "%2.2d_%2.2d_%2.2d", (localtime) [2], (localtime) [1], (localtime) [0] ; | |
1202 | my $a=''; | |
1203 | my @a=sort grep{!/^T2$/}map{substr $_,2}grep{/^-D/}@{$opt{config_cpp_args}}; | |
1204 | if (scalar @a != 0) { $a=join('__',@a); } | |
1205 | my $regress_id ; | |
1206 | if ($opt{regress_id} eq "") | |
1207 | { | |
1208 | $regress_id = $opt{sys} . "_" . $opt{sim} . "_regression_" . $regress_date . '__' . $a; | |
1209 | my $count = 0 ; | |
1210 | while (-d "$result_dir/$opt{sys}_$opt{sim}_regression_${regress_date}__${a}_${count}") {$count++;} | |
1211 | $regress_id .= "_$count" ; | |
1212 | } | |
1213 | else | |
1214 | { | |
1215 | $regress_id = $opt{regress_id} ; | |
1216 | } | |
1217 | ||
1218 | # create the directory where regression will be run | |
1219 | ||
1220 | system ("mkdir -p $result_dir/$regress_id") ; | |
1221 | die ("DIE. Could not create result area for regression") if ($?) ; | |
1222 | ||
1223 | chdir ("$result_dir/$regress_id") or die ("DIE. Could not change directory into $result_dir/$regress_id") ; | |
1224 | ||
1225 | # recreate a copy of all the tre files in this directory | |
1226 | my $tre_search = &freeze_tre( "$result_dir/$regress_id" ); | |
1227 | $ENV{TRE_SEARCH} = $tre_search if $tre_search ne ""; | |
1228 | ||
1229 | @argv_copy = @ARGV ; | |
1230 | ||
1231 | # Pass the config_cpp_args through .. | |
1232 | foreach my $x ( @{$opt{config_cpp_args}} ) { | |
1233 | push(@argv_copy, "-config_cpp_args $x"); | |
1234 | } | |
1235 | ||
1236 | foreach my $x (@argv_copy) | |
1237 | { | |
1238 | if ($x =~ /-fast_boot/) { | |
1239 | push (@{$opt{diaglist_cpp_args}}, "-DFAST_BOOT") ; | |
1240 | push (@{$opt{config_cpp_args}}, "-DFAST_BOOT") ; | |
1241 | push(@argv_copy, "-config_cpp_args -DFAST_BOOT"); | |
1242 | } | |
1243 | } | |
1244 | ||
1245 | my $model_rel_name; | |
1246 | my $count_diags=0; | |
1247 | my $exe_dir; | |
1248 | foreach my $gname (@{$opt{group}}) | |
1249 | { | |
1250 | # put the pre-processed diaglist in here | |
1251 | ||
1252 | die ("DIE. Diag list $diaglist not found") if (! -f $diaglist) ; | |
1253 | ||
1254 | my $diagcppargs = join(' ', @{$opt{diaglist_cpp_args}}); | |
1255 | print "$prg: processing diaglist $diaglist ($diagcppargs) ..\n" ; | |
1256 | system ("bw_cpp -B $diagcppargs -undef -I$dv_root/verif/diag $diaglist > $result_dir/$regress_id/master_diaglist.$gname") ; | |
1257 | die ("DIE. Could not pre-process the master_diaglist") if ($?) ; | |
1258 | ||
1259 | # open the diaglist and look for the group in it | |
1260 | ||
1261 | my $diagList = DiagList->new ("$result_dir/$regress_id/master_diaglist.$gname", $opt{null}, $gname) ; | |
1262 | ||
1263 | my $group = $diagList->find_group ($gname) ; | |
1264 | ||
1265 | die ("DIE. Group name $gname not found in diag list $diaglist") if (! defined $group) ; | |
1266 | ||
1267 | print "$prg: processing group $gname\n"; | |
1268 | foreach my $tag ($group->build_tags ()) | |
1269 | { | |
1270 | my $buildargs = $diagList->build_args ($tag) ; | |
1271 | ||
1272 | # read the config file for this sys | |
1273 | my @argv_config ; | |
1274 | &get_config ($opt{sys}, \@argv_config) ; | |
1275 | ||
1276 | # extract the dream options from the config file | |
1277 | my @dream_options = () ; | |
1278 | ||
1279 | foreach my $x (@argv_config) | |
1280 | { | |
1281 | push (@dream_options, $x) if ($x =~ /\-drm\_/) ; | |
1282 | push (@dream_options, $x) if ($x =~ /\-vcs_use_ntb/) ; | |
1283 | } | |
1284 | ||
1285 | # figure out the name of the model release | |
1286 | if ($opt{build} ) # do a build | |
1287 | { | |
1288 | if ($opt{model_rel_name} eq "") | |
1289 | { | |
1290 | $model_rel_name = sprintf "%4.4d_%2.2d_%2.2d", 1900 + (localtime) [5], 1 + (localtime) [4], (localtime) [3] ; | |
1291 | open (MODEL_LOCK, "> lock") or die "DIE. Could not lock model" ; | |
1292 | flock (MODEL_LOCK, LOCK_EX) ; | |
1293 | my $count = 0 ; | |
1294 | while (-d "$model_dir/$opt{sys}/$opt{sim}_build_${model_rel_name}_${count}") {$count++;} | |
1295 | $model_rel_name = "$opt{sim}_build_${model_rel_name}_${count}" ; | |
1296 | system ("mkdir -p $model_dir/$opt{sys}/$model_rel_name") ; | |
1297 | die "DIE. Could not create model_rel_name for regression" if ($?) ; | |
1298 | flock (MODEL_LOCK, LOCK_UN) ; | |
1299 | close (MODEL_LOCK) ; | |
1300 | } | |
1301 | else { $model_rel_name = $opt{model_rel_name} ; } # use user-supplied name | |
1302 | } | |
1303 | else # do not do a build | |
1304 | { | |
1305 | if ($opt{model_rel_name} eq "") | |
1306 | { | |
1307 | $model_rel_name = $model_def_name ; # use the model's default name | |
1308 | } | |
1309 | else | |
1310 | { | |
1311 | $model_rel_name = $opt{model_rel_name} ; # use user-supplied name | |
1312 | } | |
1313 | } | |
1314 | ||
1315 | print "$prg: DV_ROOT is $ENV{DV_ROOT}\n"; | |
1316 | print "$prg: MODEL_DIR is $ENV{MODEL_DIR}\n"; | |
1317 | print "$prg: ",'#' x 50,"\n"; | |
1318 | ||
1319 | ||
1320 | if ($opt{sim} eq 'vcs') { $opt{cache}=0; } | |
1321 | else { $opt{cache}=1; } | |
1322 | # call sims to build this model | |
1323 | my $cmd = "$prg " ; | |
1324 | $cmd .= "-sim=$opt{sim} " ; | |
1325 | $cmd .= "-nobuild " if (!$opt{build}) ; | |
1326 | $cmd .= "-vcs_build " if( $opt{vcs_build} ) ; | |
1327 | $cmd .= "-ncv_build " if( $opt{ncv_build} ) ; | |
1328 | $cmd .= "-vera_build " if( $opt{vera_build} ) ; | |
1329 | $cmd .= "$buildargs " if ($opt{build}) ; | |
1330 | $cmd .= "-model_rel_name=$model_rel_name "; | |
1331 | $cmd .= "-nouse_cdms_iver " ; | |
1332 | $cmd .= "-sims_config=$sims_config " ; | |
1333 | $cmd .= "-novcs_use_fsdb " if (!$opt{vcs_use_fsdb}); | |
1334 | $cmd .= "-novcs_use_vcsd " if (!$opt{vcs_use_vcsd}); | |
1335 | $cmd .= "-parallel " if ($opt{sim_q_command} ne "/bin/sh") ; | |
1336 | $cmd .= "-nocache " if (!$opt{cache}) ; | |
1337 | $cmd .= "-vcs_full64 " if ($opt{vcs_full64}) ; | |
1338 | # if ($opt{build}) { | |
1339 | # if (!$opt{cache}) { print "$prg: >>>>> will NOT cache your build !\n"; } | |
1340 | # else { print "$prg: >>>>> will cache your build !\n"; } | |
1341 | # } | |
1342 | foreach my $x (@{$opt{vcs_build_args}}) { | |
1343 | $x =~ s/^"(.*?)"$/$1/ ; | |
1344 | if ($x=~m/^-f flist$/) { $x=~s/flist/$model_path\/flist/; } | |
1345 | if ($x=~m/^ \+vc (vera\/\w+\.(o|a))$/) { my $y = " +vc " . $model_path . "/" . $1; $x = $y; } | |
1346 | $cmd .= "$x " ; | |
1347 | } | |
1348 | ||
1349 | foreach my $x (@argv_copy) | |
1350 | { | |
1351 | ($x =~ s/(-.*?)=(.*)/$1=\"$2\"/) if (($x =~ /\s/) and ($x !~ /-.*?="/)); #" | |
1352 | $cmd .= " $x " ; | |
1353 | } | |
1354 | ||
1355 | if ( $opt{vcs_build} or $opt{ncv_build} ) | |
1356 | { | |
1357 | print "$prg: building regression model\n"; | |
1358 | ||
1359 | system ($cmd) ; my $build_stat = $?; | |
1360 | ||
1361 | `cp -f $model_dir/$opt{sys}/$model_rel_name/diff_rel.log $result_dir/$regress_id/diff_rel_$tag.log` if (-f "$model_dir/$opt{sys}/$model_rel_name/diff_rel.log") ; | |
1362 | ||
1363 | die ("DIE. Could not build model for regression") if ($build_stat) ; | |
1364 | ||
1365 | my $dir = $model_dir."/".$opt{sys}."/".$model_rel_name; my @a=() ; | |
1366 | opendir D, "$dir" or die ( "cannot open build dir $dir for reading!\n"); | |
1367 | if ( $opt{vcs_build} ) { | |
1368 | @a =grep {/simv/} readdir D ; closedir D; | |
1369 | if (scalar @a == 0) { print "$prg: no VCS binary found inside $dir ! \n"; exit (0) ; } | |
1370 | } elsif ( $opt{ncv_build} ) { | |
1371 | @a =grep {/INCA_libs/} readdir D ; closedir D; | |
1372 | if ( scalar @a != 0 ) { | |
1373 | opendir D, "$dir/INCA_libs/worklib" or die ( "cannot open dir for reading!\n"); | |
1374 | my @b = grep {/^inca.*pak$/} readdir D ; closedir D; | |
1375 | if ( scalar @b == 0 ) { print "$prg: no NC-Verilog snapshot found inside $dir ! \n"; exit (0) ; } | |
1376 | } | |
1377 | else { print "$prg: no NC-Verilog snapshot found inside $dir ! \n"; exit (0) ; } | |
1378 | } | |
1379 | ||
1380 | # build is finished, now time for runs.... | |
1381 | print "$prg: finished building the model for simulation, will start regression runs now.....\n"; | |
1382 | $exe_dir=$dir; | |
1383 | if ($opt{sim_q_command} eq "/bin/sh") | |
1384 | { | |
1385 | if ($opt{cache}) | |
1386 | { | |
1387 | if ($opt{sim} eq 'vcs' ) { | |
1388 | open F, "$dir/compile.log" or die ("DIE. could not open $dir/compile.log"); | |
1389 | my @l=<F>; close F; my @ll=grep{/^OpenSPARC_T2 compile dir is: /}@l; chomp @ll; | |
1390 | my $s; ($s=$ll[-1])=~s/^OpenSPARC_T2 compile dir is: (.*)/$1/; | |
1391 | $exe_dir=$s; | |
1392 | } | |
1393 | elsif ($opt{sim} eq 'ncv' ) { | |
1394 | open F, "$dir/ncelab.log" or die ("DIE. could not open $dir/ncelab.log"); | |
1395 | my @l=<F>; close F; my @ll=grep{/^OpenSPARC_T2 compile dir is: /}@l; chomp @ll; | |
1396 | my $s; ($s=$ll[-1])=~s/^OpenSPARC_T2 compile dir is: (.*)/$1/; | |
1397 | $exe_dir=$s; | |
1398 | } | |
1399 | } | |
1400 | } | |
1401 | } | |
1402 | else | |
1403 | { | |
1404 | print "$prg: will now run regression using a pre-built simulation model...\n"; | |
1405 | my $dir = $model_dir."/".$opt{sys}."/".$model_rel_name ; my @a=() ; | |
1406 | opendir D, "$dir" or die ( " cannot open build dir $dir for reading!\n"); | |
1407 | if ($opt{sim} eq 'vcs' ) | |
1408 | { | |
1409 | @a =grep {/simv/} readdir D ; closedir D; | |
1410 | if ( scalar @a != 0 ) { print "$prg: using the VCS model built inside $dir/simv \n"; } | |
1411 | else { print "$prg: no VCS binary found inside $dir ! \n"; exit (0) ; } | |
1412 | } | |
1413 | elsif ($opt{sim} eq 'ncv' ) | |
1414 | { | |
1415 | @a =grep {/INCA_libs/} readdir D ; closedir D; | |
1416 | if ( scalar @a != 0 ) { | |
1417 | opendir D, "$dir/INCA_libs/worklib" or die ( " cannot open dir for reading!\n"); | |
1418 | my @b = grep {/^inca.*pak$/} readdir D ; closedir D; | |
1419 | print "$prg: using the NC-Verilog model built inside $dir/INCA_libs/worklib/$b[-1] \n"; | |
1420 | } | |
1421 | else { print "$prg: no NC-Verilog snapshot found inside $dir ! \n"; exit (0) ; } | |
1422 | } | |
1423 | $exe_dir=$dir; | |
1424 | ||
1425 | if ($opt{sim_q_command} eq "/bin/sh") | |
1426 | { | |
1427 | if ($opt{cache}) | |
1428 | { | |
1429 | my $cache_dir_prefix = $ENV{TEMPDIR} ; | |
1430 | if ( !( -d $ENV{TEMPDIR} ) ) { system ("mkdir -p $ENV{TEMPDIR}") ; } | |
1431 | die ( "DIE. Could not access your temporary cache directory. \n") if ( !( -d $ENV{TEMPDIR} ) ) ; | |
1432 | my $cache_dir; | |
1433 | if (-d $cache_dir_prefix ) | |
1434 | { | |
1435 | opendir D, $cache_dir_prefix or die (" Could not open directory \" ${cache_dir_prefix} \" for reading!\n"); | |
1436 | my @d = map { $cache_dir_prefix . "/" . $_ } grep { !/^\./ && -d "$cache_dir_prefix/$_" } readdir D ; closedir D; | |
1437 | ||
1438 | foreach (@d) { | |
1439 | if ( ( time - ( (stat $_ )->mtime ) ) > ( 60*60*$cache_clean_time ) ) { | |
1440 | system ( "/bin/rm -rf $_" ) ; | |
1441 | } | |
1442 | } | |
1443 | if ($opt{sim} eq 'vcs' ) | |
1444 | { | |
1445 | $cache_dir = $cache_dir_prefix . "/OpenSPARC_T2___VCS___" . $opt{sys} . "___build" ; | |
1446 | my $count = 0; | |
1447 | while ( -d "${cache_dir}_${count}" ) { ++$count; } | |
1448 | $cache_dir .= "_$count" ; | |
1449 | system ("mkdir -p $cache_dir") ; | |
1450 | die ("DIE. Could not create temporary cache sub-directory for VCS compilation ") if ($?) ; | |
1451 | print "$prg: will now copy the simulation binary (simv) and the direct access interface directory (simv.daidir) from the original build directory to the cache. \n"; | |
1452 | system ("/bin/cp $dir/simv $cache_dir") ; | |
1453 | system ("/bin/cp -rf $dir/simv.daidir $cache_dir") ; | |
1454 | if (-d "$dir/simv.cm") { system ("/bin/cp -rf $dir/simv.cm $cache_dir") ; } | |
1455 | if (-d "$dir/simv.vdb") { system ("/bin/cp -rf $dir/simv.vdb $cache_dir") ; } | |
1456 | } | |
1457 | elsif ($opt{sim} eq 'ncv' ) | |
1458 | { | |
1459 | $cache_dir = $cache_dir_prefix . "/OpenSPARC_T2___NC_Verilog___" . $opt{sys} . "___build" ; | |
1460 | my $count = 0; | |
1461 | while ( -d "${cache_dir}_${count}" ) { ++$count; } | |
1462 | $cache_dir .= "_$count" ; | |
1463 | system ("mkdir -p $cache_dir") ; | |
1464 | die ("DIE. Could not create temporary cache sub-directory for NC-Verilog compilation ") if ($?) ; | |
1465 | print "$prg: will now copy the NC-Verilog simulation snapshot (INCA_libs) from the original build directory to the cache. \n"; | |
1466 | system ("/bin/cp -rf $dir/INCA_libs $cache_dir") ; | |
1467 | system ("/bin/cp $dir/ncsim.args $cache_dir") ; | |
1468 | system ("/bin/cp $dir/cds.lib $cache_dir") ; | |
1469 | system ("/bin/cp $dir/hdl.var $cache_dir") ; | |
1470 | } | |
1471 | } | |
1472 | $exe_dir=$cache_dir; | |
1473 | } | |
1474 | } | |
1475 | } | |
1476 | ||
1477 | $count_diags += scalar ($group->list_diags($tag)) ; | |
1478 | print '=' x 100 . "\n"; | |
1479 | print "$prg: -----> Total of " . scalar ($group->list_diags($tag)) . " diags to run...\n"; | |
1480 | print '=' x 100 . "\n"; | |
1481 | ||
1482 | chdir "$result_dir/$regress_id" or die ("DIE. Could not cd to result area for regression") ; | |
1483 | ||
1484 | my $i=0; | |
1485 | foreach my $diagname ($group->list_diags($tag)) | |
1486 | { | |
1487 | my $diag = $group->find_diag($tag, $diagname) ; | |
1488 | my @runargs = $diag->get_cmd_argv() ; | |
1489 | my @run_dream_options = @dream_options ; | |
1490 | ||
1491 | my @argv = @argv_copy ; | |
1492 | unshift (@argv, @runargs) ; | |
1493 | # unshift (@argv, @dream_options) ; | |
1494 | ||
1495 | foreach my $x (@runargs) | |
1496 | { | |
1497 | push (@run_dream_options, $x) if ($x =~ /\-drm\_/) ; | |
1498 | } | |
1499 | ||
1500 | my $reg_count = 0 ; | |
1501 | ||
1502 | foreach my $x (@argv) | |
1503 | { | |
1504 | if ($x =~ /\-reg\_count/) | |
1505 | { | |
1506 | $reg_count = $x ; | |
1507 | $reg_count =~ s/\-reg\_count=(.*)/$1/ ; | |
1508 | $reg_count-- ; | |
1509 | } | |
1510 | } | |
1511 | ||
1512 | my $alias = $diag->get_full_name () ; | |
1513 | ||
1514 | while ($reg_count >= 0) | |
1515 | { | |
1516 | my $dirname = "$alias:$reg_count" ; | |
1517 | ||
1518 | `rm -rf $dirname` ; | |
1519 | die ("DIE. Could not remove diag area $dirname for regression") if ($?) ; | |
1520 | `mkdir $dirname` ; | |
1521 | die ("DIE. Could not create diag area $dirname for regression") if ($?) ; | |
1522 | ||
1523 | chdir $dirname or die ("DIE. Could not cd to diag area $dirname") ; | |
1524 | ||
1525 | if ($opt{sim} eq 'vcs') { $opt{cache}=0; } | |
1526 | else { $opt{cache}=1; } | |
1527 | my @cmd ; | |
1528 | push (@cmd, "-sys=$opt{sys}") ; | |
1529 | push (@cmd, "-model_rel_name=${model_rel_name}") ; | |
1530 | push (@cmd, "-regress_id=${regress_id}") ; | |
1531 | push (@cmd, "-alias=${dirname}") ; | |
1532 | push (@cmd, "-dv_root=${dv_root}") ; | |
1533 | push (@cmd, "-model_dir=${model_dir}") ; | |
1534 | push (@cmd, "-result_dir=${result_dir}") ; | |
1535 | push (@cmd, "-sims_config=${sims_config}") ; | |
1536 | push (@cmd, "-group_name=$gname") ; | |
1537 | push (@cmd, "-regress_date=$regress_date") ; | |
1538 | push (@cmd, "-regress_time=$regress_time") ; | |
1539 | if ($opt{sim} eq 'vcs') { push (@cmd, "-vcs_run"); } | |
1540 | elsif ($opt{sim} eq 'ncv') { push (@cmd, "-ncv_run") ; } | |
1541 | if ($opt{clearcase}) { | |
1542 | push (@cmd, "-use_iver=$result_dir/$regress_id/tre/sims.iver") ; | |
1543 | } else { | |
1544 | push (@cmd, "-nouse_cdms_iver") ; | |
1545 | } | |
1546 | ||
1547 | my $u=`uname -s`;chomp $u; | |
1548 | if ($u eq "SunOS") { push (@cmd, "-sas") ; } | |
1549 | else { push (@cmd, "-nosas") ; } | |
1550 | push (@cmd, @argv) ; | |
1551 | push (@cmd, "-nobuild") ; | |
1552 | push (@cmd, "-regress") ; | |
1553 | if (!$opt{cache}) { push (@cmd, "-nocache") ; } | |
1554 | # if (!$opt{cache}) { print "$prg: >>>>> will NOT cache your runs!\n"; } | |
1555 | # else { print "$prg: >>>>> will cache your runs!\n"; } | |
1556 | push (@cmd, "-parallel") if ($opt{sim_q_command} ne "/bin/sh") ; | |
1557 | push (@cmd, "-exe_dir=${exe_dir}"); | |
1558 | if ($u ne "SunOS") { push (@cmd, "-nosas") ; } | |
1559 | ||
1560 | ++$i; | |
1561 | print "$prg: Run directory: ${result_dir}/${regress_id}/${dirname} ( No. $i )\n" ; | |
1562 | if ($opt{sim} eq 'ncv') { foreach (@cmd) {s/-vcs/-ncv/;} } | |
1563 | ||
1564 | if ($opt{sim_q_command} ne "/bin/sh") # submit command to DReAM | |
1565 | { | |
1566 | my $cmd1 = $opt{sim_q_command} . " $prg @cmd"; | |
1567 | # print "$prg: Run command is : $cmd1\n"; | |
1568 | system ($cmd1); | |
1569 | } | |
1570 | else # or run it locally | |
1571 | { | |
1572 | my $cmd1 = "$prg @cmd"; | |
1573 | # print "$prg: Run command is : $cmd1\n"; | |
1574 | system ($cmd1); | |
1575 | } | |
1576 | $reg_count-- ; | |
1577 | chdir ".." or die ("DIE. Could not cd up to result directory") ; | |
1578 | } | |
1579 | } | |
1580 | if ( ($opt{cache}) and ($opt{sim_q_command} eq "/bin/sh") ) { | |
1581 | `/bin/rm -rf $exe_dir` ; | |
1582 | } | |
1583 | } | |
1584 | } | |
1585 | ||
1586 | chdir "$result_dir" or die ("DIE. Could not cd to result directory for regression report") ; | |
1587 | if ($opt{report}) | |
1588 | { | |
1589 | print "$prg: launching regreport !!!\n" ; | |
1590 | print '=' x 100 . "\n" . "\t\tWill track " . $count_diags . " jobs as time progresses...\n"; | |
1591 | print "\t\tUsing " . ( ($opt{sim} eq 'vcs') ? "VCS" : "NC-Verilog" ) . "\n"; | |
1592 | print "\t\tRunning group(s): " . join (', ', @{$opt{group}}) . "\n"; | |
1593 | ||
1594 | ||
1595 | if ( $opt{vcs_build} or $opt{ncv_build} ) | |
1596 | { print "\t\tUsing binary under: " . $model_dir."/".$opt{sys}."/".$model_rel_name . "\n"; } | |
1597 | else | |
1598 | { print "\t\tUsing binary under: " . $model_dir."/".$opt{sys}."/".$opt{model_rel_name} . "\n"; } | |
1599 | ||
1600 | if ($opt{sim} eq 'vcs') { `regreport wait_sec=300 -regress $result_dir/$regress_id/regress.log $result_dir/$regress_id` ; } | |
1601 | elsif ($opt{sim} eq 'ncv') { `regreport wait_sec=300 -regress $result_dir/$regress_id/regress.log $result_dir/$regress_id -sim ncv` ; } | |
1602 | } | |
1603 | ||
1604 | print "$prg: stop_time "; | |
1605 | system ("date") ; | |
1606 | } | |
1607 | ||
1608 | ||
1609 | #############################################################################}}} | |
1610 | # rerun a diag from the sims.log {{{ | |
1611 | ################################################################################ | |
1612 | ||
1613 | sub rerun | |
1614 | { | |
1615 | if (! -f "sims.log") {die ("DIE. Could not find original run command");} | |
1616 | open (CMD, "< sims.log") or die ("DIE. Could not open sims.log") ; | |
1617 | my $cmd = <CMD> ; | |
1618 | close (CMD) ; | |
1619 | ||
1620 | chomp $cmd ; | |
1621 | $cmd =~ s/\s+-regress_id=\S+//g ; | |
1622 | $cmd =~ s/\s+-regress_date=\S+//g ; | |
1623 | $cmd =~ s/\s+-regress_time=\S+//g ; | |
1624 | $cmd =~ s/\s+-regress//g ; | |
1625 | $cmd =~ s/\s+-result_dir=\S+//g ; | |
1626 | $cmd =~ s/\s+-parallel//g ; | |
1627 | ||
1628 | my @sims_tg_seed = `grep 'using random' sims.log` ; | |
1629 | my $sims_tg_seed = $sims_tg_seed[0] ; | |
1630 | $sims_tg_seed =~ s/.*?(\d+)/$1/ ; | |
1631 | chomp $sims_tg_seed ; | |
1632 | ||
1633 | if ($opt{use_sims_iver}) | |
1634 | { | |
1635 | my @sims_iver = `grep tre_search sims.log` ; | |
1636 | ||
1637 | my $sims_iver = $sims_iver[0] ; | |
1638 | $sims_iver =~ s/^.*?:\stre_search\s// ; | |
1639 | chomp $sims_iver ; | |
1640 | $ENV{TRE_SEARCH} = $sims_iver ; | |
1641 | } | |
1642 | ||
1643 | if (!$opt{overwrite}) | |
1644 | { | |
1645 | my $count = 0 ; | |
1646 | while (-d "rerun_${count}") {$count++;} | |
1647 | my $rerun_dir = "rerun_${count}" ; | |
1648 | ||
1649 | system ("mkdir -p $rerun_dir") ; | |
1650 | die ("DIE. could not create rerun directory $rerun_dir") if ($?) ; | |
1651 | ||
1652 | chdir $rerun_dir or die ("DIE. could not change to rerun directory $rerun_dir") ; | |
1653 | } | |
1654 | ||
1655 | $cmd .= " -parallel -nocache " ; | |
1656 | if ( $sims_tg_seed ne "" ) { | |
1657 | system ("$cmd -tg_seed=$sims_tg_seed ") ; | |
1658 | } else { | |
1659 | system ("$cmd ") ; | |
1660 | } | |
1661 | } | |
1662 | ||
1663 | #############################################################################}}} | |
1664 | # replace the source files in the flist with new ones from the graft file{{{ | |
1665 | ################################################################################ | |
1666 | ||
1667 | sub graft_flist | |
1668 | { | |
1669 | print "$prg: grafting flist\n" ; | |
1670 | ||
1671 | open (IFLIST, "< flist") or die ("DIE. can't open flist") ; | |
1672 | my @iflist = <IFLIST> ; | |
1673 | close (IFLIST) ; | |
1674 | ||
1675 | my $graft_file = $opt{graft_flist}; | |
1676 | $graft_file =~ s/\$(\w+)/$ENV{$1}/g ; | |
1677 | open (GFLIST, "< $graft_file") | |
1678 | or die ("DIE. can't open graft file: $graft_file") ; | |
1679 | my @gflist = <GFLIST> ; | |
1680 | close (GFLIST) ; | |
1681 | @gflist = map { s/\$(\w+)/$ENV{$1}/g } @gflist; | |
1682 | ||
1683 | my $ifile = join ('', @iflist) ; | |
1684 | ||
1685 | foreach my $gfile_path (@gflist) | |
1686 | { | |
1687 | my $gfile = $gfile_path ; | |
1688 | $gfile =~ s/^.*\/(\S+)\s*/$1/ ; | |
1689 | chomp $gfile ; | |
1690 | chomp $gfile_path ; | |
1691 | print "gfile: $gfile $gfile_path\n" if $opt_debug ; | |
1692 | $ifile =~ s/^.*\/$gfile/$gfile_path/m ; | |
1693 | } | |
1694 | ||
1695 | open (OFLIST, "> flist") or die ("DIE. can't open graft flist") ; | |
1696 | print OFLIST $ifile ; | |
1697 | close (OFLIST) ; | |
1698 | } | |
1699 | ||
1700 | #############################################################################}}} | |
1701 | # Generate the verilog config file{{{ | |
1702 | ################################################################################ | |
1703 | ||
1704 | sub gen_config | |
1705 | { | |
1706 | open (OCONF, ">config.v") or die ("DIE. can't open file config.v") ; | |
1707 | ||
1708 | print OCONF "`timescale 1ps/1ps\n" ; | |
1709 | ||
1710 | foreach my $unit (@{$opt{config_rtl}}) | |
1711 | { | |
1712 | print OCONF "`define $unit\n"; | |
1713 | } | |
1714 | ||
1715 | my $sims_build_args; | |
1716 | if ($opt{vcs_build}) { | |
1717 | $sims_build_args = "-config_rtl ". join (' -config_rtl ', @{$opt{config_rtl}}). " ". | |
1718 | "-vcs_build_args ". join (' -vcs_build_args ', @{$opt{vcs_build_args}}); | |
1719 | } | |
1720 | elsif ($opt{ncv_build}) { | |
1721 | @{$opt{ncv_build_args}} = grep{/(\.v|\+define)/} @{$opt{vcs_build_args}} ; | |
1722 | $sims_build_args = "-config_rtl ". join (' -config_rtl ', @{$opt{config_rtl}}). " ". | |
1723 | "-ncv_build_args ". join (' -ncv_build_args ', @{$opt{ncv_build_args}}); | |
1724 | } | |
1725 | ||
1726 | ||
1727 | ||
1728 | $sims_build_args =~ s/"//g;#" | |
1729 | my $sims_cmd = join(' ', @argv_copy); | |
1730 | $sims_cmd =~ s/"//g; | |
1731 | ||
1732 | print OCONF "`define EMBED_SIMS_BUILD_CMD \$display(\"\\nSims Build Cmd: $sims_cmd\\n\");\n"; | |
1733 | print OCONF "`define EMBED_SIMS_BUILD_ARGS \$display(\"\\nSims Build Args: $sims_build_args\\n\");\n"; | |
1734 | close (OCONF); | |
1735 | } | |
1736 | ||
1737 | #############################################################################}}} | |
1738 | # Generate the flist file {{{ | |
1739 | ################################################################################ | |
1740 | ||
1741 | sub gen_flist | |
1742 | { | |
1743 | # add sunv flist if it exists | |
1744 | if (-f "$model_path/flist_sunv") | |
1745 | { | |
1746 | unshift (@{$opt{flist}}, "$model_path/flist_sunv"); | |
1747 | } | |
1748 | ||
1749 | open (OFLIST, ">flist") or die ("DIE. can't open flist file") ; | |
1750 | ||
1751 | print OFLIST "$ENV{PWD}/config.v\n"; | |
1752 | ||
1753 | foreach my $flist (@{$opt{flist}}) | |
1754 | { | |
1755 | $flist =~ s/\$(\w+)/$ENV{$1}/g ; | |
1756 | ||
1757 | open (IFLIST, "< $flist") or die ("DIE. can't open flist file $flist") ; | |
1758 | ||
1759 | while (<IFLIST>) | |
1760 | { | |
1761 | my $line = $_ ; | |
1762 | my $base = dirname ($flist) ; | |
1763 | ||
1764 | $line =~ s/^\s*(.*?)\s*$/$1/ ; | |
1765 | $line .= "\n" ; | |
1766 | ||
1767 | if (($line =~ /^\s*\/\//) or | |
1768 | ($line =~ /^\s*$/)) | |
1769 | { | |
1770 | next ; | |
1771 | } | |
1772 | ||
1773 | $line =~ s/\$(\w+)/$ENV{$1}/g ; | |
1774 | ||
1775 | if ($line =~ /^\+incdir\+\//) | |
1776 | { | |
1777 | } | |
1778 | elsif ($line =~ /^\+incdir\+/) | |
1779 | { | |
1780 | $line =~ s/^\+incdir\+(.*)/\+incdir\+$base\/$1/ ; | |
1781 | } | |
1782 | elsif ($line =~ /^\-v\s\//) | |
1783 | { | |
1784 | } | |
1785 | elsif ($line =~ /^\-v/) | |
1786 | { | |
1787 | $line =~ s/-v\s*(.*)/-v $base\/$1/ ; | |
1788 | } | |
1789 | elsif ($line =~ /^-y\s\//) | |
1790 | { | |
1791 | } | |
1792 | elsif ($line =~ /^-y/) | |
1793 | { | |
1794 | $line =~ s/-y\s*(.*)/-y $base\/$1/ ; | |
1795 | } | |
1796 | elsif (($line =~ /^\+define/) or | |
1797 | ($line =~ /^\+libext/) or | |
1798 | ($line =~ /^\+librescan/)) | |
1799 | { | |
1800 | } | |
1801 | elsif ($line !~ /^\//) | |
1802 | { | |
1803 | $line = "$base/$line" ; | |
1804 | } | |
1805 | ||
1806 | print OFLIST $line ; | |
1807 | } | |
1808 | ||
1809 | close (IFLIST) ; | |
1810 | } | |
1811 | ||
1812 | foreach my $file (@{$opt{vfile}}) | |
1813 | { | |
1814 | chomp $file ; | |
1815 | $file =~ s/\$(\w+)/$ENV{$1}/g ; | |
1816 | print OFLIST "$file\n" ; | |
1817 | } | |
1818 | ||
1819 | if ($opt{vera_build} and !$opt{vcs_use_ntb}) # original Vera | |
1820 | { | |
1821 | print OFLIST "$model_path/$opt{sys}_top_shell.v\n" if (!$opt{dftvert}) ; | |
1822 | } | |
1823 | ||
1824 | close (OFLIST) ; | |
1825 | } | |
1826 | ||
1827 | #############################################################################}}} | |
1828 | # if a signal is received do some cleanup - kill sas, delete tmp directories{{{ | |
1829 | ################################################################################ | |
1830 | ||
1831 | sub sighandler | |
1832 | { | |
1833 | my $sig = shift ; | |
1834 | ||
1835 | print "$prg: Caught a SIG${sig}\n" ; | |
1836 | print "$prg: Trying to clean up ..\n" ; | |
1837 | ||
1838 | if ((defined $sas_pid) and ($sas_pid != 0)) | |
1839 | { | |
1840 | print "Killing sas ($sas_pid)\n"; | |
1841 | kill -9, $sas_pid ; | |
1842 | } | |
1843 | ||
1844 | if ((defined $tcl_pid) and ($tcl_pid != 0)) | |
1845 | { | |
1846 | kill -9, $tcl_pid ; | |
1847 | } | |
1848 | ||
1849 | if ($opt{vcs_run}) { | |
1850 | `regreport -1 > status.log` ; } | |
1851 | elsif ($opt{ncv_run}) { | |
1852 | `regreport -1 -sim ncv > status.log` ; } | |
1853 | ||
1854 | if ($opt{regress}) | |
1855 | { | |
1856 | if ((defined ($work_dir)) and (-d "$work_dir")) | |
1857 | { | |
1858 | chdir $launch_dir ; | |
1859 | `/bin/cp -r $work_dir/* $launch_dir` ; | |
1860 | `/bin/rm -rf $work_dir` ; | |
1861 | `/bin/rmdir $work_dir` ; | |
1862 | } | |
1863 | } | |
1864 | ||
1865 | my $s=`uname -s`; chomp $s; if ($s eq "SunOS") { | |
1866 | my @cpids = map {/\s+(\d+)\s+/} | |
1867 | grep(/simv|ncsim|python|nas|midas|perl/, split(/\n/, `/bin/ptree $pid $$ `)); | |
1868 | kill -9, reverse(@cpids); | |
1869 | ||
1870 | exit (1) ; | |
1871 | } | |
1872 | } | |
1873 | ||
1874 | ||
1875 | #############################################################################}}} | |
1876 | # create model area{{{ | |
1877 | ################################################################################ | |
1878 | ||
1879 | sub create_model_path | |
1880 | { | |
1881 | my $cur_dir = $ENV{PWD}; | |
1882 | ||
1883 | print "$prg: creating model directory $model_path\n" ; | |
1884 | `mkdir -p $model_path` ; | |
1885 | die ("DIE. could not create directory $model_path") if ($?) ; | |
1886 | chdir ($model_path) or die ("DIE. Could not cd to $model_path") ; | |
1887 | ||
1888 | # clean up the model area as needed | |
1889 | ||
1890 | if ($opt{vcs_clean}) | |
1891 | { | |
1892 | print "$prg: cleaning up VCS build directory\n" ; | |
1893 | print "$prg: [ % /bin/rm -rf simv simv.daidir (and also simv.cm and simv.vdb if applicable) ]\n" ; | |
1894 | system ( " /bin/rm -rf simv simv.daidir simv.cm simv.vdb " ) ; | |
1895 | } | |
1896 | elsif ($opt{ncv_clean}) | |
1897 | { | |
1898 | print "$prg: cleaning up NC-Verilog build directory\n" ; | |
1899 | print "$prg: [ % /bin/rm -rf cds.lib hdl.var ncprep.log ncvlog.log ncelab.log ncvlog.args ncelab.args ncsim.args RUN_NC INCA_libs ]\n" ; | |
1900 | `rm -rf cds.lib hdl.var ncprep.log ncvlog.log ncelab.log ncvlog.args ncelab.args ncsim.args RUN_NC INCA_libs` ; | |
1901 | } | |
1902 | ||
1903 | ||
1904 | # get the diff_release if needed | |
1905 | if ($opt{diff_cdms_rel} && $opt{diff_cdms_curr} | |
1906 | && $opt{cdms_rel_name} ne "") { | |
1907 | chomp(my ($relnum) = (grep(/Editing\s+S\s+:/, `show_release $opt{cdms_rel_name} -local -dirs 0`))[0] =~ m/v=(\w+:\d+\.\d+)/o ); | |
1908 | $opt{cdms_rel_name} = "-v $relnum $opt{cdms_rel_name}" ; | |
1909 | } | |
1910 | if ($opt{diff_cdms_rel}) | |
1911 | { | |
1912 | $opt{cdms_rel_name} =~ s/"//g; #" | |
1913 | print "$prg: diffing release $opt{cdms_rel_name}\n"; | |
1914 | system ("diff_release $opt{cdms_rel_name} > diff_rel.log") ; | |
1915 | } | |
1916 | ||
1917 | `mkdir -p vera` ; | |
1918 | die ("DIE. could not create directory vera under $model_path") if ($?) ; | |
1919 | ||
1920 | `mkdir -p lib` ; | |
1921 | die ("DIE. could not create directory lib under $model_path") if ($?) ; | |
1922 | ||
1923 | # go back to where the script was invoked | |
1924 | chdir $cur_dir ; | |
1925 | } | |
1926 | ||
1927 | #############################################################################}}} | |
1928 | # build the traditional vera testbench files or {{{ | |
1929 | # build the NTB vshell file if $opt{vcs_use_ntb} and $opt{ntb_lib} or | |
1930 | # build an flilst of openVera files for the VCS build if $opt{vcs_use_ntb} and !$opt{ntb_lib} | |
1931 | ################################################################################ | |
1932 | ||
1933 | sub vera_build | |
1934 | { | |
1935 | my $cur_dir = $ENV{PWD}; | |
1936 | ||
1937 | print "$prg: vera_build start (vera or NTB build start) ",`date`; | |
1938 | ||
1939 | if ($opt{vcs_use_ntb} and $opt{ntb_lib}) { | |
1940 | print "$prg: building NTB (NTB LIB) shell file and flist file\n" ; | |
1941 | } elsif ($opt{vcs_use_ntb} and !$opt{ntb_lib}) { | |
1942 | print "$prg: building NTB (NTB ALL) flist file\n" ; | |
1943 | } else { | |
1944 | print "$prg: building traditional vera files (not NTB)\n" ; | |
1945 | } | |
1946 | ||
1947 | # change to the build area | |
1948 | my $vera_dir = "$opt{env_base}/vera" ; | |
1949 | chdir $vera_dir or die ("DIE. Can't cd to $vera_dir") ; | |
1950 | ||
1951 | $ENV{VERA_LIBDIR} = "$model_path/vera"; | |
1952 | print "$prg: setenv VERA_LIBDIR $ENV{VERA_LIBDIR}\n"; | |
1953 | ||
1954 | # if($proj_vars{has_denali}) { | |
1955 | # # figure out the location of denali from tre | |
1956 | # my $denali_home = (defined $ENV{DENALI_HOME})? $ENV{DENALI_HOME} : | |
1957 | # "/import/datools/vendor/denali/v" ; | |
1958 | # $denali_home .= `configsrch denali_pcie /` ; | |
1959 | # chomp ($denali_home) ; | |
1960 | # die ("DIE. Append _64bit to your denali version in your tver file to work with 64 bit vcs") if (($denali_home !~ /_64bit/) && ($opt{vcs_full64})); | |
1961 | # die ("DIE. Conflict between 64 bit denali version in your tver file and 32 bit vcs") if (($denali_home =~ /_64bit/) && (!$opt{vcs_full64})); | |
1962 | # $ENV{DENALI} = $denali_home ; | |
1963 | # print "$prg: setenv DENALI $ENV{DENALI}\n"; | |
1964 | # } | |
1965 | # create the gmake command | |
1966 | ||
1967 | foreach my $obj (@{$opt{vera_cov_obj}}) | |
1968 | { | |
1969 | $obj =~ tr/a-z/A-Z/ ; | |
1970 | push (@{$opt{vera_build_args}}, "$obj=1") ; | |
1971 | } | |
1972 | ||
1973 | my $vera_build_cmd = "gmake "; | |
1974 | $vera_build_cmd .= join (" ", @{$opt{vera_build_args}}) ; | |
1975 | $vera_build_cmd .= " VERA_LIBDIR=$model_path/vera"; | |
1976 | $vera_build_cmd .= " SIMS_64BIT=1" if ($opt{vcs_full64}); | |
1977 | ||
1978 | # if NTB ntb_lib | |
1979 | if ($opt{vcs_use_ntb} && $opt{ntb_lib}) { | |
1980 | if ($opt{vcs_use_cli}) { | |
1981 | $vera_build_cmd .= " VCS_USE_CLI=\"+cli -line\""; | |
1982 | } | |
1983 | if ($opt{vcs_use_ucli}) { | |
1984 | $vera_build_cmd .= " VCS_USE_CLI=\"-debug_all\""; | |
1985 | } | |
1986 | if ($opt{vcs_use_fsdb} or $opt{vcs_use_vcsd}) { | |
1987 | $vera_build_cmd .= " VCS_USE_VCSD=+vcsd"; | |
1988 | } | |
1989 | } | |
1990 | ||
1991 | ||
1992 | # clean the vera/NTB testbench | |
1993 | if ($opt{vera_clean} && $opt{vera_gmake}) | |
1994 | { | |
1995 | print "$prg: $vera_build_cmd clean\n" ; | |
1996 | system ("$vera_build_cmd clean") ; | |
1997 | die ("DIE. failed cleaning vera testbench in $ENV{PWD}") if ($?) ; | |
1998 | } | |
1999 | ||
2000 | ||
2001 | # if NTB is in use | |
2002 | if ($opt{vcs_use_ntb} and $opt{vera_build} and $opt{vcs_build} and $opt{vera_gmake}) { | |
2003 | # if ntb_lib, this is first pass of 2 pass NTB libtb.so compile process. | |
2004 | if ($opt{ntb_lib}) { | |
2005 | if ($opt{vera_dummy_diag} eq "" and $opt{vera_diag_name} eq "") { | |
2006 | print ("NOTICE: failed to specify either an openVera diag or dummy diag (-vera_dummy_diag).\nOne of these is normally required to build when using -ntb_lib!!!\n"); | |
2007 | } | |
2008 | my $tmp_diag_name; | |
2009 | if ($opt{vera_diag_name} ne "") { | |
2010 | my $full_path = &find_diag_path ($opt{vera_diag_name}, | |
2011 | $opt{vera_diag_path}, | |
2012 | $opt{vera_diag_root}); | |
2013 | $tmp_diag_name = $full_path; | |
2014 | } else { | |
2015 | $tmp_diag_name = $opt{vera_dummy_diag}; | |
2016 | } | |
2017 | print "$prg: gmaking NTB (NTB LIB) shell file, using openVera diag $tmp_diag_name\n"; | |
2018 | $vera_build_cmd .= " NTB_DIAG=$tmp_diag_name USE_NTB_LIB=1 ntb_build"; | |
2019 | } else { # NTB all in one compile in use | |
2020 | print "$prg: gmaking NTB (NTB ALL) related flist (\$VERA_LIBDIR/ntb_flist) for VCS build to use\n"; | |
2021 | $vera_build_cmd .= " USE_NTB_ALL=1 ntb_build"; | |
2022 | } | |
2023 | ||
2024 | ||
2025 | # build the vshell file if -ntb_lib or make the ntb_all flist | |
2026 | print "$prg: $vera_build_cmd\n"; | |
2027 | if ($opt{vera_gmake}) { | |
2028 | system ($vera_build_cmd) ; | |
2029 | die ("DIE. failed making NTB testbench in $ENV{PWD}") if ($?) ; | |
2030 | } | |
2031 | } | |
2032 | ||
2033 | ||
2034 | # traditional vera only | |
2035 | if (! $opt{vcs_use_ntb}) { | |
2036 | ||
2037 | # build the vera source files | |
2038 | print "$prg: $vera_build_cmd\n" ; | |
2039 | if ($opt{vera_gmake} && $vera_build_cmd ne "") { | |
2040 | system ($vera_build_cmd) ; | |
2041 | die ("DIE. failed making vera testbench in $ENV{PWD}") if ($?) ; | |
2042 | } | |
2043 | ||
2044 | # generate a project file in the model area | |
2045 | chdir $model_path or die ("DIE. Can't cd to $model_path") ; | |
2046 | ||
2047 | print "$prg: creating vera project file\n" ; | |
2048 | open (PROJFILE, "> vera/$opt{sys}_top.proj") or die ("DIE. could not create project file") ; | |
2049 | ||
2050 | print PROJFILE "main $opt{sys}_top\n" ; | |
2051 | print PROJFILE "$ENV{PWD}/vera/$opt{vera_vcon_file}\n" if ($opt{vera_vcon_file} ne "") ; | |
2052 | ||
2053 | opendir (LIBDIR, "vera") or die ("DIE. can't open vera directory") ; | |
2054 | my @filenames = readdir LIBDIR ; | |
2055 | closedir (LIBDIR) ; | |
2056 | ||
2057 | foreach my $filename (@filenames) | |
2058 | { | |
2059 | if ($filename =~ /\.vro/) | |
2060 | { | |
2061 | print PROJFILE ("$ENV{PWD}/vera/$filename\n") ; | |
2062 | } | |
2063 | } | |
2064 | ||
2065 | close (PROJFILE) ; | |
2066 | ||
2067 | ||
2068 | # generate the vera shell verilog file | |
2069 | ||
2070 | print "$prg: creating vera shell file\n" ; | |
2071 | ||
2072 | foreach my $obj (@{$opt{vera_cov_obj}}) | |
2073 | { | |
2074 | $obj =~ tr/a-z/A-Z/ ; | |
2075 | push (@{$opt{vera_proj_args}}, "-D$obj") ; | |
2076 | } | |
2077 | ||
2078 | push (@{$opt{vera_proj_args}}, "vera/$opt{sys}_top.proj") ; | |
2079 | ||
2080 | my $vera_proj_cmd = "vera -proj " ; | |
2081 | $vera_proj_cmd .= join (" ", @{$opt{vera_proj_args}}) ; | |
2082 | ||
2083 | print "$prg: $vera_proj_cmd\n" ; | |
2084 | ||
2085 | system ($vera_proj_cmd) ; | |
2086 | die ("DIE. vera shell creation failed") if ($?) ; | |
2087 | } | |
2088 | ||
2089 | print "$prg: vera_stop (vera or NTB build done) ",`date` ; | |
2090 | ||
2091 | # go back to where the script was invoked | |
2092 | chdir $cur_dir ; | |
2093 | } | |
2094 | ||
2095 | #############################################################################}}} | |
2096 | # pre build vcs code{{{ | |
2097 | ################################################################################ | |
2098 | ||
2099 | sub pre_build | |
2100 | { | |
2101 | my $cur_dir = $ENV{PWD}; | |
2102 | ||
2103 | # go to the model area | |
2104 | chdir $model_path or die ("DIE. Can't cd to $model_path\n") ; | |
2105 | ||
2106 | # generate the rtl config file | |
2107 | &gen_config ($opt{sys}); | |
2108 | ||
2109 | # Generate the flist file | |
2110 | &gen_flist (); | |
2111 | ||
2112 | system("cp -f flist $cur_dir"); | |
2113 | # merge in the graft flist | |
2114 | if ($opt{graft_flist} ne "") | |
2115 | { | |
2116 | &graft_flist () ; | |
2117 | } | |
2118 | ||
2119 | # go back to where this block was invoked | |
2120 | chdir $cur_dir ; | |
2121 | } | |
2122 | ||
2123 | #############################################################################}}} | |
2124 | # build a model{{{ | |
2125 | ################################################################################ | |
2126 | ||
2127 | # building using NCVerilog | |
2128 | ||
2129 | sub ncv_build | |
2130 | { | |
2131 | my $cur_dir = $ENV{PWD}; | |
2132 | ||
2133 | # go to the model area | |
2134 | chdir $model_path or die ("DIE. Can't cd to $model_path") ; | |
2135 | ||
2136 | my $u=`uname -s`;chomp $u; | |
2137 | system("/bin/rm -rf *.so *.a *.o"); | |
2138 | print "$prg: Building shared object for Vera (NC-Verilog)\n"; | |
2139 | if ($u eq "SunOS") { | |
2140 | system("/bin/cp $ENV{DV_ROOT}/verif/env/common/pli/vera/loadpli/Makefile.nc ."); | |
2141 | } | |
2142 | else { | |
2143 | system("/bin/cp $ENV{DV_ROOT}/verif/env/common/pli/vera/loadpli/linux/Makefile.nc* ."); | |
2144 | } | |
2145 | system("make -f Makefile.nc"); | |
2146 | ||
2147 | if ( ($opt{sys} eq "fc1") or ($opt{sys} eq "fc8") ) | |
2148 | { | |
2149 | # if ( !(grep {$_ eq '-DFC_NO_NIU_T2'} @{$opt{config_cpp_args}}) ) | |
2150 | # { | |
2151 | # print "$prg: Building shared object for NIU (NC-Verilog)\n"; | |
2152 | # system("ar cr libnet_ncverilog.a ./vera/*.o"); | |
2153 | # if ( !(-e "libnet_ncverilog.a") ) { exit(0); } | |
2154 | # system("/bin/cp $ENV{DV_ROOT}/verif/env/common/pli/niu_pli/loadpli/Makefile.nc ./Makefile2.nc"); | |
2155 | # system("make -f Makefile2.nc"); | |
2156 | # } | |
2157 | } | |
2158 | system("/bin/ls -al *.so"); | |
2159 | ||
2160 | $ENV{LD_LIBRARY_PATH}=$ENV{PWD}.":".$ENV{LD_LIBRARY_PATH}; | |
2161 | if ( ($opt{sys} eq "fc1") or ($opt{sys} eq "fc8") ) { | |
2162 | $ENV{LD_LIBRARY_PATH}=$ENV{DV_ROOT}."/verif/model/verilog/niu/sparse_mem_model/loadpli:".$ENV{LD_LIBRARY_PATH}; | |
2163 | # $ENV{LD_LIBRARY_PATH}=$ENV{DV_ROOT}.$ENV{LD_LIBRARY_PATH}; | |
2164 | } | |
2165 | my $a=`configsrch debussy_ncv /`; chomp $a; | |
2166 | if ($u eq "SunOS") { | |
2167 | $ENV{LD_LIBRARY_PATH}=$ENV{NOVAS_HOME}."/share/PLI/nc". $a ."/SOLARIS2/nc_loadpli1:".$ENV{LD_LIBRARY_PATH}; | |
2168 | } | |
2169 | elsif ($u eq "Linux") { | |
2170 | $ENV{LD_LIBRARY_PATH}=$ENV{NOVAS_HOME}."/share/PLI/nc". $a ."/LINUX/nc_loadpli1:".$ENV{LD_LIBRARY_PATH}; | |
2171 | } | |
2172 | ||
2173 | if (exists $ENV{LM_LICENSE_FILE}) | |
2174 | { | |
2175 | print "$prg: LM_LICENSE_FILE : $ENV{LM_LICENSE_FILE}\n"; | |
2176 | } | |
2177 | ||
2178 | push (@{$opt{ncv_build_args}}, "+elaborate") ; | |
2179 | push (@{$opt{ncv_build_args}}, "+name+$opt{sys}") ; | |
2180 | push (@{$opt{ncv_build_args}}, "+ncaccess+rw"); | |
2181 | push (@{$opt{ncv_build_args}}, "+ncnomempack"); | |
2182 | push (@{$opt{ncv_build_args}}, "+ncvlogargs+-messages") ; | |
2183 | push (@{$opt{ncv_build_args}}, "+ncelabargs+-messages") ; | |
2184 | push (@{$opt{ncv_build_args}}, "+ncsimargs+-messages") ; | |
2185 | push (@{$opt{ncv_build_args}}, "+ncvlogargs+-status") ; | |
2186 | push (@{$opt{ncv_build_args}}, "+ncelabargs+-status") ; | |
2187 | push (@{$opt{ncv_build_args}}, "+ncsimargs+-status") ; | |
2188 | push (@{$opt{ncv_build_args}}, "+ncvlogargs+\"-nowarn MACRDF\"") ; | |
2189 | push (@{$opt{ncv_build_args}}, "+ncelabargs+-append_log") ; | |
2190 | push (@{$opt{ncv_build_args}}, "+ncelabargs+-pliverbose") ; | |
2191 | push (@{$opt{ncv_build_args}}, "+ncelabargs+-notimingchecks") ; | |
2192 | push (@{$opt{ncv_build_args}}, "+ncelabargs+-nospecify") ; | |
2193 | push (@{$opt{ncv_build_args}}, "+ncsimargs+-append_log") ; | |
2194 | push (@{$opt{ncv_build_args}}, "+loadpli1=debpli:novas_pli_boot") ; | |
2195 | push (@{$opt{ncv_build_args}}, "+loadpli1=libverapli:vera_pli_boot") ; | |
2196 | push (@{$opt{ncv_build_args}}, "+loadpli1=libmonitorpli:monitor_pli_boot") ; | |
2197 | push (@{$opt{ncv_build_args}}, "+loadpli1=libglobal_chkrpli:global_chkr_pli_boot") ; | |
2198 | push (@{$opt{ncv_build_args}}, "+loadpli1=libsocketpli:socket_pli_boot") ; | |
2199 | ||
2200 | ||
2201 | ||
2202 | if ( ($opt{sys} =~ m/fpga/)) { | |
2203 | push (@{$opt{ncv_build_args}}, "+ncelabargs+-initmem0") ; | |
2204 | } | |
2205 | ||
2206 | if ( ($opt{sys} eq "cmp1") or ($opt{sys} eq "cmp8") ) { | |
2207 | push (@{$opt{ncv_build_args}}, "+delay_mode_zero") ; | |
2208 | } | |
2209 | if ( ($opt{sys} eq "fc1") or ($opt{sys} eq "fc8") ) { | |
2210 | ## if ( !(grep {$_ eq '-DFC_NO_NIU_T2'} @{$opt{config_cpp_args}}) ) { | |
2211 | ## push (@{$opt{ncv_build_args}}, "+loadpli1=libniupli:niu_pli_boot") ; | |
2212 | ## push (@{$opt{ncv_build_args}}, "+loadpli1=libniu_sparse_mem_model_pli:sparse_mem_model_pli_boot") ; | |
2213 | ## my $vc_libs="+vera_directc="; | |
2214 | ## $vc_libs.="$ENV{DV_ROOT}/verif/env/common/vera/niu_ippktgen/C/libnet/src/libnet_niu_ippktgen_pli.so"; | |
2215 | ## $vc_libs.=":$ENV{DV_ROOT}/verif/model/verilog/niu/sparse_mem_model/loadpli/libniu_sparse_mem_model_pli.so"; | |
2216 | ## $vc_libs.=":$ENV{DV_ROOT}/verif/env/common/vera/niu_ippktgen/C/wrapper/libniu_ippktgen_pli.so"; | |
2217 | ## $vc_libs.=":$ENV{DV_ROOT}/verif/env/common/pli/niu_pli/loadpli/libpgRandom.so"; | |
2218 | ## push (@{$opt{ncv_build_args}}, "+ncsimargs+\"$vc_libs\"") ; | |
2219 | ## } | |
2220 | push (@{$opt{ncv_build_args}}, "+loadpli1=libcachepli:cache_pli_boot") ; | |
2221 | push (@{$opt{ncv_build_args}}, "+loadpli1=libutilitypli:utility_pli_boot") ; | |
2222 | push (@{$opt{ncv_build_args}}, "+loadpli1=libmemorypli:memory_pli_boot") ; | |
2223 | } | |
2224 | push (@{$opt{ncv_build_args}}, "-l ncprep.log") ; | |
2225 | push (@{$opt{ncv_build_args}}, "\`cat $model_path/flist\`") ; | |
2226 | push (@{$opt{ncv_build_args}}, "+define+NO_VERA") if (!$opt{vera_build}) ; | |
2227 | push (@{$opt{ncv_build_args}}, "+define+TCL_TAP_TEST") if ($opt{tcl_tap}) ; | |
2228 | ||
2229 | ||
2230 | my $ncv_build_cmd = "ncprep " ; | |
2231 | # Transfer some build args to the flist | |
2232 | open (IFLIST, "> flist.new") or die ("DIE. can't open flist.new") ; | |
2233 | foreach my $x (@{$opt{ncv_build_args}}) | |
2234 | { | |
2235 | $x =~ s/^"(.*?)"$/$1/ ; | |
2236 | if ($x =~ /\+define+|^-v |^-y |^-f (?!(flist|.*0in.*?\.arg))/) { | |
2237 | print IFLIST "$x\n"; | |
2238 | } else { | |
2239 | $ncv_build_cmd .= "$x " ; | |
2240 | } | |
2241 | } | |
2242 | ||
2243 | my $cache_dir; | |
2244 | if ($opt{cache}) | |
2245 | { | |
2246 | my $cache_dir_prefix = $ENV{TEMPDIR} ; | |
2247 | if ( !( -d $ENV{TEMPDIR} ) ) { system ("mkdir -p $ENV{TEMPDIR}") ; } | |
2248 | die ( "DIE. Could not access your temporary cache directory. \n") if ( !( -d $ENV{TEMPDIR} ) ) ; | |
2249 | if (-d $cache_dir_prefix ) | |
2250 | { | |
2251 | opendir D, $cache_dir_prefix or die (" Could not open directory \" ${cache_dir_prefix} \" for reading!\n"); | |
2252 | my @d = map { $cache_dir_prefix . "/" . $_ } grep { !/^\./ && -d "$cache_dir_prefix/$_" } readdir D ; closedir D; | |
2253 | ||
2254 | foreach (@d) { | |
2255 | if ( ( time - ( (stat $_ )->mtime ) ) > ( 60*60*$cache_clean_time ) ) { | |
2256 | system ( "/bin/rm -rf $_" ) ; | |
2257 | } | |
2258 | } | |
2259 | ||
2260 | $cache_dir = $cache_dir_prefix . "/OpenSPARC_T2___NC_Verilog___" . $opt{sys} . "___build" ; | |
2261 | my $count = 0; | |
2262 | while ( -d "${cache_dir}_${count}" ) { ++$count; } | |
2263 | $cache_dir .= "_$count" ; | |
2264 | system ("mkdir -p $cache_dir") ; | |
2265 | die ("DIE. Could not create temporary cache sub-directory for NC-Verilog compilation ") if ($?) ; | |
2266 | } | |
2267 | } | |
2268 | ||
2269 | # Append flist to flist.new and rename to flist. | |
2270 | open (FLIST, "flist") or die ("DIE. can't open flist"); | |
2271 | while (<FLIST>) { | |
2272 | print IFLIST "$_"; | |
2273 | } | |
2274 | close FLIST; | |
2275 | close IFLIST; | |
2276 | rename "flist", "flist.orig" or die ("DIE. can't rename flist"); | |
2277 | rename "flist.new", "flist" or die ("DIE. can't rename flist.new"); | |
2278 | ||
2279 | # build the model | |
2280 | print "$prg: Building rtl model\n" ; | |
2281 | print "$prg: <<<<<<< (BUILDTIME command) >>>>>>> $ncv_build_cmd\n"; | |
2282 | my $date1; | |
2283 | ||
2284 | ||
2285 | $date1 = `date` ; | |
2286 | chomp ($date1) ; | |
2287 | print "$prg: (DATE) $date1\n"; | |
2288 | ||
2289 | if ($opt{cache}) | |
2290 | { | |
2291 | print "$prg: will start compilation inside cache : \( " . $cache_dir . " \)\n"; | |
2292 | chdir $cache_dir ; | |
2293 | system ($ncv_build_cmd) ; | |
2294 | die ("DIE. failed ncprep translation for building model") if ($?) ; | |
2295 | } else { | |
2296 | print "$prg: will start compilation inside : \( " . $ENV{PWD} . " \)\n"; | |
2297 | system ($ncv_build_cmd) ; | |
2298 | } | |
2299 | ||
2300 | $date1 = `date` ; | |
2301 | chomp ($date1) ; | |
2302 | print "$prg: (DATE) $date1\n"; | |
2303 | system ("ncvlog -f ncvlog.args") ; | |
2304 | ||
2305 | $date1 = `date` ; | |
2306 | chomp ($date1) ; | |
2307 | print "$prg: (DATE) $date1\n"; | |
2308 | system ("echo \"LD_LIBRARY_PATH is: \" $ENV{LD_LIBRARY_PATH} > ncelab.log") ; | |
2309 | system ( "echo OpenSPARC_T2 compile dir is: $ENV{PWD} >> ncelab.log" ); | |
2310 | system ("ncelab -f ncelab.args") ; | |
2311 | system ("/bin/rm -rf RUN_NC"); | |
2312 | open F, "<cds.lib" or die "Can't open cds.lib for reading: $!\n" ; my @f=<F>; chomp @f; close F; | |
2313 | system ("/bin/rm -rf cds.lib") ; | |
2314 | open F, ">cds.lib" or die "Can't open cds.lib for writing: $!\n" ; | |
2315 | foreach (@f) { | |
2316 | s/^define\s(\w+)\s.*\/INCA_libs\/(\w+)$/define $1 $model_path\/INCA_libs\/$2/; | |
2317 | print F $_."\n"; | |
2318 | # print "cds\.lib\> ".$_."\n"; | |
2319 | } | |
2320 | close F; | |
2321 | ||
2322 | if ($opt{cache}) | |
2323 | { | |
2324 | print "$prg: will now copy the NC-Verilog simulation snapshot (INCA_libs) from cache to the original build directory. \n"; | |
2325 | system ("/bin/cp -rf INCA_libs cds.lib hdl.var *args *log $model_path"); | |
2326 | sleep(30); | |
2327 | } | |
2328 | ||
2329 | # go back to where the script was invoked | |
2330 | chdir $cur_dir ; | |
2331 | if ($opt{parallel}) { | |
2332 | print "$prg: removing cache dir.\n" ; | |
2333 | system ( " /bin/rm -rf $cache_dir " ) ; | |
2334 | } | |
2335 | } | |
2336 | ||
2337 | # building using VCS | |
2338 | ||
2339 | sub vcs_build | |
2340 | { | |
2341 | my $cur_dir = $ENV{PWD}; | |
2342 | ||
2343 | ||
2344 | ||
2345 | # go to the model area | |
2346 | chdir $model_path or die ("DIE. Can't cd to $model_path") ; | |
2347 | ||
2348 | # copy the sdf file | |
2349 | my $sdf_file = "$opt{env_base}/cmp_top.sdf" ; | |
2350 | `cp -f $sdf_file .` if (($opt{vcs_use_sdf}) and (-f $sdf_file)) ; | |
2351 | ||
2352 | $ENV{VERA_LIBDIR} = "$model_path/vera"; | |
2353 | print "$prg: setenv VERA_LIBDIR $ENV{VERA_LIBDIR}\n"; | |
2354 | ||
2355 | ||
2356 | if($proj_vars{has_denali}) { | |
2357 | # figure out the location of denali from tre | |
2358 | my $denali_home = (defined $ENV{DENALI_HOME})? $ENV{DENALI_HOME} : | |
2359 | "/import/datools/vendor/denali/v" ; | |
2360 | $denali_home .= `configsrch denali_pcie /` ; | |
2361 | chomp ($denali_home) ; | |
2362 | die ("DIE. Append _64bit to your denali version in your tver file to work with 64 bit vcs") if (($denali_home !~ /_64bit/) && ($opt{vcs_full64})); | |
2363 | die ("DIE. Conflict between 64 bit denali version in your tver file and 32 bit vcs") if (($denali_home =~ /_64bit/) && (!$opt{vcs_full64})); | |
2364 | $ENV{DENALI} = $denali_home ; | |
2365 | print "$prg: setenv DENALI $ENV{DENALI}\n"; | |
2366 | } | |
2367 | ||
2368 | # figure out the location of 0in from tre | |
2369 | # my $zeroIn_home = "/import/cadist-sme/pkgs/zeroin/zeroin,v" ; | |
2370 | # $zeroIn_home .= `configsrch zeroin /` ; | |
2371 | # chomp ($zeroIn_home) ; | |
2372 | # $zeroIn_home .= "/5.x/sol8_sparc" ; | |
2373 | # if ($opt{vcs_full64}) { | |
2374 | # $zeroIn_home .= "/5.x/sol8_sparc_64" ; | |
2375 | # } | |
2376 | # $ENV{HOME_0IN} = $zeroIn_home ; | |
2377 | # print "$prg: setenv HOME_0IN $ENV{HOME_0IN}\n"; | |
2378 | ||
2379 | if (exists $ENV{LM_LICENSE_FILE}) | |
2380 | { | |
2381 | print "$prg: LM_LICENSE_FILE : $ENV{LM_LICENSE_FILE}\n"; | |
2382 | } | |
2383 | ||
2384 | push (@{$opt{vcs_build_args}}, "+compsdf") if ($opt{vcs_use_sdf}) ; | |
2385 | push (@{$opt{vcs_build_args}}, "+rad") if ($opt{vcs_use_rad}) ; | |
2386 | push (@{$opt{vcs_build_args}}, "-Xmodname=0x1"); | |
2387 | push (@{$opt{vcs_build_args}}, "+vcsd") if ($opt{vcs_use_fsdb} and $opt{vcs_use_vcsd}) ; | |
2388 | push (@{$opt{vcs_build_args}}, "-vera") if ($opt{vcs_use_vera}) ; | |
2389 | ||
2390 | push (@{$opt{vcs_build_args}}, "-file $model_path/vera/ntb_flist") if ($opt{vcs_use_ntb}) ; | |
2391 | push (@{$opt{vcs_build_args}}, "+initreg") if ($opt{vcs_use_initreg}) ; | |
2392 | push (@{$opt{vcs_build_args}}, "-cm $opt{vcs_cm_args}") if ($opt{vcs_use_cm}) ; | |
2393 | push (@{$opt{vcs_build_args}}, "-cm_cond $opt{vcs_cm_cond}") if ($opt{vcs_use_cm} and ($opt{vcs_cm_cond} ne "")) ; | |
2394 | push (@{$opt{vcs_build_args}}, "-cm_fsmcfg $opt{vcs_cm_fsmcfg}") if ($opt{vcs_use_cm} and ($opt{vcs_cm_fsmcfg} ne "")) ; | |
2395 | push (@{$opt{vcs_build_args}}, "-cm_hier $opt{vcs_cm_config}") if ($opt{vcs_use_cm} and ($opt{vcs_cm_config} ne "")) ; | |
2396 | push (@{$opt{vcs_build_args}}, "-cm_name $opt{vcs_cm_name}") if ($opt{vcs_use_cm}) ; | |
2397 | push (@{$opt{vcs_build_args}}, "-cm_dir $model_path") if ($opt{vcs_use_cm}) ; | |
2398 | push (@{$opt{vcs_build_args}}, "+cli -line") if (!$opt{axis_build} && $opt{vcs_use_cli}) ; | |
2399 | push (@{$opt{vcs_build_args}}, "-debug_all") if (!$opt{axis_build} && $opt{vcs_use_ucli}) ; | |
2400 | my $u=`uname -s`;chomp $u;my $lib_dir; | |
2401 | if ($u eq "SunOS") { | |
2402 | $lib_dir = "SOLARIS2"; | |
2403 | if ($opt{vcs_full64}) { $lib_dir = "SOL7_64bit"; } | |
2404 | } | |
2405 | elsif ($u eq "Linux") { | |
2406 | $lib_dir = "LINUX"; | |
2407 | if ($opt{vcs_full64}) { $lib_dir = "LINUX64"; } | |
2408 | } | |
2409 | if ($opt{vcs_use_fsdb}) { | |
2410 | if ($opt{vcs_use_vcsd}) { | |
2411 | my $a=`configsrch debussy_vcsd /`; chomp $a; | |
2412 | push (@{$opt{vcs_build_args}}, "-P $ENV{NOVAS_HOME}/share/PLI/vcsd" . $a . "/$lib_dir/vcsd.tab") ; | |
2413 | push (@{$opt{vcs_build_args}}, "$ENV{NOVAS_HOME}/share/PLI/vcsd" . $a . "/$lib_dir/pli.a") ; | |
2414 | } | |
2415 | else { | |
2416 | my $a=`configsrch debussy_vcs /`; chomp $a; | |
2417 | push (@{$opt{vcs_build_args}}, "-P $ENV{NOVAS_HOME}/share/PLI/vcs" . $a . "/$lib_dir/debussy.tab") ; | |
2418 | push (@{$opt{vcs_build_args}}, "$ENV{NOVAS_HOME}/share/PLI/vcs" . $a . "/$lib_dir/pli.a") ; | |
2419 | } | |
2420 | } | |
2421 | else { push (@{$opt{vcs_build_args}}, "+define+FSDB_OFF") ; } | |
2422 | ||
2423 | push (@{$opt{vcs_build_args}}, "+define+NO_VERA") if (!$opt{vera_build}) ; | |
2424 | push (@{$opt{vcs_build_args}}, "+define+TCL_TAP_TEST") if ($opt{tcl_tap}) ; | |
2425 | push (@{$opt{vcs_build_args}}, "-full64") if ($opt{vcs_full64}) ; | |
2426 | push (@{$opt{vcs_build_args}}, "-l compile.log") ; | |
2427 | push (@{$opt{vcs_build_args}}, "-f flist") ; | |
2428 | ||
2429 | if ($opt{zeroIn_build}) | |
2430 | { | |
2431 | push (@{$opt{vcs_build_args}}, "$ENV{HOME_0IN}/0InPLI/vcs/lib0InvcsPLI.so") ; | |
2432 | push (@{$opt{vcs_build_args}}, "-f $model_path/zeroInDir/0in_sim.arg") ; | |
2433 | } | |
2434 | ||
2435 | if ($opt{zeroInSearch_build}) | |
2436 | { | |
2437 | push (@{$opt{vcs_build_args}}, "$ENV{HOME_0IN}/0InPLI/vcs/lib0InvcsPLI.so") ; | |
2438 | push (@{$opt{vcs_build_args}}, "-f $model_path/zeroInDir/0in_seed.arg") ; | |
2439 | } | |
2440 | my $vcs_build_cmd = "vcs " ; | |
2441 | $vcs_build_cmd = "tharas_compile -project $opt{sys} -comp_options \' " | |
2442 | if ($opt{hcs_build}) ; | |
2443 | $vcs_build_cmd = "axis_compile -project $opt{sys} -comp_options \' " | |
2444 | if ($opt{axis_build}) ; | |
2445 | ||
2446 | # Transfer some build args to the flist | |
2447 | open (IFLIST, "> flist.new") or die ("DIE. can't open flist.new") ; | |
2448 | foreach my $x (@{$opt{vcs_build_args}}) { | |
2449 | $x =~ s/^"(.*?)"$/$1/ ; | |
2450 | if ($opt{hcs_build} && ($x !~ /^\+def|^-P |^-l |^-v |^-f |^-P |\.a\s*$/)) { | |
2451 | $x = "+hcs+vcsFlags \"$x\"" ; | |
2452 | } | |
2453 | elsif ($opt{axis_build} && ($x =~ /\.a\s*$|\.[s]*o\s*$/)) { | |
2454 | $x =~ s/\+vc\b//; | |
2455 | $x = "-pl $x" ; | |
2456 | } | |
2457 | elsif ($x =~ /\+define+|^-v |^-y |^-f (?!(flist|.*0in.*?\.arg))/) { | |
2458 | print IFLIST "$x\n"; | |
2459 | } else { | |
2460 | if ($x=~m/^-f flist$/) { $x=~s/flist/$model_path\/flist/; } | |
2461 | if ($x=~m/^ \+vc (vera\/\w+\.(o|a))$/) { my $y = " +vc " . $model_path . "/" . $1; $x = $y; } | |
2462 | $vcs_build_cmd .= "$x " ; | |
2463 | } | |
2464 | } | |
2465 | ||
2466 | # Tharas Build args | |
2467 | if ($opt{hcs_build}) { | |
2468 | $vcs_build_cmd .= " \' " ; | |
2469 | foreach my $x (@{$opt{hcs_build_args}}) | |
2470 | { | |
2471 | $x =~ s/^"(.*?)"$/$1/ ; | |
2472 | $vcs_build_cmd .= "$x " ; | |
2473 | } | |
2474 | if($opt{vcs_clean}) { | |
2475 | $vcs_build_cmd .= " -clean " ; | |
2476 | } | |
2477 | } | |
2478 | ||
2479 | # Palladium Build args | |
2480 | # No -vcs_build_args passed to palladium_compile | |
2481 | if ($opt{palladium_build}) { | |
2482 | $vcs_build_cmd = "palladium_compile -project $opt{sys} " ; | |
2483 | foreach my $x (@{$opt{palladium_build_args}}) | |
2484 | { | |
2485 | $x =~ s/^"(.*?)"$/$1/ ; | |
2486 | $vcs_build_cmd .= "$x " ; | |
2487 | } | |
2488 | if($opt{vcs_clean}) { | |
2489 | $vcs_build_cmd .= " -clean " ; | |
2490 | } | |
2491 | } | |
2492 | ||
2493 | # Axis Build args | |
2494 | if ($opt{axis_build}) { | |
2495 | $vcs_build_cmd .= " \' " ; | |
2496 | foreach my $x (@{$opt{axis_build_args}}) | |
2497 | { | |
2498 | $x =~ s/^"(.*?)"$/$1/ ; | |
2499 | $vcs_build_cmd .= "$x " ; | |
2500 | } | |
2501 | if($opt{vcs_clean}) { | |
2502 | $vcs_build_cmd .= " -clean " ; | |
2503 | } | |
2504 | } | |
2505 | ||
2506 | ||
2507 | my $cache_dir; | |
2508 | if ($opt{cache}) | |
2509 | { | |
2510 | my $cache_dir_prefix = $ENV{TEMPDIR} ; | |
2511 | if ( !( -d $ENV{TEMPDIR} ) ) { system ("mkdir -p $ENV{TEMPDIR}") ; } | |
2512 | die ( "DIE. Could not access your temporary cache directory. \n") if ( !( -d $ENV{TEMPDIR} ) ) ; | |
2513 | if (-d $cache_dir_prefix ) | |
2514 | { | |
2515 | opendir D, $cache_dir_prefix or die (" Could not open directory \" ${cache_dir_prefix} \" for reading!\n"); | |
2516 | my @d = map { $cache_dir_prefix . "/" . $_ } grep { !/^\./ && -d "$cache_dir_prefix/$_" } readdir D ; closedir D; | |
2517 | ||
2518 | foreach (@d) { | |
2519 | if ( ( time - ( (stat $_ )->mtime ) ) > ( 60*60*$cache_clean_time ) ) { | |
2520 | system ( "/bin/rm -rf $_" ) ; | |
2521 | } | |
2522 | } | |
2523 | ||
2524 | $cache_dir = $cache_dir_prefix . "/OpenSPARC_T2___VCS___" . $opt{sys} . "___build" ; | |
2525 | my $count = 0; | |
2526 | while ( -d "${cache_dir}_${count}" ) { ++$count; } | |
2527 | $cache_dir .= "_$count" ; | |
2528 | system ("mkdir -p $cache_dir") ; | |
2529 | die ("DIE. Could not create temporary cache sub-directory for VCS compilation ") if ($?) ; | |
2530 | } | |
2531 | } | |
2532 | ||
2533 | # Append flist to flist.new and rename to flist. | |
2534 | open (FLIST, "flist") or die ("DIE. can't open flist"); | |
2535 | while (<FLIST>) { | |
2536 | print IFLIST "$_"; | |
2537 | } | |
2538 | close FLIST; | |
2539 | close IFLIST; | |
2540 | rename "flist", "flist.orig" or die ("DIE. can't rename flist"); | |
2541 | rename "flist.new", "flist" or die ("DIE. can't rename flist.new"); | |
2542 | ||
2543 | # build the model | |
2544 | print "$prg: Building rtl model\n" ; | |
2545 | print "$prg: <<<<<<< (BUILDTIME command) >>>>>>> $vcs_build_cmd\n"; | |
2546 | ||
2547 | my $date1 = `date` ; | |
2548 | chomp ($date1) ; | |
2549 | print "$prg: (DATE) $date1\n"; | |
2550 | if ($opt{cache}) | |
2551 | { | |
2552 | print "$prg: will start compilation inside cache : \( " . $cache_dir . " \)\n"; | |
2553 | chdir $cache_dir ; | |
2554 | print "Current dir: ". &Cwd::cwd() << "\n"; | |
2555 | #ifdef SYSTEMC_SUPPORT | |
2556 | if ($opt{sysc_build}) { | |
2557 | my $build_args = ""; | |
2558 | ||
2559 | foreach my $x (@{$opt{syscan_build_args}}) | |
2560 | { | |
2561 | $build_args .= "$x "; | |
2562 | } | |
2563 | print "Build args being passed to syscan $build_args\n"; | |
2564 | ||
2565 | my $syscan_cmd = "$ENV{DV_ROOT}/tools/bin/syscan_cmd_src"; | |
2566 | system("exec perl $syscan_cmd $build_args"); | |
2567 | die ("DIE. Failed systemc build") if ($?); | |
2568 | } | |
2569 | #endif | |
2570 | system ($vcs_build_cmd); | |
2571 | system ( "echo OpenSPARC_T2 compile dir is: $ENV{PWD} >> compile.log" ); | |
2572 | print "$prg: will now copy the simulation binary (simv) and the direct access interface directory (simv.daidir) from cache to the original build directory. \n"; | |
2573 | system ( " /bin/rm -rf csrc" ) ; | |
2574 | system ( "/bin/cp -rf simv simv.daidir compile.log $model_path" ) ; | |
2575 | if (-d "simv.cm") { system ( "/bin/cp -rf simv.cm $model_path" ) ; } | |
2576 | if (-d "simv.vdb") { system ( "/bin/cp -rf simv.vdb $model_path" ) ; } | |
2577 | sleep(30); | |
2578 | } | |
2579 | else { | |
2580 | print "$prg: will start compilation inside : \( " . $ENV{PWD} . " \)\n"; | |
2581 | #ifdef SYSTEMC_SUPPORT | |
2582 | if ($opt{sysc_build}) { | |
2583 | my $build_args = ""; | |
2584 | ||
2585 | foreach my $x (@{$opt{syscan_build_args}}) | |
2586 | { | |
2587 | $build_args .= "$x "; | |
2588 | } | |
2589 | print "Build args being passed to syscan $build_args\n"; | |
2590 | ||
2591 | my $syscan_cmd = "$ENV{DV_ROOT}/tools/bin/syscan_cmd_src"; | |
2592 | system("exec perl $syscan_cmd $build_args"); | |
2593 | die ("DIE. Failed systemc build") if ($?); | |
2594 | } | |
2595 | #endif | |
2596 | system ($vcs_build_cmd); | |
2597 | } | |
2598 | ||
2599 | # go back to where the script was invoked | |
2600 | chdir $cur_dir ; | |
2601 | if ($opt{parallel}) { | |
2602 | print "$prg: removing cache dir.\n" ; | |
2603 | system ( " /bin/rm -rf $cache_dir " ) ; | |
2604 | } | |
2605 | } | |
2606 | ||
2607 | #############################################################################}}} | |
2608 | # parsing the user supplied non primitive list to obtain the sunv primitive list{{{ | |
2609 | ################################################################################ | |
2610 | ||
2611 | sub parse_primitive | |
2612 | { | |
2613 | my $cur_dir = $ENV{PWD}; | |
2614 | ||
2615 | my %nonlist = (); | |
2616 | ||
2617 | chdir $model_path; | |
2618 | ||
2619 | die "DIE. Could not find non primitive list\n" if (! (-f $opt{sunv_nonprim_list})) ; | |
2620 | system ("cp -f $opt{sunv_nonprim_list} $model_path") ; | |
2621 | die ("DIE. failed to copy non primitive list to model build area\n") if ($?) ; | |
2622 | ||
2623 | die "DIE. Could not find primitive list\n" if (! (-f "$dv_root/$proj_vars{sims_config}/primitive.list")) ; | |
2624 | system ("cp -f $dv_root/$proj_vars{sims_config}/primitive.list $model_path") ; | |
2625 | die ("DIE. failed to copy primitive list to model build area\n") if ($?) ; | |
2626 | ||
2627 | $opt{sunv_nonprim_list} =~ /(\S+)\/(\S+)$/; | |
2628 | open (NONLIST, "$2"); | |
2629 | while (<NONLIST>) | |
2630 | { | |
2631 | $nonlist{$_} = 1; | |
2632 | } | |
2633 | close (NONLIST) ; | |
2634 | ||
2635 | open (LIST, ">newprimitive.list"); | |
2636 | ||
2637 | open (FULLLIST, "primitive.list"); | |
2638 | while (<FULLLIST>) | |
2639 | { | |
2640 | if (! defined $nonlist{$_}) | |
2641 | { | |
2642 | print LIST $_; | |
2643 | } | |
2644 | } | |
2645 | close (FULLLIST) ; | |
2646 | ||
2647 | close (LIST) ; | |
2648 | ||
2649 | push (@{$opt{sunv_args}}, "-primitives=$model_path/newprimitive.list"); | |
2650 | ||
2651 | # go back to where the script was invoked | |
2652 | chdir $cur_dir ; | |
2653 | } | |
2654 | ||
2655 | #############################################################################}}} | |
2656 | # run sunv {{{ | |
2657 | ################################################################################ | |
2658 | ||
2659 | sub sunv_run | |
2660 | { | |
2661 | my $cur_dir = $ENV{PWD}; | |
2662 | ||
2663 | print "$prg: sunv_start ",`date` ; | |
2664 | ||
2665 | # go to the model area | |
2666 | chdir $model_path or die ("DIE. Can't cd to $model_path\n") ; | |
2667 | ||
2668 | # create sunv output directory | |
2669 | system ("mkdir -p sunvDir"); | |
2670 | ||
2671 | # generate the primitive list if a non primitive list is supplied | |
2672 | if ($opt{sunv_use_nonprim}) | |
2673 | { | |
2674 | &parse_primitive; | |
2675 | } | |
2676 | ||
2677 | # run sunv | |
2678 | print "$prg: Running sunv\n" ; | |
2679 | my $sunv_cmd = "sunv.fe "; | |
2680 | push (@{$opt {sunv_args}}, "-outdir=sunvDir") ; | |
2681 | $sunv_cmd .= join (" ", @{$opt {sunv_args}}) ; | |
2682 | ||
2683 | print "$prg: $sunv_cmd\n"; | |
2684 | system ("rm -fr sunvDir/*") ; | |
2685 | die ("DIE. failed cleaning up sunvDir\n") if ($?) ; | |
2686 | system ($sunv_cmd) ; | |
2687 | die ("DIE. failed running sunv\n") if ($?) ; | |
2688 | ||
2689 | print "$prg: creating sunv flist file\n" ; | |
2690 | ||
2691 | open (SUNVFILE, "> $model_path/flist_sunv") or die ("DIE. could not create sunv flist file\n") ; | |
2692 | ||
2693 | opendir (LIBDIR, "sunvDir") or die ("DIE. can't open sunvDir directory\n") ; | |
2694 | my @filenames = readdir LIBDIR ; | |
2695 | closedir (LIBDIR) ; | |
2696 | ||
2697 | foreach my $filename (@filenames) | |
2698 | { | |
2699 | if ($filename =~ /\.v$/) | |
2700 | { | |
2701 | print SUNVFILE ("$model_path/sunvDir/$filename\n") ; | |
2702 | } | |
2703 | } | |
2704 | ||
2705 | close (SUNVFILE) ; | |
2706 | ||
2707 | print "$prg: sunv_stop ",`date` ; | |
2708 | ||
2709 | # go back to where the script was invoked | |
2710 | chdir $cur_dir ; | |
2711 | } | |
2712 | ||
2713 | #############################################################################}}} | |
2714 | # compile zeroIn {{{ | |
2715 | ################################################################################ | |
2716 | ||
2717 | sub zeroIn_build | |
2718 | { | |
2719 | my $cur_dir = $ENV{PWD}; | |
2720 | ||
2721 | print "$prg: 0in_start ",`date` ; | |
2722 | ||
2723 | # go to the model area | |
2724 | chdir $model_path or die ("DIE. Can't cd to $model_path\n") ; | |
2725 | ||
2726 | my $zeroIn_dir = "zeroInDir"; | |
2727 | # go to the zeroIn dir | |
2728 | system ("mkdir -p $zeroIn_dir"); | |
2729 | ||
2730 | chdir $zeroIn_dir or die ("DIE. Can't cd to $zeroIn_dir\n") ; | |
2731 | ||
2732 | # Debug args if any .. | |
2733 | my $zin_dbg .= join (" ", @{$opt {zeroIn_dbg_args}}) ; | |
2734 | ||
2735 | # compile zeroIn | |
2736 | print "$prg: compiling zeroIn\n" ; | |
2737 | ||
2738 | # zeroIn can't handle NTB_LIB shell file so take it out. | |
2739 | system("cat $model_path/flist | grep -v top_shell.v > $model_path/flist.0in"); | |
2740 | die "$prg: failed to make zeroIn flist file. \n" if($?); | |
2741 | ||
2742 | # zeroIn compile command | |
2743 | my $zeroIn_build_cmd ; | |
2744 | $zeroIn_build_cmd = "0in $zin_dbg -cmd ccl -f $model_path/flist.0in " if ($opt{zeroIn_build}) ; | |
2745 | $zeroIn_build_cmd = "0in $zin_dbg -cmd csl -f $model_path/flist.0in " if ($opt{zeroInSearch_build}) ; | |
2746 | $zeroIn_build_cmd = "0in $zin_dbg -cmd ckl -f $model_path/flist.0in " if ($opt{zeroIn_checklist}) ; | |
2747 | $zeroIn_build_cmd .= join (" ", @{$opt {zeroIn_build_args}}) ; | |
2748 | ||
2749 | print "$prg: $zeroIn_build_cmd\n"; | |
2750 | # produce 0in_sim.arg file | |
2751 | system ($zeroIn_build_cmd) ; | |
2752 | die ("DIE. failed compiling zeroIn\n") if ($?) ; | |
2753 | ||
2754 | print "$prg: 0in_stop ",`date` ; | |
2755 | ||
2756 | # go back to where the script was invoked | |
2757 | chdir $cur_dir ; | |
2758 | } | |
2759 | ||
2760 | #############################################################################}}} | |
2761 | # run vlint {{{ | |
2762 | ################################################################################ | |
2763 | ||
2764 | sub vlint_run | |
2765 | { | |
2766 | my $cur_dir = $ENV{PWD}; | |
2767 | ||
2768 | # Keeping vlint output in current directory | |
2769 | ||
2770 | system ("mkdir -p vlintDir") ; | |
2771 | ||
2772 | # run vlint | |
2773 | print "$prg: Running vlint\n" ; | |
2774 | my $vlint_cmd = "x2e "; | |
2775 | ||
2776 | push (@{$opt {vlint_args}}, "-f $model_path/flist") ; | |
2777 | push (@{$opt {vlint_args}}, "-od vlintDir ") ; | |
2778 | ||
2779 | # always last | |
2780 | die "DIE. no top level module specified for vlint" if ($opt{vlint_top} eq "") ; | |
2781 | push (@{$opt {vlint_args}}, $opt{vlint_top}) ; | |
2782 | ||
2783 | $vlint_cmd .= join (" ", @{$opt {vlint_args}}) ; | |
2784 | ||
2785 | print "$prg: $vlint_cmd\n"; | |
2786 | ||
2787 | system ($vlint_cmd) ; my $status = $? ; | |
2788 | if ($opt{illust_run}) { | |
2789 | my $illust_cmd = "illust "; | |
2790 | $illust_cmd .= join(" ", @{$opt {illust_args}}) ; | |
2791 | chdir ("vlintDir"); | |
2792 | if (-e "$opt{vlint_top}.vlint.db") { | |
2793 | `cp -f $opt{vlint_top}.vlint.db vlint.db` ; | |
2794 | } | |
2795 | print "$prg: $illust_cmd\n"; | |
2796 | system ($illust_cmd) ; my $status = $? ; | |
2797 | chdir ($cur_dir); | |
2798 | die ("DIE. status=$status: failed running illust \n\t(see vlintDir/{di.log,errors.vlint})\n ") | |
2799 | if ($status == 1) ; | |
2800 | } | |
2801 | die ("DIE. failed running vlint") if ($status == 1) ; | |
2802 | } | |
2803 | ||
2804 | #############################################################################}}} | |
2805 | # run verix {{{ | |
2806 | ################################################################################ | |
2807 | ||
2808 | sub verix_run | |
2809 | { | |
2810 | my $cur_dir = $ENV{PWD}; | |
2811 | ||
2812 | # Keeping Verix output in current directory | |
2813 | ||
2814 | system ("mkdir -p verixDir") ; | |
2815 | chdir("verixDir"); | |
2816 | ||
2817 | # Run verix | |
2818 | print "$prg: Running verix flow\n" ; | |
2819 | ||
2820 | die "DIE. no top level module specified for verix" if ($opt{verix_top} eq "") ; | |
2821 | ||
2822 | # Copy the template | |
2823 | system ("cp $dv_root/verif/env/config/$opt{verix_top}.verix.tmplt verix.tmplt"); | |
2824 | system("chmod +w verix.tmplt"); | |
2825 | die "DIE. could not copy verix template $dv_root/verif/env/config/$opt{verix_top}.verix.tmplt, $!" if ($?); | |
2826 | ||
2827 | # Create the vlist using the flist_sunv and the libs specified | |
2828 | open (VLIST, ">$opt{verix_top}.vlist"); | |
2829 | die "DIE. could not create $opt{verix_top}.vlist, $!" if ($?); | |
2830 | ||
2831 | print VLIST "-f $model_path/flist_sunv\n"; | |
2832 | print VLIST "$model_path/config.v\n"; | |
2833 | ||
2834 | # Pick up libs and defines from vcs_build args too .. | |
2835 | ||
2836 | foreach (@{$opt{verix_libs}},@{$opt{vcs_build_args}}) { | |
2837 | s/"//go; #" | |
2838 | next if (!/(^\+define)|(^-f)|(^-v)|(^-y)/); | |
2839 | print VLIST "$_\n"; | |
2840 | } | |
2841 | close VLIST; | |
2842 | ||
2843 | # Run the setup | |
2844 | my $verix_cmd = "verix_flow -setup $opt{verix_top} "; | |
2845 | ||
2846 | print "$prg: $verix_cmd \n"; | |
2847 | ||
2848 | system ("$verix_cmd") ; | |
2849 | die ("DIE. failed running verix") if ($?) ; | |
2850 | ||
2851 | # Run the run script | |
2852 | $verix_cmd = "verix_flow -run $opt{verix_top} "; | |
2853 | ||
2854 | print "$prg: $verix_cmd \n"; | |
2855 | ||
2856 | system ("$verix_cmd") ; | |
2857 | die ("DIE. failed running verix") if ($?) ; | |
2858 | chdir($cur_dir); | |
2859 | } | |
2860 | ||
2861 | #############################################################################}}} | |
2862 | # run tests | |
2863 | ################################################################################ | |
2864 | ||
2865 | ||
2866 | sub list { | |
2867 | my %tmp1; my %tmp2; | |
2868 | for (0..1) { for my $k (@{$_[$_]}) { $tmp1{$k}.=$_; } } | |
2869 | while (my($k,$v)=each %tmp1) {push @{$tmp2{$v}},$k;} | |
2870 | return @tmp2{"0","1","01"}, [keys %tmp1]; | |
2871 | } | |
2872 | ||
2873 | ||
2874 | # run a test using simulation snapshot created from NCV | |
2875 | ||
2876 | sub ncv_run | |
2877 | { | |
2878 | my $run_dir = $ENV{PWD} ; | |
2879 | my $cache_dir; | |
2880 | if ($opt{cache}) | |
2881 | { | |
2882 | my $cache_dir_prefix = $ENV{TEMPDIR} ; | |
2883 | if ( !( -d $ENV{TEMPDIR} ) ) { system ("mkdir -p $ENV{TEMPDIR}") ; } | |
2884 | die ( "DIE. Could not access your temporary cache directory. \n") if ( !( -d $ENV{TEMPDIR} ) ) ; | |
2885 | if (-d $cache_dir_prefix ) | |
2886 | { | |
2887 | opendir D, $cache_dir_prefix or die (" Could not open directory \" ${cache_dir_prefix} \" for reading!\n"); | |
2888 | my @d = map { $cache_dir_prefix . "/" . $_ } grep { !/^\./ && -d "$cache_dir_prefix/$_" } readdir D ; closedir D; | |
2889 | ||
2890 | foreach (@d) { | |
2891 | if ( ( time - ( (stat $_ )->mtime ) ) > ( 60*60*$cache_clean_time ) ) { | |
2892 | system ( "/bin/rm -rf $_" ) ; | |
2893 | } | |
2894 | } | |
2895 | ||
2896 | $cache_dir = $cache_dir_prefix . "/OpenSPARC_T2___NC_Verilog___" . $opt{sys} . "___run" ; | |
2897 | my $count = 0; | |
2898 | while ( -d "${cache_dir}_${count}" ) { ++$count; } | |
2899 | $cache_dir .= "_$count" ; | |
2900 | system ("mkdir -p $cache_dir") ; | |
2901 | die ("DIE. Could not create temporary cache sub-directory for NC-Verilog run ") if ($?) ; | |
2902 | } | |
2903 | } | |
2904 | ||
2905 | # copy the diff release over | |
2906 | system ("cp -f $model_path/diff_rel.log .") if (-f "$model_path/diff_rel.log") ; | |
2907 | ||
2908 | # copy the flist over | |
2909 | system ("cp -f $model_path/flist .") ; | |
2910 | die ("DIE. could not copy flist to $ENV{PWD}") if ($?) ; | |
2911 | ||
2912 | # pass the good trap and bad trap addresses to the testbench | |
2913 | my $good_trap = ""; | |
2914 | my $bad_trap = ""; | |
2915 | ||
2916 | if (($opt{asm_diag_name} ne "") or ($opt{image_diag_name} ne "")) | |
2917 | { | |
2918 | die ("DIE. could not find symbol.tbl file") if (!-f "symbol.tbl") ; | |
2919 | ||
2920 | my @good_trap_list = `grep -w good_trap symbol.tbl`; | |
2921 | my @bad_trap_list = `grep -w bad_trap symbol.tbl`; | |
2922 | my %good_trap_list ; | |
2923 | my %bad_trap_list ; | |
2924 | my @good_trap ; | |
2925 | my @bad_trap ; | |
2926 | ||
2927 | if ($#good_trap_list >= 0) | |
2928 | { | |
2929 | foreach my $trap (@good_trap_list) | |
2930 | { | |
2931 | my ($tmp1, $va, $ra, $pa) = ($trap =~ /([\w_\.]+)\s+(\w+)\s+(\w+)\s+(\w+)/) ; | |
2932 | $good_trap_list{$pa} = 1 ; | |
2933 | } | |
2934 | ||
2935 | foreach my $x (sort (keys (%good_trap_list))) | |
2936 | { | |
2937 | push (@good_trap, $x) ; | |
2938 | } | |
2939 | ||
2940 | if ($#good_trap == 0) { $good_trap = "+good_trap=" . $good_trap[0] ; } | |
2941 | else { $good_trap = "+good_trap=" . join (':', @good_trap) ; } | |
2942 | } | |
2943 | ||
2944 | if ($#bad_trap_list >= 0) | |
2945 | { | |
2946 | foreach my $trap (@bad_trap_list) | |
2947 | { | |
2948 | my ($tmp1, $va, $ra, $pa) = ($trap =~ /([\w_\.]+)\s+(\w+)\s+(\w+)\s+(\w+)/) ; | |
2949 | $bad_trap_list{$pa} = $pa; | |
2950 | } | |
2951 | ||
2952 | foreach my $x (sort (keys (%bad_trap_list))) | |
2953 | { | |
2954 | push (@bad_trap, $x) ; | |
2955 | } | |
2956 | ||
2957 | if ($#bad_trap == 0) { $bad_trap = "+bad_trap=" . $bad_trap[0] ; } | |
2958 | else { $bad_trap = "+bad_trap=" . join (':', @bad_trap) ; } | |
2959 | } | |
2960 | } | |
2961 | ||
2962 | # copy the 'traditional vera' project file over to the run area | |
2963 | ||
2964 | if ( $opt{vera_run}) | |
2965 | { | |
2966 | `cp $model_path/vera/$opt{sys}_top.proj .` ; | |
2967 | die ("DIE. could not copy .proj file to $ENV{PWD}") if ($?) ; | |
2968 | `chmod +w $opt{sys}_top.proj`; | |
2969 | die ("DIE. could not change permission of .proj file") if ($?) ; | |
2970 | ||
2971 | # append diag.vro after the fact | |
2972 | if ($opt{vera_diag_name} ne "" or $opt{vera_dummy_diag} ne "") | |
2973 | { | |
2974 | push (@{$opt{ncv_run_args}}, "+vera_diag_path=$opt{vera_diag_path}") ; | |
2975 | `ls *.vro >> $opt{sys}_top.proj` ; | |
2976 | die ("DIE. could not append *.vro to vera project file") if ($?) ; | |
2977 | } | |
2978 | } | |
2979 | ||
2980 | # add in switches for signal dumping | |
2981 | ||
2982 | if ($opt{vcd}) | |
2983 | { | |
2984 | my $vcdfile = ""; | |
2985 | if ($opt{vcdfile} eq "") | |
2986 | { | |
2987 | $vcdfile = "verilog.vcd" ; | |
2988 | } else | |
2989 | { | |
2990 | $vcdfile = $opt{vcdfile} ; | |
2991 | } | |
2992 | ||
2993 | push (@{$opt{ncv_run_args}}, "+vcd") ; | |
2994 | } | |
2995 | ||
2996 | if ($opt{debussy}) | |
2997 | { | |
2998 | my $fsdbfile = ""; | |
2999 | if ($opt{fsdbfile} eq "") | |
3000 | { | |
3001 | $fsdbfile = "verilog.fsdb" ; | |
3002 | } else | |
3003 | { | |
3004 | $fsdbfile = $opt{fsdbfile} ; | |
3005 | } | |
3006 | ||
3007 | push (@{$opt{ncv_run_args}}, "+debussy") ; | |
3008 | push (@{$opt{ncv_run_args}}, "+fsdbfile=$fsdbfile") ; | |
3009 | push (@{$opt{ncv_run_args}}, "+fsdb+dumpon+".bigtime2plus($opt{start_dump})) if ($opt{start_dump} != 0) ; | |
3010 | push (@{$opt{ncv_run_args}}, "+fsdb+dumpoff+".bigtime2plus($opt{stop_dump})) if ($opt{stop_dump} != 0) ; | |
3011 | push (@{$opt{ncv_run_args}}, "+fsdbDumplimit=$opt{fsdbDumplimit}") if ($opt{fsdbDumplimit} ne "") ; | |
3012 | } | |
3013 | ||
3014 | # convert -args to +args | |
3015 | push (@{$opt{ncv_run_args}}, "+use_sas_tasks") if ($opt{sas}) ; | |
3016 | push (@{$opt{ncv_run_args}}, "+finish_mask=$opt{finish_mask}") if ($opt{finish_mask} ne "") ; | |
3017 | push (@{$opt{ncv_run_args}}, "+stub_mask=$opt{stub_mask}") if ($opt{stub_mask} ne "") ; | |
3018 | push (@{$opt{ncv_run_args}}, "+TIMEOUT=$opt{rtl_timeout}") if ($opt{rtl_timeout}) ; | |
3019 | push (@{$opt{ncv_run_args}}, "+wait_cycle_to_kill=$opt{wait_cycle_to_kill}") if ($opt{wait_cycle_to_kill} > 0) ; | |
3020 | push (@{$opt{ncv_run_args}}, "+max_cycle=$opt{max_cycle}") if ($opt{max_cycle}) ; | |
3021 | push (@{$opt{ncv_run_args}}, "+tg_seed=$opt{tg_seed}") ; | |
3022 | push (@{$opt{ncv_run_args}}, "+vera_random_seed=$opt{tg_seed}") ; | |
3023 | push (@{$opt{ncv_run_args}}, "+vera_pload=$opt{sys}_top.proj") if ((!$opt{dftvert}) and $opt{vera_run}); | |
3024 | push (@{$opt{ncv_run_args}}, "+vera_mload=veralist.vrl") if ($opt{dftvert}); | |
3025 | push (@{$opt{ncv_run_args}}, "+efuse_data_file=efuse.img") if ($opt{efuse_image_name} ne "") ; | |
3026 | push (@{$opt{ncv_run_args}}, "+vera_diag_name=$opt{vera_diag_name}") if ($opt{vera_diag_name} ne ""); | |
3027 | push (@{$opt{ncv_run_args}}, "+vera_dummy_diag=$opt{vera_dummy_diag}") if ($opt{vera_dummy_diag} ne ""); | |
3028 | push (@{$opt{ncv_run_args}}, "+asm_diag_name=$opt{asm_diag_name}") if ($opt{asm_diag_name} ne "") ; | |
3029 | push (@{$opt{ncv_run_args}}, "+sjm_diag_name=$opt{sjm_diag_name}") if ($opt{sjm_diag_name} ne "") ; | |
3030 | push (@{$opt{ncv_run_args}}, "+tap_diag_name=$opt{tap_diag_name}") if ($opt{tap_diag_name} ne "") ; | |
3031 | push (@{$opt{ncv_run_args}}, "+tpt_diag_name=$opt{tpt_diag_name}") if ($opt{tpt_diag_name} ne "") ; | |
3032 | push (@{$opt{ncv_run_args}}, "+pci_diag_name=$opt{pci_diag_name}") if ($opt{pci_diag_name} ne "") ; | |
3033 | push (@{$opt{ncv_run_args}}, "+image_diag_name=$opt{image_diag_name}") if ($opt{image_diag_name} ne "") ; | |
3034 | push (@{$opt{ncv_run_args}}, "+efuse_image_name=$opt{efuse_image_name}") if ($opt{efuse_image_name} ne "") ; | |
3035 | push (@{$opt{ncv_run_args}}, "+vera_config_name=$opt{vera_config_name}") if ($opt{vera_config_name} ne "") ; | |
3036 | push (@{$opt{ncv_run_args}}, "+fast_boot") if ($opt{fast_boot}) ; | |
3037 | push (@{$opt{ncv_run_args}}, "+ctu_mon_off") if ($opt{tcl_tap}) ; | |
3038 | push (@{$opt{ncv_run_args}}, "+dv_root=$dv_root") ; | |
3039 | ||
3040 | foreach my $obj (@{$opt{vera_cov_obj}}) | |
3041 | { | |
3042 | $obj =~ tr/A-Z/a-z/ ; | |
3043 | push (@{$opt{ncv_run_args}}, "+$obj") ; | |
3044 | } | |
3045 | ||
3046 | if ($opt{cache}) | |
3047 | { | |
3048 | if ( ($opt{sys} eq "fc1") or ($opt{sys} eq "fc8") ) { | |
3049 | system ( "/bin/cp diag* ef* fbdimm* fc*_top.proj mem.image symbol.tbl $cache_dir" ) ; | |
3050 | } elsif ( ($opt{sys} eq "cmp1") or ($opt{sys} eq "cmp8") ) { | |
3051 | system ( "/bin/cp diag* cmp*_top.proj mem.image symbol.tbl $cache_dir" ) ; | |
3052 | } | |
3053 | my $ncv_dir = $model_path . "/INCA_libs/worklib" ; | |
3054 | opendir D, $ncv_dir or die (" Could not open directory \" $ncv_dir \" for reading!\n"); | |
3055 | my @d = grep {/^inca.*pak$/} readdir D ; closedir D; | |
3056 | print "$prg: will run simulation using $ncv_dir/$d[-1] inside cache : \( " . $cache_dir . " \)\n"; | |
3057 | } | |
3058 | ||
3059 | if ($opt{parallel}) { | |
3060 | if ($opt{cache}) { | |
3061 | print "$prg: copying simulation snapshot to cache dir!\n"; | |
3062 | system ("/bin/cp -rf $model_path/INCA_libs $cache_dir") ; | |
3063 | } | |
3064 | } | |
3065 | if ($opt{cache}) { | |
3066 | system ("/bin/cp $model_path/ncsim.args $cache_dir") ; | |
3067 | system ("/bin/cp $model_path/cds.lib $cache_dir") ; | |
3068 | system ("/bin/cp $model_path/hdl.var $cache_dir") ; | |
3069 | chdir $cache_dir; | |
3070 | } | |
3071 | else { | |
3072 | system ("/bin/cp $model_path/ncsim.args .") ; | |
3073 | system ("/bin/cp $model_path/cds.lib .") ; | |
3074 | system ("/bin/cp $model_path/hdl.var .") ; | |
3075 | } | |
3076 | ||
3077 | if ($opt{parallel}) { | |
3078 | if ($opt{cache}) { | |
3079 | open F, "<cds.lib" or die "Can't open cds.lib for reading: $!\n" ; my @f=<F>; chomp @f; close F; | |
3080 | system ("/bin/rm -rf cds.lib") ; | |
3081 | open F, ">cds.lib" or die "Can't open cds.lib for writing: $!\n" ; | |
3082 | foreach (@f) { s/^define\s(\w+)\s.*\/INCA_libs\/(\w+)$/define $1 INCA_libs\/$2/; | |
3083 | print F $_."\n"; } | |
3084 | close F; | |
3085 | } | |
3086 | } | |
3087 | else { | |
3088 | print "$prg: No parallel run command specified, so will run all tests sequentially... !\n"; | |
3089 | open F, "<cds.lib" or die "Can't open cds.lib for reading: $!\n" ; my @f=<F>; chomp @f; close F; | |
3090 | system ("/bin/rm -rf cds.lib") ; | |
3091 | open F, ">cds.lib" or die "Can't open cds.lib for writing: $!\n" ; | |
3092 | foreach (@f) { s/^define\s(\w+)\s.*\/INCA_libs\/(\w+)$/define $1 $opt{exe_dir}\/INCA_libs\/$2/; | |
3093 | print F $_."\n"; } | |
3094 | close F; | |
3095 | } | |
3096 | ||
3097 | $ENV{LD_LIBRARY_PATH}=$model_dir."/".$opt{sys}."/".$opt{model_rel_name}.":".$ENV{LD_LIBRARY_PATH}; | |
3098 | if ( ($opt{sys} eq "fc1") or ($opt{sys} eq "fc8") ) { | |
3099 | $ENV{LD_LIBRARY_PATH}=$ENV{DV_ROOT}."/verif/model/verilog/niu/sparse_mem_model/loadpli:".$ENV{LD_LIBRARY_PATH}; | |
3100 | # $ENV{LD_LIBRARY_PATH}=$ENV{DV_ROOT}.$ENV{LD_LIBRARY_PATH}; | |
3101 | } | |
3102 | print "$prg: LD_LIBRARY_PATH: $ENV{LD_LIBRARY_PATH}\n"; | |
3103 | system ("echo \"LD_LIBRARY_PATH: \" $ENV{LD_LIBRARY_PATH} > ncsim.log" ); | |
3104 | ||
3105 | my $cmd = "ncsim -f ncsim.args " ; | |
3106 | unshift (@{$opt{ncv_run_args}}, $good_trap) if ($good_trap ne "") ; | |
3107 | unshift (@{$opt{ncv_run_args}}, $bad_trap) if ($bad_trap ne "") ; | |
3108 | ||
3109 | my @vcs = grep{!/^\+vcs/} grep{/^\+/} @{$opt{vcs_run_args}}; | |
3110 | my @ncv = grep{/^\+/} @{$opt{ncv_run_args}}; | |
3111 | my ($vcs_only, $ncv_only, $intersect, $union) = list (\@vcs, \@ncv); | |
3112 | push @{$opt{ncv_run_args}}, @$vcs_only; | |
3113 | ||
3114 | push (@{$opt{ncv_run_args}}, "-licqueue") ; | |
3115 | my $runargs = join (" ", reverse(@{$opt{ncv_run_args}})); | |
3116 | $runargs =~ s/"//go; #" | |
3117 | $cmd .= $runargs; | |
3118 | ||
3119 | $ENV{FSDB_ENV_DUMP_SEQ_NUM} = 1 if ($opt{fsdb_glitch}) ; # turn on sequence dump | |
3120 | $ENV{FSDB_ENV_MAX_GLITCH_NUM} = 0 if ($opt{fsdb_glitch}) ; # turn on glitch dump | |
3121 | $ENV{VERA_LIBDIR} = "$model_path/vera"; | |
3122 | ||
3123 | print "$prg: setenv VERA_LIBDIR $ENV{VERA_LIBDIR}\n"; | |
3124 | if (exists $ENV{LM_LICENSE_FILE}) | |
3125 | { | |
3126 | print "$prg: setenv LM_LICENSE_FILE $ENV{LM_LICENSE_FILE}\n"; | |
3127 | } | |
3128 | print "$prg: <<<<<<< (RUN directory) >>>>>>> $ENV{PWD}\n"; | |
3129 | print "$prg: <<<<<<< (RUNTIME command) >>>>>>> $cmd\n"; | |
3130 | ||
3131 | $main::vcs_start = `date` ; | |
3132 | print "$prg: ncsim_start $main::vcs_start" ; | |
3133 | system ($cmd) ; | |
3134 | $main::vcs_stop = `date` ; | |
3135 | print "$prg: ncsim_stop $main::vcs_stop" ; | |
3136 | ||
3137 | ||
3138 | # kill sas no matter what | |
3139 | ||
3140 | if ($sas_pid != 0) | |
3141 | { | |
3142 | kill -9, $sas_pid ; | |
3143 | } | |
3144 | ||
3145 | # kill tcl no matter what | |
3146 | if ($tcl_pid != 0) | |
3147 | { | |
3148 | kill -9, $tcl_pid ; | |
3149 | } | |
3150 | ||
3151 | # copy over debussy dump | |
3152 | if ($opt{debussy}) | |
3153 | { | |
3154 | if (<$opt{fsdbfile}*>) | |
3155 | { | |
3156 | ||
3157 | # Handling fsdbautoswitchdumpfile file names | |
3158 | foreach (<$opt{fsdbfile}*>) { | |
3159 | my $was = $_; | |
3160 | s/\.fsdb_/_/; | |
3161 | rename ($was, $_); | |
3162 | if ($opt{fsdb2vcd}) { | |
3163 | `fsdb2vcd $_ -o $_.vcd` ; | |
3164 | die ("DIE. unable to convert $_ file to vcd\n") if ($?) ; | |
3165 | } | |
3166 | } | |
3167 | } | |
3168 | ||
3169 | if (<verilog.fsdb*>) | |
3170 | { | |
3171 | ||
3172 | # Handling fsdbautoswitchdumpfile file names | |
3173 | foreach (<verilog.fsdb*>) { | |
3174 | my $was = $_; | |
3175 | s/\.fsdb_/_/; | |
3176 | rename ($was, $_); | |
3177 | if ($opt{fsdb2vcd}) { | |
3178 | `fsdb2vcd $_ -o $_.vcd` ; | |
3179 | die ("DIE. unable to convert $_ file to vcd\n") if ($?) ; | |
3180 | } | |
3181 | } | |
3182 | } | |
3183 | } | |
3184 | ||
3185 | for (@{$opt{post_process_cmd}}) {if(m/regreport -1/) {s/regreport/regreport -sim ncv/;}} | |
3186 | ||
3187 | if ($opt{parallel}) { | |
3188 | if ($opt{cache}) { | |
3189 | print "$prg: removing simulation snapshot from cache dir!\n" ; | |
3190 | system ( "/bin/rm -rf INCA_libs" ) ; | |
3191 | } | |
3192 | } | |
3193 | ||
3194 | if ($opt{cache}) { | |
3195 | print "$prg: will now move all of the runtime generated files from cache to the original run directory. \n"; | |
3196 | system ( "/bin/cp -rf * $run_dir " ) ; | |
3197 | chdir $run_dir ; | |
3198 | system ( " /bin/rm -rf $cache_dir " ) ; | |
3199 | } | |
3200 | &post_process(); | |
3201 | } | |
3202 | ||
3203 | ||
3204 | # run a test using the simv binary created from VCS | |
3205 | ||
3206 | sub vcs_run | |
3207 | { | |
3208 | # Check for vera diag existence if ntb_lib in use | |
3209 | die ("DIE. No vera diag specified for NTB LIB bench (-ntb_lib option).\nUse NTB ALL method if not using openVera diags, or specify a -vera_dummy_diag as a default.") | |
3210 | if ($opt{vcs_use_ntb} && $opt{ntb_lib} && ($opt{vera_diag_name} eq "") && ($opt{vera_dummy_diag} eq "")); | |
3211 | ||
3212 | ||
3213 | my $run_dir = $ENV{PWD} ; | |
3214 | my $cache_dir; | |
3215 | if ($opt{cache}) | |
3216 | { | |
3217 | my $cache_dir_prefix = $ENV{TEMPDIR} ; | |
3218 | if ( !( -d $ENV{TEMPDIR} ) ) { system ("mkdir -p $ENV{TEMPDIR}") ; } | |
3219 | die ( "DIE. Could not access your temporary cache directory. \n") if ( !( -d $ENV{TEMPDIR} ) ) ; | |
3220 | if (-d $cache_dir_prefix ) | |
3221 | { | |
3222 | opendir D, $cache_dir_prefix or die (" Could not open directory \" ${cache_dir_prefix} \" for reading!\n"); | |
3223 | my @d = map { $cache_dir_prefix . "/" . $_ } grep { !/^\./ && -d "$cache_dir_prefix/$_" } readdir D ; closedir D; | |
3224 | ||
3225 | foreach (@d) { | |
3226 | if ( ( time - ( (stat $_ )->mtime ) ) > ( 60*60*$cache_clean_time ) ) { | |
3227 | system ( "/bin/rm -rf $_" ) ; | |
3228 | } | |
3229 | } | |
3230 | ||
3231 | $cache_dir = $cache_dir_prefix . "/OpenSPARC_T2___VCS___" . $opt{sys} . "___run" ; | |
3232 | my $count = 0; | |
3233 | while ( -d "${cache_dir}_${count}" ) { ++$count; } | |
3234 | $cache_dir .= "_$count" ; | |
3235 | system ("mkdir -p $cache_dir") ; | |
3236 | die ("DIE. Could not create temporary cache sub-directory for VCS run ") if ($?) ; | |
3237 | } | |
3238 | } | |
3239 | ||
3240 | # copy the diff release over | |
3241 | system ("cp -f $model_path/diff_rel.log .") if (-f "$model_path/diff_rel.log") ; | |
3242 | ||
3243 | # copy the flist over | |
3244 | system ("cp -f $model_path/flist .") ; | |
3245 | die ("DIE. could not copy flist to $ENV{PWD}") if ($?) ; | |
3246 | ||
3247 | # pass the good trap and bad trap addresses to the testbench | |
3248 | my $good_trap = ""; | |
3249 | my $bad_trap = ""; | |
3250 | ||
3251 | if (($opt{asm_diag_name} ne "") or ($opt{image_diag_name} ne "")) | |
3252 | { | |
3253 | die ("DIE. could not find symbol.tbl file") if (!-f "symbol.tbl") ; | |
3254 | ||
3255 | my @good_trap_list = `grep -w good_trap symbol.tbl`; | |
3256 | my @bad_trap_list = `grep -w bad_trap symbol.tbl`; | |
3257 | my %good_trap_list ; | |
3258 | my %bad_trap_list ; | |
3259 | my @good_trap ; | |
3260 | my @bad_trap ; | |
3261 | ||
3262 | if ($#good_trap_list >= 0) | |
3263 | { | |
3264 | foreach my $trap (@good_trap_list) | |
3265 | { | |
3266 | my ($tmp1, $va, $ra, $pa) = ($trap =~ /([\w_\.]+)\s+(\w+)\s+(\w+)\s+(\w+)/) ; | |
3267 | $good_trap_list{$pa} = 1 ; | |
3268 | } | |
3269 | ||
3270 | foreach my $x (sort (keys (%good_trap_list))) | |
3271 | { | |
3272 | push (@good_trap, $x) ; | |
3273 | } | |
3274 | ||
3275 | if ($#good_trap == 0) { $good_trap = "+good_trap=" . $good_trap[0] ; } | |
3276 | else { $good_trap = "+good_trap=" . join (':', @good_trap) ; } | |
3277 | } | |
3278 | ||
3279 | if ($#bad_trap_list >= 0) | |
3280 | { | |
3281 | foreach my $trap (@bad_trap_list) | |
3282 | { | |
3283 | my ($tmp1, $va, $ra, $pa) = ($trap =~ /([\w_\.]+)\s+(\w+)\s+(\w+)\s+(\w+)/) ; | |
3284 | $bad_trap_list{$pa} = $pa; | |
3285 | } | |
3286 | ||
3287 | foreach my $x (sort (keys (%bad_trap_list))) | |
3288 | { | |
3289 | push (@bad_trap, $x) ; | |
3290 | } | |
3291 | ||
3292 | if ($#bad_trap == 0) { $bad_trap = "+bad_trap=" . $bad_trap[0] ; } | |
3293 | else { $bad_trap = "+bad_trap=" . join (':', @bad_trap) ; } | |
3294 | } | |
3295 | } | |
3296 | ||
3297 | # copy the 'traditional vera' project file over to the run area | |
3298 | ||
3299 | if ((! $opt{dftvert}) and $opt{vera_run} and !$opt{vcs_use_ntb}) | |
3300 | { | |
3301 | `cp $model_path/vera/$opt{sys}_top.proj .` ; | |
3302 | die ("DIE. could not copy .proj file to $ENV{PWD}") if ($?) ; | |
3303 | `chmod +w $opt{sys}_top.proj`; | |
3304 | die ("DIE. could not change permission of .proj file") if ($?) ; | |
3305 | ||
3306 | # append diag.vro after the fact | |
3307 | if ($opt{vera_diag_name} ne "" or $opt{vera_dummy_diag} ne "") | |
3308 | { | |
3309 | push (@{$opt{vcs_run_args}}, "+vera_diag_path=$opt{vera_diag_path}") ; | |
3310 | `ls *.vro >> $opt{sys}_top.proj` ; | |
3311 | die ("DIE. could not append *.vro to vera project file") if ($?) ; | |
3312 | } | |
3313 | } | |
3314 | ||
3315 | # add in switches for signal dumping | |
3316 | ||
3317 | if ($opt{vcd}) | |
3318 | { | |
3319 | my $vcdfile = ""; | |
3320 | if ($opt{vcdfile} eq "") | |
3321 | { | |
3322 | $vcdfile = "verilog.vcd" ; | |
3323 | } else | |
3324 | { | |
3325 | $vcdfile = $opt{vcdfile} ; | |
3326 | } | |
3327 | ||
3328 | push (@{$opt{vcs_run_args}}, "+vcd") ; | |
3329 | push (@{$opt{vcs_run_args}}, "-vcd $vcdfile") ; | |
3330 | push (@{$opt{vcs_run_args}}, "+vcs+dumpon+".bigtime2plus($opt{start_dump})) if ($opt{start_dump} != 0) ; | |
3331 | push (@{$opt{vcs_run_args}}, "+vcs+dumpoff+".bigtime2plus($opt{stop_dump})) if ($opt{stop_dump} != 0) ; | |
3332 | } | |
3333 | else | |
3334 | { | |
3335 | #push (@{$opt{vcs_run_args}}, "+vcs+dumpvarsoff") ; | |
3336 | push (@{$opt{vcs_run_args}}, "+notimingcheck") ; | |
3337 | } | |
3338 | ||
3339 | if ($opt{debussy}) | |
3340 | { | |
3341 | my $fsdbfile = ""; | |
3342 | if ($opt{fsdbfile} eq "") | |
3343 | { | |
3344 | $fsdbfile = "verilog.fsdb" ; | |
3345 | } else | |
3346 | { | |
3347 | $fsdbfile = $opt{fsdbfile} ; | |
3348 | } | |
3349 | ||
3350 | push (@{$opt{vcs_run_args}}, "+debussy") ; | |
3351 | push (@{$opt{vcs_run_args}}, "+fsdbfile=$fsdbfile") ; | |
3352 | push (@{$opt{vcs_run_args}}, "+fsdb+dumpon+".bigtime2plus($opt{start_dump})) if ($opt{start_dump} != 0) ; | |
3353 | push (@{$opt{vcs_run_args}}, "+fsdb+dumpoff+".bigtime2plus($opt{stop_dump})) if ($opt{stop_dump} != 0) ; | |
3354 | push (@{$opt{vcs_run_args}}, "+fsdbDumplimit=$opt{fsdbDumplimit}") if ($opt{fsdbDumplimit} ne "") ; | |
3355 | } | |
3356 | ||
3357 | # convert -args to +args | |
3358 | push (@{$opt{vcs_run_args}}, "+use_sas_tasks") if ($opt{sas}) ; | |
3359 | push (@{$opt{vcs_run_args}}, "+finish_mask=$opt{finish_mask}") if ($opt{finish_mask} ne "") ; | |
3360 | push (@{$opt{vcs_run_args}}, "+stub_mask=$opt{stub_mask}") if ($opt{stub_mask} ne "") ; | |
3361 | push (@{$opt{vcs_run_args}}, "+TIMEOUT=$opt{rtl_timeout}") if ($opt{rtl_timeout}) ; | |
3362 | push (@{$opt{vcs_run_args}}, "+wait_cycle_to_kill=$opt{wait_cycle_to_kill}") if ($opt{wait_cycle_to_kill} > 0) ; | |
3363 | push (@{$opt{vcs_run_args}}, "+max_cycle=$opt{max_cycle}") if ($opt{max_cycle}) ; | |
3364 | ||
3365 | push (@{$opt{vcs_run_args}}, "+initreg+$opt{tg_seed}") if ($opt{vcs_use_initreg}) ; | |
3366 | push (@{$opt{vcs_run_args}}, "+tg_seed=$opt{tg_seed}") ; | |
3367 | push (@{$opt{vcs_run_args}}, "+vera_random_seed=$opt{tg_seed}") if ($opt{vcs_use_vera} and !$opt{vcs_use_ntb}) ; | |
3368 | push (@{$opt{vcs_run_args}}, "+ntb_random_seed=$opt{tg_seed}") if ($opt{vcs_use_ntb}) ; | |
3369 | ||
3370 | push (@{$opt{vcs_run_args}}, "+vcs+finish+".bigtime2plus($opt{vcs_finish})) if ($opt{vcs_finish}) ; | |
3371 | push (@{$opt{vcs_run_args}}, "+vera_pload=$opt{sys}_top.proj") if ((!$opt{dftvert}) and $opt{vera_run} and !$opt{vcs_use_ntb}) ; | |
3372 | push (@{$opt{vcs_run_args}}, "+vera_mload=veralist.vrl") if ($opt{dftvert} and !$opt{vcs_use_ntb}) ; | |
3373 | push (@{$opt{vcs_run_args}}, "-l vcs.log") ; | |
3374 | #push (@{$opt{vcs_run_args}}, "+vcs+nostdout") ; | |
3375 | push (@{$opt{vcs_run_args}}, "-cm $opt{vcs_cm_args}") if ($opt{vcs_use_cm}); | |
3376 | push (@{$opt{vcs_run_args}}, "-cm_cond $opt{vcs_cm_cond}") if ($opt{vcs_use_cm} and ($opt{vcs_cm_cond} ne "")); | |
3377 | push (@{$opt{vcs_run_args}}, "-cm_hier $opt{vcs_cm_config}") if ($opt{vcs_use_cm} and ($opt{vcs_cm_config} ne "")); | |
3378 | push (@{$opt{vcs_run_args}}, "-cm_name $opt{vcs_cm_name}") if ($opt{vcs_use_cm}); | |
3379 | push (@{$opt{vcs_run_args}}, "-cm_dir $ENV{PWD}") if ($opt{vcs_use_cm}); | |
3380 | push (@{$opt{vcs_run_args}}, "+efuse_data_file=efuse.img") if ($opt{efuse_image_name} ne "") ; | |
3381 | push (@{$opt{vcs_run_args}}, "+vera_diag_name=$opt{vera_diag_name}") if ($opt{vera_diag_name} ne ""); | |
3382 | push (@{$opt{vcs_run_args}}, "+vera_dummy_diag=$opt{vera_dummy_diag}") if ($opt{vera_dummy_diag} ne ""); | |
3383 | push (@{$opt{vcs_run_args}}, "+asm_diag_name=$opt{asm_diag_name}") if ($opt{asm_diag_name} ne "") ; | |
3384 | push (@{$opt{vcs_run_args}}, "+sjm_diag_name=$opt{sjm_diag_name}") if ($opt{sjm_diag_name} ne "") ; | |
3385 | push (@{$opt{vcs_run_args}}, "+tap_diag_name=$opt{tap_diag_name}") if ($opt{tap_diag_name} ne "") ; | |
3386 | push (@{$opt{vcs_run_args}}, "+tpt_diag_name=$opt{tpt_diag_name}") if ($opt{tpt_diag_name} ne "") ; | |
3387 | push (@{$opt{vcs_run_args}}, "+pci_diag_name=$opt{pci_diag_name}") if ($opt{pci_diag_name} ne "") ; | |
3388 | push (@{$opt{vcs_run_args}}, "+image_diag_name=$opt{image_diag_name}") if ($opt{image_diag_name} ne "") ; | |
3389 | push (@{$opt{vcs_run_args}}, "+efuse_image_name=$opt{efuse_image_name}") if ($opt{efuse_image_name} ne "") ; | |
3390 | push (@{$opt{vcs_run_args}}, "+vera_config_name=$opt{vera_config_name}") if ($opt{vera_config_name} ne "") ; | |
3391 | push (@{$opt{vcs_run_args}}, "+fast_boot") if ($opt{fast_boot}) ; | |
3392 | push (@{$opt{vcs_run_args}}, "+ctu_mon_off") if ($opt{tcl_tap}) ; | |
3393 | push (@{$opt{vcs_run_args}}, "+dv_root=$dv_root") ; | |
3394 | ||
3395 | foreach my $obj (@{$opt{vera_cov_obj}}) | |
3396 | { | |
3397 | $obj =~ tr/A-Z/a-z/ ; | |
3398 | push (@{$opt{vcs_run_args}}, "+$obj") ; | |
3399 | } | |
3400 | ||
3401 | if ($opt{cache}) | |
3402 | { | |
3403 | if ( ($opt{sys} eq "fc1") or ($opt{sys} eq "fc8") ) { | |
3404 | system ( "/bin/cp diag* ef* fbdimm* fc*_top.proj mem.image symbol.tbl $cache_dir" ) ; | |
3405 | } elsif ( ($opt{sys} eq "cmp1") or ($opt{sys} eq "cmp8") ) { | |
3406 | system ( "/bin/cp diag* cmp*_top.proj mem.image symbol.tbl $cache_dir" ) ; | |
3407 | } | |
3408 | print "$prg: will run simulation using $model_path/simv inside cache : \( " . $cache_dir . " \)\n"; | |
3409 | } | |
3410 | ||
3411 | if ($opt{parallel}) | |
3412 | { | |
3413 | if ($opt{cache}) | |
3414 | { | |
3415 | print "$prg: copying simulation snapshot to cache dir!\n"; | |
3416 | system ("/bin/cp $model_path/simv $cache_dir") ; | |
3417 | system ("/bin/cp -rf $model_path/simv.daidir $cache_dir") ; | |
3418 | if (-d "$model_path/simv.cm") { system ("/bin/cp -rf $model_path/simv.cm $cache_dir") ; } | |
3419 | if (-d "$model_path/simv.vdb") { system ("/bin/cp -rf $model_path/simv.vdb $cache_dir") ; } | |
3420 | } | |
3421 | } | |
3422 | ||
3423 | # run the command | |
3424 | ||
3425 | my $cmd = "" ; | |
3426 | $cmd .= "collect " if ($opt{vcs_prof}) ; | |
3427 | if ($opt{hcs_run}) { | |
3428 | $cmd = "tharas_sim -project $opt{sys} -simh_dir $model_path "; | |
3429 | $cmd .= join (" ", map{s/^"(.*?)"$/$1/;$1} @{$opt{hcs_run_args}}) ; | |
3430 | $cmd .= " -other_simh_options \" "; | |
3431 | } elsif ($opt{axis_run}) { | |
3432 | $cmd = "axis_sim -project $opt{sys} -vlg_dir $model_path "; | |
3433 | $cmd .= join (" ", @{$opt{axis_run_args}}) ; | |
3434 | $cmd =~ s/"//go; | |
3435 | $cmd .= " -other_vlg_options \" "; | |
3436 | } elsif ($opt{palladium_run}) { | |
3437 | $cmd = "palladium_sim -project $opt{sys} -model_dir $model_path "; | |
3438 | $cmd .= join (" ", @{$opt{palladium_run_args}}) ; | |
3439 | $cmd =~ s/"//go; | |
3440 | } else { | |
3441 | if ($opt{parallel}) { | |
3442 | if ($opt{cache}) { $cmd .= " simv " ; } | |
3443 | else { $cmd .= $opt{exe_dir} . "/simv " ; } | |
3444 | } else { | |
3445 | print "$prg: No parallel run command specified, so will run all tests sequentially... !\n"; | |
3446 | $cmd .= $opt{exe_dir} . "/simv " ; | |
3447 | } } | |
3448 | ||
3449 | unshift (@{$opt{vcs_run_args}}, $good_trap) if ($good_trap ne "") ; | |
3450 | unshift (@{$opt{vcs_run_args}}, $bad_trap) if ($bad_trap ne "") ; | |
3451 | ||
3452 | push (@{$opt{vcs_run_args}}, "+vcs+lic+wait") ; | |
3453 | my $runargs = join (" ", reverse(@{$opt{vcs_run_args}})); | |
3454 | $runargs =~ s/"//go; #" | |
3455 | $cmd .= $runargs unless ($opt{palladium_run}); | |
3456 | $cmd .= " \" " if ($opt{axis_run}||$opt{hcs_run}); | |
3457 | ||
3458 | $ENV{FSDB_ENV_DUMP_SEQ_NUM} = 1 if ($opt{fsdb_glitch}) ; # turn on sequence dump | |
3459 | $ENV{FSDB_ENV_MAX_GLITCH_NUM} = 0 if ($opt{fsdb_glitch}) ; # turn on glitch dump | |
3460 | ||
3461 | $ENV{VERA_LIBDIR} = "$model_path/vera"; | |
3462 | print "$prg: setenv VERA_LIBDIR $ENV{VERA_LIBDIR}\n"; | |
3463 | ||
3464 | if($proj_vars{has_denali}) { | |
3465 | # figure out the location of denali from tre | |
3466 | my $denali_home = (defined $ENV{DENALI_HOME})? $ENV{DENALI_HOME} : | |
3467 | "/import/datools/vendor/denali/v" ; | |
3468 | $denali_home .= `configsrch denali_pcie /` ; | |
3469 | chomp ($denali_home) ; | |
3470 | die ("DIE. Append _64bit to your denali version in your tver file to work with 64 bit vcs") if (($denali_home !~ /_64bit/) && ($opt{vcs_full64})); | |
3471 | die ("DIE. Conflict between 64 bit denali version in your tver file and 32 bit vcs") if (($denali_home =~ /_64bit/) && (!$opt{vcs_full64})); | |
3472 | $ENV{DENALI} = $denali_home ; | |
3473 | print "$prg: setenv DENALI $ENV{DENALI}\n"; | |
3474 | } | |
3475 | ||
3476 | if (exists $ENV{HOME_0IN}) | |
3477 | { | |
3478 | print "$prg: setenv HOME_0IN $ENV{HOME_0IN}\n"; | |
3479 | } | |
3480 | if (exists $ENV{LM_LICENSE_FILE}) | |
3481 | { | |
3482 | print "$prg: setenv LM_LICENSE_FILE $ENV{LM_LICENSE_FILE}\n"; | |
3483 | } | |
3484 | if ($opt{cache}) { chdir $cache_dir; } | |
3485 | print "$prg: <<<<<<< (RUN directory) >>>>>>> $ENV{PWD}\n"; | |
3486 | print "$prg: <<<<<<< (RUNTIME command) >>>>>>> $cmd\n"; | |
3487 | ||
3488 | $main::vcs_start = `date` ; | |
3489 | print "$prg: vcs_start $main::vcs_start" ; | |
3490 | system ($cmd) ; | |
3491 | $main::vcs_stop = `date` ; | |
3492 | print "$prg: vcs_stop $main::vcs_stop" ; | |
3493 | ||
3494 | ||
3495 | # kill sas no matter what | |
3496 | ||
3497 | if ($sas_pid != 0) | |
3498 | { | |
3499 | kill -9, $sas_pid ; | |
3500 | } | |
3501 | ||
3502 | # kill tcl no matter what | |
3503 | if ($tcl_pid != 0) | |
3504 | { | |
3505 | kill -9, $tcl_pid ; | |
3506 | } | |
3507 | ||
3508 | # copy over debussy dump | |
3509 | if ($opt{debussy}) | |
3510 | { | |
3511 | if (<$opt{fsdbfile}*>) | |
3512 | { | |
3513 | ||
3514 | # Handling fsdbautoswitchdumpfile file names | |
3515 | foreach (<$opt{fsdbfile}*>) { | |
3516 | my $was = $_; | |
3517 | s/\.fsdb_/_/; | |
3518 | rename ($was, $_); | |
3519 | if ($opt{fsdb2vcd}) { | |
3520 | `fsdb2vcd $_ -o $_.vcd` ; | |
3521 | die ("DIE. unable to convert $_ file to vcd\n") if ($?) ; | |
3522 | } | |
3523 | } | |
3524 | ||
3525 | } | |
3526 | ||
3527 | if (<verilog.fsdb*>) | |
3528 | { | |
3529 | ||
3530 | # Handling fsdbautoswitchdumpfile file names | |
3531 | foreach (<verilog.fsdb*>) { | |
3532 | my $was = $_; | |
3533 | s/\.fsdb_/_/; | |
3534 | rename ($was, $_); | |
3535 | if ($opt{fsdb2vcd}) { | |
3536 | `fsdb2vcd $_ -o $_.vcd` ; | |
3537 | die ("DIE. unable to convert $_ file to vcd\n") if ($?) ; | |
3538 | } | |
3539 | } | |
3540 | } | |
3541 | } | |
3542 | if ($opt{parallel}) | |
3543 | { | |
3544 | if ($opt{cache}) | |
3545 | { | |
3546 | print "$prg: removing simulation snapshot from cache dir!\n" ; | |
3547 | system ( "/bin/rm -rf simv simv.daidir" ) ; | |
3548 | if (-d "simv.cm") { system ( "/bin/rm -rf simv.cm" ) ; } | |
3549 | if (-d "simv.vdb") { system ( "/bin/rm -rf simv.vdb" ) ; } | |
3550 | } | |
3551 | } | |
3552 | if ($opt{cache}) { | |
3553 | print "$prg: will now move all of the runtime generated files from cache to the original run directory. \n"; | |
3554 | system ( "/bin/cp -rf * $run_dir " ) ; | |
3555 | chdir $run_dir ; | |
3556 | system ( " /bin/rm -rf $cache_dir " ) ; | |
3557 | } | |
3558 | &post_process(); | |
3559 | } | |
3560 | ||
3561 | #############################################################################}}} | |
3562 | # run pre processing scripts {{{ | |
3563 | ################################################################################ | |
3564 | ||
3565 | sub pre_process | |
3566 | { | |
3567 | return if ($pre_process_done); | |
3568 | ||
3569 | $ENV{SIMS_LAUNCH_DIR} = $launch_dir; | |
3570 | ||
3571 | foreach my $cmd (@{$opt{pre_process_cmd}}) | |
3572 | { | |
3573 | print "$prg: $cmd\n"; | |
3574 | ||
3575 | $cmd =~ s/"(.*?)"/$1/ ; | |
3576 | system ($cmd) ; | |
3577 | print ("$prg: warning failed execution of $cmd\n") if ($?) ; | |
3578 | } | |
3579 | $pre_process_done = 1; | |
3580 | } | |
3581 | ||
3582 | #############################################################################}}} | |
3583 | # run post processing scripts {{{ | |
3584 | ################################################################################ | |
3585 | ||
3586 | sub post_process | |
3587 | { | |
3588 | my $pass = 0 ; | |
3589 | ||
3590 | $ENV{SIMS_LAUNCH_DIR} = $launch_dir; | |
3591 | ||
3592 | foreach my $cmd (@{$opt{post_process_cmd}}) | |
3593 | { | |
3594 | print "$prg: $cmd\n"; | |
3595 | ||
3596 | $cmd =~ s/"(.*?)"/$1/ ; | |
3597 | system ($cmd) ; | |
3598 | print ("$prg. warning failed execution of $cmd\n") if ($?) ; | |
3599 | } | |
3600 | if (-f "diag_pl.log") | |
3601 | { | |
3602 | open (DIAGPLLOG, "diag_pl.log") or die ("DIE. could not open diag_pl.log") ; | |
3603 | my @diagpllog = <DIAGPLLOG> ; | |
3604 | close (DIAGPLLOG) ; | |
3605 | ||
3606 | my @pass = grep (/PASS/, @diagpllog) ; | |
3607 | $pass = 1 if ($#pass >= 0) ; | |
3608 | my @fail = grep (/FAIL/, @diagpllog) ; | |
3609 | $pass = 0 if ($#fail >= 0) ; | |
3610 | } | |
3611 | ||
3612 | if (-f "tsotool.log") | |
3613 | { | |
3614 | open (TSOTOOLLOG, "tsotool.log") or die ("DIE. could not open tsotool.log") ; | |
3615 | my @tsotoollog = <TSOTOOLLOG> ; | |
3616 | close (TSOTOOLLOG) ; | |
3617 | ||
3618 | my @fail = grep (/fatal\serror/i, @tsotoollog) ; | |
3619 | $pass = 0 if ($#fail >= 0) ; | |
3620 | } | |
3621 | ||
3622 | # if this is a regression copy the results back to the result area | |
3623 | ||
3624 | # if ($opt{regress}) | |
3625 | # { | |
3626 | # | |
3627 | # `gzip 0in_checksim.db` if (-f "0in_checksim.db") ; # Always compress this | |
3628 | # | |
3629 | # # find out if diag passed | |
3630 | # | |
3631 | # if ($pass) | |
3632 | # { | |
3633 | # # compress the files | |
3634 | # | |
3635 | # `gzip hdlRun.log` if ($opt{gzip} and (-f "hdlRun.log")) ; | |
3636 | # `gzip axis.log` if ($opt{gzip} and (-f "axis.log")) ; | |
3637 | # `gzip vcs.log` if ($opt{gzip} and (-f "vcs.log") and ($opt{vcs_run})); | |
3638 | # `gzip ncsim.log` if ($opt{gzip} and (-f "ncsim.log") and ($opt{ncv_run})); | |
3639 | # `gzip sas.log` if ($opt{gzip} and (-f "sas.log")) ; | |
3640 | # `gzip diag.exe` if ($opt{gzip} and (-f "diag.exe")) ; | |
3641 | # | |
3642 | #if ($opt{debussy} or $opt{vcd} ) | |
3643 | #{ | |
3644 | # `gzip *.fsdb` if ($opt{gzip}); `gzip *.vcd` if ($opt{gzip}); | |
3645 | #} | |
3646 | # # copy back all relevant data | |
3647 | # | |
3648 | # `cp 0in_checksim.db.gz $launch_dir` if (-f "0in_checksim.db.gz") ; | |
3649 | # print ("$prg: warning could not copy 0in_checksim.db files back to $launch_dir\n") if ($?) ; | |
3650 | # `cp 0in_covered.rpt $launch_dir` if (-f "0in_covered.rpt") ; | |
3651 | # print ("$prg: warning could not copy 0in_covered.rpt files back to $launch_dir\n") if ($?) ; | |
3652 | # `cp *.log.gz $launch_dir` ; | |
3653 | # print ("$prg: warning could not copy *.log.gz files back to $launch_dir\n") if ($?) ; | |
3654 | # `cp *.log $launch_dir` ; | |
3655 | # print ("$prg: warning could not copy *.log files back to $launch_dir\n") if ($?) ; | |
3656 | # `cp -r raw_coverage $launch_dir` ; | |
3657 | # print ("$prg: warning could not copy vera coverage data back to $launch_dir\n") if ($?) ; | |
3658 | # `cp -r ${opt{vcs_cm_name}}* $launch_dir` if ($opt{vcs_use_cm}) ; | |
3659 | # print ("$prg: warning could not copy vcs coverage data back to $launch_dir\n") if ($?) ; | |
3660 | # `cp -r ${opt{vcs_cm_name}}* ${model_path}/coverage/verilog` if ($opt{vcs_use_cm}) and ($opt{vcs_cm_merge}) ; | |
3661 | # print ("$prg: warning could not copy vcs coverage data back to ${model_path}/coverage/verilog\n") if ($?) ; | |
3662 | # if ($opt{tap_diag_name} ne "") | |
3663 | # { | |
3664 | # `cp diag.tap tap.cmd $launch_dir` ; | |
3665 | # print ("$prg: warning could not copy tap diag file back to $launch_dir\n") if ($?) ; | |
3666 | # } | |
3667 | # | |
3668 | # if ($opt{asm_diag_name} ne "") | |
3669 | # { | |
3670 | # `cp *.s *.tbl *.ev *.exe.gz $launch_dir` ; | |
3671 | # print ("$prg: warning could not copy assembly files back to $launch_dir\n") if ($?) ; | |
3672 | # } | |
3673 | # | |
3674 | # if ($opt{sjm} or ($opt{sjm_diag_name} ne "") or $opt{pci} or ($opt{pci_diag_name} ne "")) | |
3675 | # { | |
3676 | # `cp *.cmd $launch_dir` ; | |
3677 | # print ("$prg: warning could not copy sjm/pci command files back to $launch_dir\n") if ($?) ; | |
3678 | # } | |
3679 | # | |
3680 | # if ($opt{efc} or ($opt{efuse_image_name} ne "")) | |
3681 | # { | |
3682 | # `cp efuse.img $launch_dir` ; | |
3683 | # print ("$prg: warning could not copy efuse image file back to $launch_dir\n") if ($?) ; | |
3684 | # } | |
3685 | # | |
3686 | # if ($opt{vera_diag_name} ne "") | |
3687 | # { | |
3688 | # `cp *.vr *.vrpal $launch_dir` ; | |
3689 | # print ("$prg: warning could not copy vera diag back to $launch_dir\n") if ($?) ; | |
3690 | # } | |
3691 | # | |
3692 | # if ($opt{tpt_diag_name} ne "") | |
3693 | # { | |
3694 | # `cp *.tpt $launch_dir` ; | |
3695 | # print ("$prg: warning could not copy tpt diag back to $launch_dir\n") if ($?) ; | |
3696 | # } | |
3697 | # } | |
3698 | # else | |
3699 | # { | |
3700 | # `cp -r * $launch_dir` ; | |
3701 | # print ("$prg: warning could not copy files back to $launch_dir\n") if ($?) ; | |
3702 | # } | |
3703 | # } | |
3704 | ||
3705 | my $c=0; | |
3706 | if ($opt{vcs_run}) { | |
3707 | my $l= `grep '^Time:' vcs.log`; | |
3708 | my @m=split /\n/s, $l; | |
3709 | ($c=$m[-1]) =~ s/^Time:\s(\d+)\s[fp]s/$1/ ; | |
3710 | } | |
3711 | elsif ($opt{ncv_run}) { | |
3712 | my $l = `grep 'baseUtilsClass' ncsim.log`; | |
3713 | my @m=split /\n/s, $l; | |
3714 | ($c=$m[-1]) =~ s/\s*(\d+):.*/$1/ ; | |
3715 | } | |
3716 | if ( ($opt{vcs_run}) or ($opt{ncv_run}) ) | |
3717 | { | |
3718 | my $count=0; | |
3719 | if ( ( -f "vcs.log" ) && ($opt{vcs_run}) ) { | |
3720 | chomp( ($count)= `grep -c PASS vcs.log`) ; } | |
3721 | elsif ( ( -f "ncsim.log" ) && ($opt{ncv_run}) ) { | |
3722 | chomp( ($count)= `grep -c PASS ncsim.log`); } | |
3723 | $pass = 1 if ($count > 0); | |
3724 | } | |
3725 | if ($opt{vcs_run} or $opt{ncv_run}) | |
3726 | { | |
3727 | my $status = "f" ; | |
3728 | $status = "p" if ($pass) ; | |
3729 | &update_db ($c, $main::vcs_start, $main::vcs_stop, $status) ; | |
3730 | } | |
3731 | } | |
3732 | ||
3733 | #############################################################################}}} | |
3734 | # launch sas{{{ | |
3735 | ################################################################################ | |
3736 | ||
3737 | sub sas_run | |
3738 | { | |
3739 | # first clean up the diag area | |
3740 | `rm -rf sas.log` ; | |
3741 | die ("DIE. could not clean up diag run area") if ($?) ; | |
3742 | ||
3743 | my $csocket = 0 ; | |
3744 | ||
3745 | my $def_sas_str = join(" ", grep (/^-D/, @{$opt{sas_run_args}})) ; | |
3746 | my $opt_sas_str = join(" ", grep (!/^-D/, @{$opt{sas_run_args}})) ; | |
3747 | ||
3748 | $def_sas_str .= " -DFAST_BOOT " if ($opt{fast_boot}) ; | |
3749 | ||
3750 | # remove socket pli flag | |
3751 | `rm -rf pli-socket-opened` ; | |
3752 | ||
3753 | # create socket numbers for rtl-sas run | |
3754 | print "$prg: creating sas sockets\n" ; | |
3755 | ||
3756 | if ($opt{vcs_run} or $opt{ncv_run}) | |
3757 | { | |
3758 | $def_sas_str .= " -DRTL "; | |
3759 | $def_sas_str .= " -DVSOCKET=0 "; | |
3760 | my $tmp = $$ & 0x1fff; | |
3761 | $csocket = $tmp + 10000 ; # initial socket port to try out | |
3762 | $tmp = $tmp + 11000 ; # this is an upper bound on trying to find a port | |
3763 | ||
3764 | my $proto = getprotobyname('tcp'); | |
3765 | socket(Server, PF_INET, SOCK_STREAM, $proto) || die "DIE. Could not open socket file handle" ; | |
3766 | while ((!bind(Server, sockaddr_in($csocket, INADDR_ANY))) and ($csocket < $tmp)) {$csocket++;} | |
3767 | close (Server) ; | |
3768 | ||
3769 | die "DIE. Could not find a free port for socket" if ($csocket == $tmp) ; | |
3770 | ||
3771 | $def_sas_str .= " -DCSOCKET=$csocket "; | |
3772 | push (@{$opt{vcs_run_args}}, "+csocket=$csocket") if ($opt{vcs_run} ); | |
3773 | push (@{$opt{ncv_run_args}}, "+csocket=$csocket") if ($opt{ncv_run} ); | |
3774 | } | |
3775 | else | |
3776 | { | |
3777 | $def_sas_str .= " -DMEM_DISABLE "; | |
3778 | $def_sas_str .= " -DMAX_CYCLE=$opt{max_cycle} " if ($opt{max_cycle}) ; | |
3779 | ||
3780 | my $finish_mask = sprintf ("%b", hex ($opt{finish_mask})) ; | |
3781 | my $finish_count = 0 ; | |
3782 | foreach my $x (split (//, $finish_mask)) { $finish_count++ if ($x eq '1') } ; | |
3783 | $def_sas_str .= " -DFINISH_COUNT=$finish_count " ; | |
3784 | } | |
3785 | ||
3786 | my $cmd = "$proj_vars{sasconfig} $def_sas_str" ; | |
3787 | print "$prg: $cmd\n" ; | |
3788 | system ($cmd) ; | |
3789 | die ("DIE. could not invoke $proj_vars{sasconfig}") if ($?) ; | |
3790 | ||
3791 | print "$prg: starting $proj_vars{sas}\n" ; | |
3792 | $cmd = "$proj_vars{sas} $opt_sas_str " ; | |
3793 | print "$prg: $cmd\n"; | |
3794 | ||
3795 | if ($opt{vcs_run} or $opt{ncv_run} or $opt{hcs_run} or $opt{axis_run} or $opt{palladium_run}) | |
3796 | { | |
3797 | $sas_pid = fork () ; | |
3798 | ||
3799 | if ((defined $sas_pid) and ($sas_pid == 0)) | |
3800 | { | |
3801 | setpgrp (0, $$) ; | |
3802 | if ($opt{saslog}) { | |
3803 | system ("$cmd > sas.log 2>&1") ; | |
3804 | } else { | |
3805 | system ("$cmd > /dev/null 2>&1") ; | |
3806 | } | |
3807 | exit (0) ; | |
3808 | } | |
3809 | elsif (!defined $sas_pid) | |
3810 | { | |
3811 | die ("DIE. could not fork off the sas process") ; | |
3812 | } | |
3813 | ||
3814 | # wait until sas has started running before proceeding | |
3815 | ||
3816 | my $timeout_counter = 0 ; | |
3817 | ||
3818 | while (! -e "pli-socket-opened") | |
3819 | { | |
3820 | print "$prg: waiting for pli socket to be opened (pid=$sas_pid)\n" ; | |
3821 | ||
3822 | $timeout_counter++ ; | |
3823 | ||
3824 | if ($timeout_counter > $sas_timer) | |
3825 | { | |
3826 | die ("DIE. sas socket open timeout") ; | |
3827 | } | |
3828 | ||
3829 | sleep 4; | |
3830 | } | |
3831 | } | |
3832 | else | |
3833 | { | |
3834 | if ($opt{regress}) | |
3835 | { | |
3836 | system ("$cmd > sas.log 2>&1") ; | |
3837 | die ("DIE. simics exited with an error") if ($?) ; | |
3838 | } | |
3839 | else | |
3840 | { | |
3841 | if ($opt{saslog}) | |
3842 | { | |
3843 | system ("$cmd > sas.log 2>&1") ; | |
3844 | die ("DIE. simics exited with an error") if ($?) ; | |
3845 | } | |
3846 | else | |
3847 | { | |
3848 | system ($cmd) ; | |
3849 | } | |
3850 | } | |
3851 | } | |
3852 | } | |
3853 | ||
3854 | #############################################################################}}} | |
3855 | # launch tcl_tap {{{ | |
3856 | ################################################################################ | |
3857 | ||
3858 | sub tcl_tap_run | |
3859 | { | |
3860 | # first clean up the diag area | |
3861 | `rm -f tcl.log expect_log_file tcl2sim.log sim2tcl.log done` ; | |
3862 | die ("DIE. could not clean up diag run area") if ($?) ; | |
3863 | ||
3864 | # build JTAG low level commands in sub-directory | |
3865 | my $jtag_log = "jtag.log"; | |
3866 | my $tcl_log = "tcl.log"; | |
3867 | my $pwd = File::Spec->rel2abs( "." ); | |
3868 | my $cmd_dir = File::Spec->catdir( $pwd, "jtag_cmds" ); | |
3869 | my $tap_dir = File::Spec->canonpath( "$dv_root/verif/env/tap" ); | |
3870 | my $tap_src_dir = File::Spec->catdir( $tap_dir, "src" ); | |
3871 | my $makefile = File::Spec->catfile( $tap_src_dir, "Makefile" ); | |
3872 | if (! -d $cmd_dir ) { | |
3873 | `mkdir $cmd_dir`; | |
3874 | die ( "DIE. Could not create $cmd_dir to run tcl tap code" ) if ($?); | |
3875 | } | |
3876 | chdir $cmd_dir; | |
3877 | print "$prg: making JTAG low level commands in $cmd_dir\n" ; | |
3878 | my $cmd = "gmake -f $makefile VPATH=$tap_src_dir "; | |
3879 | call_program( $cmd, $jtag_log ); | |
3880 | chdir $pwd; | |
3881 | ||
3882 | print "$prg: starting expect/tcl\n" ; | |
3883 | my $tcl_tap_diag; | |
3884 | if ( $opt{tcl_tap_diag} ) { | |
3885 | my $diagdir = $tap_src_dir; | |
3886 | my @diags; | |
3887 | @diags = `find $diagdir -name $opt{tcl_tap_diag} -print`; | |
3888 | if ( (scalar @diags) > 0 ) { | |
3889 | $tcl_tap_diag = $diags[0]; | |
3890 | } else { | |
3891 | die "DIE. could not find $opt{tcl_tap_diag} under $diagdir\n"; | |
3892 | } | |
3893 | $tcl_tap_diag = File::Spec->canonpath( $tcl_tap_diag ); | |
3894 | } # if $opt{tcl_tap_diag} | |
3895 | else { | |
3896 | $tcl_tap_diag = File::Spec->catfile( $tap_src_dir, "main_niagara.exp" ); | |
3897 | } | |
3898 | $cmd = "" ; | |
3899 | $cmd .= "xterm -sb -sl 1000 -e " ; | |
3900 | my $expect_cmd = ""; | |
3901 | $expect_cmd .= "expect " ; | |
3902 | $expect_cmd .= " $tcl_tap_diag "; | |
3903 | $cmd .= $expect_cmd; | |
3904 | print "$prg: $cmd\n"; | |
3905 | ||
3906 | if ( ( $opt{vcs_run}) or ($opt{ncv_run}) ) | |
3907 | { | |
3908 | $tcl_pid = fork () ; | |
3909 | if ((defined $tcl_pid) and ($tcl_pid == 0)) | |
3910 | { # child | |
3911 | setpgrp (0, $$) ; | |
3912 | # add path to JTAG commands just built | |
3913 | $ENV{PATH} = "${cmd_dir}:$ENV{PATH}"; | |
3914 | call_program( $cmd, $tcl_log ); | |
3915 | exit (0) ; | |
3916 | } | |
3917 | elsif (!defined $tcl_pid) | |
3918 | { | |
3919 | die ("DIE. could not fork off the tcl process") ; | |
3920 | } | |
3921 | } | |
3922 | else | |
3923 | { | |
3924 | if ($opt{regress}) | |
3925 | { | |
3926 | # add path to JTAG commands just built | |
3927 | $ENV{PATH} = "${cmd_dir}:$ENV{PATH}"; | |
3928 | call_program( $cmd, $tcl_log ); | |
3929 | die ("DIE. expect/tcl exited with an error") if ($?) ; | |
3930 | } | |
3931 | else | |
3932 | { | |
3933 | # add path to JTAG commands just built | |
3934 | $ENV{PATH} = "${cmd_dir}:$ENV{PATH}"; | |
3935 | call_program( $cmd, $tcl_log ); | |
3936 | die ("DIE. expect/tcl exited with an error") if ($?) ; | |
3937 | } | |
3938 | } | |
3939 | } # tcl_tap_run | |
3940 | ||
3941 | #############################################################################}}} | |
3942 | # open up the config file and get the arguments for this sys {{{ | |
3943 | ################################################################################ | |
3944 | ||
3945 | sub get_config | |
3946 | { | |
3947 | my $sys_name = shift ; | |
3948 | my $argvref = shift ; | |
3949 | ||
3950 | my $confcppargs = join(' ', @{$opt{config_cpp_args}}); | |
3951 | print "$prg: using config file $sims_config ($confcppargs)\n" ; | |
3952 | open (SIMS_CONFIG, "bw_cpp -P -B $confcppargs -undef -I$dv_root/$proj_vars{sims_config} $sims_config | ") or die "DIE. Could not open $sims_config" ; | |
3953 | my @sims_config_file = <SIMS_CONFIG> ; | |
3954 | close (SIMS_CONFIG) ; | |
3955 | ||
3956 | my $sims_config_file = join ('', @sims_config_file) ; | |
3957 | ||
3958 | my ($body) = ($sims_config_file =~ /<\s*$sys_name\s*>\s+(.*?)<\s*\/$sys_name\s*>/ogis) ; | |
3959 | ||
3960 | die "DIE. could not find $sys_name in $sims_config" if (!defined $body) ; | |
3961 | ||
3962 | my @argv = split (/\n/, $body) ; | |
3963 | ||
3964 | foreach my $x (@argv) | |
3965 | { | |
3966 | next if ($x =~ /^\s*$/o); # Discard empty lines | |
3967 | $x =~ s/^\s*|\s*$// ; # Discard leading/trailing spaces | |
3968 | $x =~ s/(.*?)\s*$/$1/ ; | |
3969 | print "$prg: processing backtick(s) in arg \"$x\"\n" if($x=~/`/); | |
3970 | while ($x =~ /`(.*?)`/o) { | |
3971 | chomp(my $ex = `$1`); | |
3972 | print "$prg: expanding backtick \`$1\` => $ex\n" ; | |
3973 | $x =~ s/(`.*?`)/$ex/; | |
3974 | print "$prg: resolved backtick(s) in arg to \"$x\"\n" if ($x !~ /`/); | |
3975 | } | |
3976 | unshift (@{$argvref}, $x) ; | |
3977 | } | |
3978 | } | |
3979 | ||
3980 | #############################################################################}}} | |
3981 | # Freeze tool versions: {{{ | |
3982 | # Given a run_dir, make copy of all tver files. | |
3983 | # Construct an iver file pointing to these tvers | |
3984 | # Return string which is new value of env variable: TRE_SEARCH | |
3985 | ################################################################################ | |
3986 | ||
3987 | sub freeze_tre | |
3988 | { | |
3989 | my $run_dir = shift ; | |
3990 | my $tre_search = ""; | |
3991 | ||
3992 | my $TRE_SEP = '/'; | |
3993 | ||
3994 | if ( -d "$run_dir/tre" and -f "$run_dir/tre/sims.iver" ) { | |
3995 | # recursive call. tre_search already filled in | |
3996 | # $tre_search = "$run_dir/tre/sims.iver" if $opt{use_iver} eq ""; | |
3997 | return $tre_search; | |
3998 | } | |
3999 | ||
4000 | my $entry = $TRE_SEP; | |
4001 | ||
4002 | ## $! = -1; | |
4003 | die "$prg: \$TRE_SEARCH not set!\n" unless exists $ENV{TRE_SEARCH}; | |
4004 | die "$prg: \$TRE_SEARCH set to blank!\n" unless $ENV{TRE_SEARCH} =~ /\S/; | |
4005 | ||
4006 | my @ivers = split ' ', $ENV{TRE_SEARCH}; | |
4007 | my @tvers; | |
4008 | my %seen_tver; | |
4009 | foreach my $iver (@ivers) { | |
4010 | print "CHECK IVER: $iver\n" if $opt_debug; | |
4011 | my @tvers_from_iver = get_tvers_from_iver($iver); | |
4012 | foreach my $tver (@tvers_from_iver) { | |
4013 | if(not exists $seen_tver{$tver}) { | |
4014 | push @tvers, $tver; | |
4015 | $seen_tver{$tver} = 1; | |
4016 | ## $! = 2; | |
4017 | die "$prg: Cannot find tver '$tver'!\n" unless -e $tver; | |
4018 | } | |
4019 | } | |
4020 | } | |
4021 | ||
4022 | ## at this point, all the tvers are now collected and in order | |
4023 | ## we need to copy them to files in the run_dir directory | |
4024 | ## and construct an iver that points to them. | |
4025 | `mkdir -p $run_dir/tre`; | |
4026 | die "$prg: cannot create $run_dir/tre: $!\n" if ($?); | |
4027 | my $tnum = 0; | |
4028 | my $iver = $run_dir . "/tre" . "/sims.iver"; | |
4029 | $tre_search = File::Spec->rel2abs( $iver ); # clean up path | |
4030 | my $dest = ""; | |
4031 | local (*IVER); | |
4032 | open IVER, "> $iver" or die "$prg: could not write to $iver: $!\n"; | |
4033 | foreach my $tver ( @tvers ) { | |
4034 | $dest = sprintf "%s_%0d", "$run_dir/tre/sims.tver", $tnum; | |
4035 | $dest = File::Spec->rel2abs( $dest ); # clean up path, if relative | |
4036 | `cp $tver $dest`; | |
4037 | die "$prg: could not copy tver: $tver: to $dest\n" if ($?); | |
4038 | printf IVER "%s\n", $dest; | |
4039 | $tnum++; | |
4040 | } | |
4041 | close IVER; | |
4042 | ||
4043 | return $tre_search; | |
4044 | ||
4045 | } # freeze_tre | |
4046 | ||
4047 | ############################################################################}}} | |
4048 | # Misc routines {{{ | |
4049 | # | |
4050 | sub expand_filename { | |
4051 | my $filename = shift; | |
4052 | ||
4053 | $filename =~ s/^\s+//; | |
4054 | # twiddle expansion | |
4055 | $filename =~ | |
4056 | s{ ^ ~ ([^/]*) } | |
4057 | { $1 ? (getpwnam($1))[7] : | |
4058 | ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($>))[7]) }ex; | |
4059 | # environment variable expansion | |
4060 | $filename =~ s/\${*(\w+)}*/expand_env($1)/ge; | |
4061 | ||
4062 | return $filename; | |
4063 | } | |
4064 | ||
4065 | ############################################################################### | |
4066 | ||
4067 | sub expand_env { | |
4068 | my $envvar = shift; | |
4069 | ||
4070 | return $ENV{$envvar} if exists $ENV{$envvar}; | |
4071 | die "$prg: Environment variable '$envvar' not defined!\n"; | |
4072 | } | |
4073 | ||
4074 | ############################################################################### | |
4075 | ||
4076 | sub get_tvers_from_iver { | |
4077 | my $iver = shift; | |
4078 | local (*IVER); | |
4079 | ||
4080 | $iver = expand_filename($iver); | |
4081 | return unless -e $iver; | |
4082 | open IVER, "<$iver" or die "$prg: Can't open '$iver': $!\n"; | |
4083 | my @tvers; | |
4084 | while(<IVER>) { | |
4085 | chomp; | |
4086 | s/\#.*$//; | |
4087 | $_ = expand_filename($_); | |
4088 | next unless /\S/; | |
4089 | print " -- tver file: $_\n" if $opt_debug; | |
4090 | push @tvers, $_; | |
4091 | } | |
4092 | return @tvers; | |
4093 | } | |
4094 | ||
4095 | #############################################################################}}} | |
4096 | # assemble diag {{{ | |
4097 | ################################################################################ | |
4098 | ||
4099 | sub assemble_diag | |
4100 | { | |
4101 | # first clean up the diag area | |
4102 | `rm -rf diag.pal diag.s diag.pl diag.exe mem.image diag.ev symbol.tbl` ; | |
4103 | die "DIE. could not clean up assembly diag run area" if ($?) ; | |
4104 | ||
4105 | print "$prg: asm_diag_name=" . $opt{asm_diag_name} . " asm_diag_path=" . $opt{asm_diag_path} . " asm_diag_root=" . @{$opt{asm_diag_root}} . "\n" if $opt_debug ; | |
4106 | ||
4107 | # find diagnostic | |
4108 | my $diag_full_path = &find_diag_path ($opt{asm_diag_name}, $opt{asm_diag_path}, $opt{asm_diag_root}) ; | |
4109 | ||
4110 | my $diag_name ; | |
4111 | if ($opt{asm_diag_name} =~ /\.pal/) { $diag_name = "diag.pal" ; } | |
4112 | elsif ($opt{asm_diag_name} =~ /\.s\.gz/) { $diag_name = "diag.s.gz" ; } | |
4113 | else { $diag_name = "diag.s" ; } | |
4114 | ||
4115 | # copy diagnostic to run area | |
4116 | `cp $diag_full_path $diag_name` ; | |
4117 | die ("DIE. unable to copy assembly diag to $ENV{PWD}") if ($?) ; | |
4118 | `chmod +w $diag_name` ; | |
4119 | die ("DIE. unable to permission of assembly diag") if ($?) ; | |
4120 | ||
4121 | # gunzip if needed | |
4122 | if ($opt{asm_diag_name} =~ /\.s\.gz/) | |
4123 | { | |
4124 | `gzip -d diag.s.gz` ; | |
4125 | die ("DIE. unable to gunzip assembly diag") if ($?) ; | |
4126 | $diag_name = "diag.s" ; | |
4127 | } | |
4128 | ||
4129 | $ENV{ASM_DIAG_NAME} = $opt{asm_diag_name}; | |
4130 | ||
4131 | # pre process if needed | |
4132 | &pre_process ; | |
4133 | ||
4134 | # extract sims options from diag.s | |
4135 | if ($diag_name =~ /\.s/) | |
4136 | { | |
4137 | open (DIAGIN, "< diag.s") or die "DIE. Could not open diag.s" ; | |
4138 | ||
4139 | while (<DIAGIN>) | |
4140 | { | |
4141 | my $line = $_ ; | |
4142 | ||
4143 | if ($line =~ /^\!SIMS\+ARGS\:/) | |
4144 | { | |
4145 | my (@plusargs) = split (/\s+/, $line) ; | |
4146 | shift (@plusargs) ; | |
4147 | push (@ARGV, @plusargs) ; | |
4148 | print "$prg: Found sims arguments in diag.s: @plusargs\n" ; | |
4149 | parse_args ("dummy", 0) ; | |
4150 | } | |
4151 | } | |
4152 | ||
4153 | close (DIAGIN) ; | |
4154 | } | |
4155 | ||
4156 | # assemble | |
4157 | push (@{$opt{midas_args}}, "-DFAST_BOOT") if ($opt{fast_boot}) ; | |
4158 | push (@{$opt{midas_args}}, "-diag_root=$dv_root") ; | |
4159 | push (@{$opt{midas_args}}, "-DTG_SEED=$opt{tg_seed}") if ($opt{midas_use_tgseed}) ; | |
4160 | push (@{$opt{midas_args}}, "-pal_diag_args=-seed=$opt{tg_seed}") if ($opt{pal_use_tgseed}) ; | |
4161 | push (@{$opt{midas_args}}, "$diag_name") ; | |
4162 | ||
4163 | print "$prg: assembling diag\n" ; | |
4164 | my $cmd = "midas " ; | |
4165 | $cmd .= join (" ", @{$opt{midas_args}}) ; | |
4166 | print "$prg: $cmd\n"; | |
4167 | ||
4168 | my $waitstatus = call_program($cmd, "midas.log"); | |
4169 | die ("DIE. midas compilation error") if ($waitstatus) ; | |
4170 | exit (0) if ($opt{midas_only}) ; | |
4171 | } | |
4172 | ||
4173 | #############################################################################}}} | |
4174 | # call_program - runs a program, tee's the output to a log, and returns exit {{{ | |
4175 | # status | |
4176 | ################################################################################ | |
4177 | ||
4178 | sub call_program { | |
4179 | my $cmd = shift; | |
4180 | my $file = shift; | |
4181 | ||
4182 | local (*PROGFH, *TEE); | |
4183 | open( PROGFH, "$cmd 2>&1 |" ) or die "Can't run '$cmd': $!\n"; | |
4184 | ||
4185 | open( TEE, ">$file" ) or die "Can't open '$file': $!\n"; | |
4186 | ||
4187 | my $old_fh = select(TEE); | |
4188 | $| = 1; | |
4189 | select($old_fh); | |
4190 | ||
4191 | while(<PROGFH>) { | |
4192 | print; | |
4193 | print TEE; | |
4194 | } | |
4195 | ||
4196 | close( TEE ); | |
4197 | ||
4198 | close( PROGFH ); | |
4199 | return $?; | |
4200 | } | |
4201 | ||
4202 | #############################################################################}}} | |
4203 | # copy diag image{{{ | |
4204 | ################################################################################ | |
4205 | ||
4206 | sub copy_image | |
4207 | { | |
4208 | # first clean up the diag area | |
4209 | `rm -rf diag.pal diag.s diag.pl diag.exe mem.image diag.ev symbol.tbl` ; | |
4210 | die ("DIE. could not clean up image run area") if ($?) ; | |
4211 | ||
4212 | my $image_full_path = &find_diag_path ($opt{image_diag_name}, $opt{image_diag_path}, $opt{image_diag_root}) ; | |
4213 | ||
4214 | `cp $image_full_path mem.image` ; | |
4215 | die ("DIE. unable to copy memory image into $ENV{PWD}") if ($?) ; | |
4216 | `chmod +w mem.image` ; | |
4217 | die ("DIE. unable to change permission of memory image") if ($?) ; | |
4218 | ||
4219 | $image_full_path =~ s/\.image/\.ev/ ; | |
4220 | `cp $image_full_path diag.ev` ; | |
4221 | die ("DIE. unable to copy diag event file into $ENV{PWD}") if ($?) ; | |
4222 | `chmod +w diag.ev` ; | |
4223 | die ("DIE. unable to change permission of diag event file") if ($?) ; | |
4224 | ||
4225 | $image_full_path =~ s/\.ev/\.tbl/ ; | |
4226 | `cp $image_full_path symbol.tbl` ; | |
4227 | die ("DIE. unable to copy symbol table file into $ENV{PWD}") if ($?) ; | |
4228 | `chmod +w symbol.tbl` ; | |
4229 | die ("DIE. unable to change permission of symbol table") if ($?) ; | |
4230 | ||
4231 | # pre process if needed | |
4232 | &pre_process ; | |
4233 | } | |
4234 | ||
4235 | #############################################################################}}} | |
4236 | # copy efuse image {{{ | |
4237 | ################################################################################ | |
4238 | ||
4239 | sub copy_efuse_image | |
4240 | { | |
4241 | # first clean up the diag area | |
4242 | `rm -rf efuse.img` ; | |
4243 | die ("DIE. could not clean up efuse image from run area") if ($?) ; | |
4244 | ||
4245 | my $efuse_image_full_path = &find_diag_path ($opt{efuse_image_name}, $opt{efuse_image_path}, $opt{efuse_image_root}) ; | |
4246 | ||
4247 | `cp $efuse_image_full_path efuse.img` ; | |
4248 | die ("DIE. could not copy efuse image to $ENV{PWD}") if ($?) ; | |
4249 | `chmod +w efuse.img` ; | |
4250 | die ("DIE. could not change permission of efuse image") if ($?) ; | |
4251 | } | |
4252 | ||
4253 | #############################################################################}}} | |
4254 | # generate efuse image {{{ | |
4255 | ################################################################################ | |
4256 | ||
4257 | sub generate_efuse_image | |
4258 | { | |
4259 | # first clean up the diag area | |
4260 | `rm -rf efuse.img` ; | |
4261 | die ("DIE. could not clean up efuse image from run area") if ($?) ; | |
4262 | ||
4263 | my $cmd = "efcgen.pl " ; | |
4264 | $cmd .= join (" ", @{$opt{efc_args}}) ; | |
4265 | $cmd .= " -seed=$opt{tg_seed} " ; | |
4266 | print "$prg: $cmd\n" ; | |
4267 | ||
4268 | system ($cmd) ; | |
4269 | die ("DIE. failed efuse image generation") if ($?) ; | |
4270 | ||
4271 | `chmod +w efuse.img` ; | |
4272 | die ("DIE. could not change permission of efuse image") if ($?) ; | |
4273 | } | |
4274 | ||
4275 | #############################################################################}}} | |
4276 | # compile dftvert vera diag {{{ | |
4277 | ################################################################################ | |
4278 | ||
4279 | sub compile_dftvert_diag | |
4280 | { | |
4281 | # first clean up the diag area | |
4282 | `rm -rf diag.vr diag.vrpal diag.vro` ; | |
4283 | die ("DIE. could not clean up dftvert vera diag run area") if ($?) ; | |
4284 | ||
4285 | my $vera_full_path = &find_diag_path ($opt{vera_diag_name}, $opt{vera_diag_path}, $opt{vera_diag_root}) ; | |
4286 | ||
4287 | ## ($opt{vera_diag_path}) = $vera_full_path =~ m/(.*)\//o; | |
4288 | ||
4289 | if ( $vera_full_path =~ /\.vrpal$/ ) { # pal diag to be expanded | |
4290 | `cp -f $vera_full_path diag.vrpal` ; | |
4291 | die ("DIE. failed dftvert vera pal diag copy to $ENV{PWD}") if ($?) ; | |
4292 | my $pal_opts = join (" ", @{$opt{vera_pal_diag_args}}) ; | |
4293 | $pal_opts .= " -seed=$opt{tg_seed} " if ($opt{pal_use_tgseed}) ; | |
4294 | `pal $pal_opts -o diag.vr diag.vrpal`; | |
4295 | die ("DIE. failed dftvert vera pal diag expansion to diag.vr") if ($?) ; | |
4296 | } else { | |
4297 | `cp -f $vera_full_path diag.vr` ; | |
4298 | die ("DIE. failed dftvert vera diag copy to $ENV{PWD}") if ($?) ; | |
4299 | } | |
4300 | `chmod +w diag.vr` ; | |
4301 | die ("DIE. failed to change permission of dftvert vera diag") if ($?) ; | |
4302 | ||
4303 | # pre process if needed | |
4304 | &pre_process ; | |
4305 | ||
4306 | print "$prg: Compiling dftvert vera diag\n" ; | |
4307 | my $cmd = "/import/bw/tools/release/tools/dftvert,1.0 "; | |
4308 | $cmd .= "-srcdir $opt{env_base}/vera " ; | |
4309 | $cmd .= "-diagfile diag.vr " ; | |
4310 | $cmd .= "-resultdir . " ; | |
4311 | $cmd .= "-cmpdiag" ; | |
4312 | print "$prg: $cmd\n" ; | |
4313 | system ($cmd) ; | |
4314 | die ("DIE. failed dftvert vera diag compilation") if ($?) ; | |
4315 | } | |
4316 | ||
4317 | #############################################################################}}} | |
4318 | # compile vera/NTB diag {{{ | |
4319 | # for NTB, the diag and bench are compiled together into one libtb.so file. | |
4320 | # If vera_dummy_diag is specified and vera_diag_name is not, the dummy will | |
4321 | # be compiled and used. Normally a diag would be specified. | |
4322 | ################################################################################ | |
4323 | ||
4324 | sub compile_vera_diag | |
4325 | { | |
4326 | my $cmd; | |
4327 | my $vera_full_path; | |
4328 | my $old_signature = 0; | |
4329 | ||
4330 | # NTB all-in-one complie has no diag so always bail even if user specifies one. | |
4331 | if ($opt{vcs_use_ntb} && !$opt{ntb_lib}) { | |
4332 | print("$prg: Ignoring your Vera diag! Do not use NTB ALL method if you have diags!\n"); | |
4333 | return; | |
4334 | } | |
4335 | ||
4336 | # get signature of previous diag.vr file if it exists. | |
4337 | # need this for NTB diags. If diag has not changed, the makefile won't | |
4338 | # remake the testbench pointlessly. | |
4339 | $old_signature = md5(`cat diag.vr`) if ($opt{vcs_use_ntb} && -e "diag.vr"); | |
4340 | ||
4341 | # first clean up the run dir | |
4342 | `rm -rf diag.vr diag.vrpal diag.vro` ; | |
4343 | die ("DIE. could not clean up vera diag run area") if ($?) ; | |
4344 | ||
4345 | # Override the vera diag name if not specified and dummy is specified | |
4346 | if (($opt{vera_dummy_diag} ne "" ) and ($opt{vera_diag_name} eq "")){ | |
4347 | print "$prg: using the vera dummy diag $opt{vera_dummy_diag}\n"; | |
4348 | # Dummy diag is expected to have FULL PATH | |
4349 | $vera_full_path = $opt{vera_dummy_diag}; | |
4350 | } else { | |
4351 | # Find diag if dummy diag not specified and diag is .. | |
4352 | $vera_full_path = &find_diag_path ($opt{vera_diag_name}, | |
4353 | $opt{vera_diag_path}, $opt{vera_diag_root}); | |
4354 | } | |
4355 | ||
4356 | ||
4357 | if ( $vera_full_path =~ /\.vrpal$/ ) { # pal diag to be expanded | |
4358 | `cp -f $vera_full_path diag.vrpal` ; | |
4359 | die ("DIE. failed vera pal diag copy to $ENV{PWD}") if ($?) ; | |
4360 | my $pal_opts = join (" ", @{$opt{vera_pal_diag_args}}) ; | |
4361 | $pal_opts .= " -seed=$opt{tg_seed} " if ($opt{pal_use_tgseed}) ; | |
4362 | `pal $pal_opts -o diag.vr diag.vrpal`; | |
4363 | die ("DIE. failed vera pal diag expansion to diag.vr") if ($?) ; | |
4364 | } else { | |
4365 | `cp -pf $vera_full_path diag.vr` ; # preserve mod time (-p) | |
4366 | die ("DIE. failed vera diag copy to $ENV{PWD}") if ($?) ; | |
4367 | } | |
4368 | `chmod +w diag.vr` ; | |
4369 | die ("DIE. failed to change permission of vera diag") if ($?) ; | |
4370 | ||
4371 | # pre process if needed | |
4372 | &pre_process ; | |
4373 | ||
4374 | # Add defines for cov objects as diag args.. | |
4375 | foreach my $obj (@{$opt{vera_cov_obj}}) | |
4376 | { | |
4377 | $obj =~ tr/a-z/A-Z/ ; | |
4378 | push (@{$opt{vera_diag_args}}, "-D$obj") ; | |
4379 | } | |
4380 | ||
4381 | # ntb_lib, does NTB build of the diag AND bench together | |
4382 | if ($opt{vcs_use_ntb} && $opt{ntb_lib}) { | |
4383 | # stop dummy_diag from wastefully building during the regression build! | |
4384 | if (!$opt{vcs_run}) { | |
4385 | print "$prg: Not building NTB diag due to -novcs_run\n"; | |
4386 | return; | |
4387 | } | |
4388 | ||
4389 | mkdir "ntb" if (! -d "ntb"); | |
4390 | chdir "ntb" or die ("DIE. Can't cd to $ENV{PWD}/ntb") ; | |
4391 | ||
4392 | # construct gmake command | |
4393 | $cmd = "gmake -f $opt{env_base}/vera/Makefile "; | |
4394 | if ($opt{vcs_use_ntb} && $opt{ntb_lib}) { | |
4395 | if ($opt{vcs_use_cli}) { | |
4396 | $cmd .= " VCS_USE_CLI=\"+cli -line\" "; | |
4397 | } elsif ($opt{vcs_use_ucli}) { | |
4398 | $cmd .= " VCS_USE_CLI=\"-debug_all\" "; | |
4399 | } | |
4400 | ||
4401 | if ($opt{vcs_use_fsdb} or $opt{vcs_use_vcsd}) { | |
4402 | $cmd .= " VCS_USE_VCSD=+vcsd "; | |
4403 | } | |
4404 | } | |
4405 | push (@{$opt{vera_build_args}}, "+ver+lic+wait") ; | |
4406 | $cmd .= join (" ", @{$opt{vera_build_args}}) ; | |
4407 | $cmd .= " NTB_DIAG_ARGS=" . join (" ", @{$opt{vera_diag_args}}) . "" ; | |
4408 | ||
4409 | $ENV{VERA_LIBDIR} = "$ENV{PWD}"; | |
4410 | print "$prg: setenv VERA_LIBDIR $ENV{VERA_LIBDIR}\n"; | |
4411 | $cmd .= " VERA_LIBDIR=. NTB_DIAG=diag.vr USE_NTB_LIB=1 "; | |
4412 | ||
4413 | # do a clean of the diag/lib build dir if -vera_clean | |
4414 | if ($opt{vera_clean}) | |
4415 | { | |
4416 | print "$prg: $cmd clean\n" ; | |
4417 | system ("$cmd clean") ; | |
4418 | die ("DIE. failed cleaning NTB lib build in $ENV{PWD}") if ($?) ; | |
4419 | } | |
4420 | ||
4421 | `rm -f diag.vr` if (-e "diag.vr"); | |
4422 | `ln -s ../diag.vr diag.vr`; | |
4423 | ||
4424 | # touch diagChanged if prev and current diag signatures do not match | |
4425 | # or if no diagChanged file exists at all. Makefile looks at diagChanged. | |
4426 | # If user re-runs same diag, we don't want to rebuild bench pointlessly. | |
4427 | if (-e "diagChanged") { | |
4428 | `touch diagChanged` if (-e "diag.vr" && $old_signature ne md5(`cat diag.vr`)); | |
4429 | } else { | |
4430 | `touch diagChanged`; | |
4431 | } | |
4432 | ||
4433 | $cmd .= " ntb_diag"; | |
4434 | push (@{$opt{vcs_run_args}}, "+ntb_load=ntb/libtb.so"); | |
4435 | print "$prg: Compiling NTB openVera diag plus bench in $ENV{PWD}\n" ; | |
4436 | ||
4437 | } else { | |
4438 | # the Makefile should be doing this!!! | |
4439 | $cmd = "vera -cmp -max_error 5 -q -I $model_path/vera "; | |
4440 | $cmd .= join (" ", @{$opt{vera_diag_args}}) ; | |
4441 | $cmd .= " diag.vr"; | |
4442 | print "$prg: Compiling vera diag in $ENV{PWD}\n" ; | |
4443 | } | |
4444 | ||
4445 | print "$prg: $cmd\n" ; | |
4446 | ||
4447 | system ($cmd) ; | |
4448 | if ($?) { | |
4449 | chdir ".." if ( $opt{vcs_use_ntb} && $opt{ntb_lib} ); | |
4450 | die ("DIE. failed vera diag compilation"); | |
4451 | } | |
4452 | # vcs does not touch libtb.so if nothing functional changed. | |
4453 | # if a user changes a comment in a source file then make always sees | |
4454 | # that file as being newer than libtb.so and so we build when there | |
4455 | # is not reason to. Always touching at this point solves that issue. | |
4456 | #`touch libtb.so`; | |
4457 | ||
4458 | # return from the NTB build area for this gmake if ntb_lib | |
4459 | chdir ".." if ($opt{vcs_use_ntb} && $opt{ntb_lib}); | |
4460 | ||
4461 | } | |
4462 | ||
4463 | #############################################################################}}} | |
4464 | # complile vera config {{{ | |
4465 | ################################################################################ | |
4466 | ||
4467 | sub compile_vera_config | |
4468 | { | |
4469 | # first clean up the diag area | |
4470 | `rm -rf config.vr config.vro`; | |
4471 | die ("DIE. could not clean up vera config run area") if ($?) ; | |
4472 | ||
4473 | my $vera_full_path = &find_diag_path ($opt{vera_config_name}, $opt{vera_config_path}, $opt{vera_config_root}) ; | |
4474 | ||
4475 | `cp -f $vera_full_path config.vr; chmod +w config.vr` ; | |
4476 | die ("DIE. failed vera config copy to $ENV{PWD}") if ($?) ; | |
4477 | ||
4478 | # pre process if needed | |
4479 | &pre_process ; | |
4480 | ||
4481 | print "$prg: Compiling vera config\n" ; | |
4482 | my $cmd = "vera -cmp -max_error 5 -q -I $model_path/vera "; | |
4483 | $cmd .= join (" ", @{$opt{vera_diag_args}}) ; | |
4484 | $cmd .= " config.vr " ; | |
4485 | print "$prg: $cmd\n" ; | |
4486 | system ($cmd) ; | |
4487 | die ("DIE. failed vera config compilation") if ($?) ; | |
4488 | } | |
4489 | ||
4490 | #############################################################################}}} | |
4491 | # copy tap diag {{{ | |
4492 | ################################################################################ | |
4493 | ||
4494 | sub assemble_tap_diag | |
4495 | { | |
4496 | # first clean up the diag area | |
4497 | `rm -rf tap.cmd`; | |
4498 | die ("DIE. could not clean up tap run area") if ($?) ; | |
4499 | ||
4500 | my $tap_full_path = &find_diag_path ($opt{tap_diag_name}, $opt{tap_diag_path}, $opt{tap_diag_root}) ; | |
4501 | ||
4502 | `cp $tap_full_path diag.tap` ; | |
4503 | die ("DIE. could not copy tap diag to $ENV{PWD}") if ($?) ; | |
4504 | `chmod +w diag.tap` ; | |
4505 | die ("DIE. could not change permission of tap diag") if ($?) ; | |
4506 | ||
4507 | # pre process if needed | |
4508 | &pre_process ; | |
4509 | ||
4510 | # compile the tap diag | |
4511 | ||
4512 | my $cmd = "tapasm" ; | |
4513 | system ($cmd) ; | |
4514 | die ("DIE. could not assemble tap diag") if ($?) ; | |
4515 | } | |
4516 | ||
4517 | #############################################################################}}} | |
4518 | # copy tpt diag {{{ | |
4519 | ################################################################################ | |
4520 | ||
4521 | sub copy_tpt | |
4522 | { | |
4523 | # first clean up the diag area | |
4524 | `rm -rf diag.tpt`; | |
4525 | die ("DIE. could not clean up tpt run area") if ($?) ; | |
4526 | ||
4527 | my $tpt_full_path = &find_diag_path ($opt{tpt_diag_name}, $opt{tpt_diag_path}, $opt{tpt_diag_root}) ; | |
4528 | ||
4529 | `cp $tpt_full_path diag.tpt` ; | |
4530 | die ("DIE. could not copy tpt diag to $ENV{PWD}") if ($?) ; | |
4531 | `chmod +w diag.tpt` ; | |
4532 | die ("DIE. could not change permission of tpt diag") if ($?) ; | |
4533 | ||
4534 | # pre process if needed | |
4535 | &pre_process ; | |
4536 | } | |
4537 | ||
4538 | #############################################################################}}} | |
4539 | # generate an sjm diag {{{ | |
4540 | ################################################################################ | |
4541 | ||
4542 | sub generate_sjm_diag | |
4543 | { | |
4544 | # first clean up the diag area | |
4545 | `rm -rf sjm_4.cmd sjm_5.cmd`; | |
4546 | die ("DIE. could not clean up sjm run area") if ($?) ; | |
4547 | ||
4548 | my $cmd = "sjm_tstgen.pl " ; | |
4549 | $cmd .= join (" ", @{$opt{sjm_args}}) ; | |
4550 | $cmd .= " -seed=$opt{tg_seed} " ; | |
4551 | ||
4552 | if (($opt{sjm_diag_name} ne "") or ($opt{sjm_diag_path} ne "")) | |
4553 | { | |
4554 | my $sjm_full_path = &find_diag_path ($opt{sjm_diag_name}, $opt{sjm_diag_path}, $opt{sjm_diag_root}) ; | |
4555 | `cp ${sjm_full_path}/sjm_4.cmd sjm_4.cmd` ; | |
4556 | die ("DIE. could not copy sjm_4 diag to $ENV{PWD}") if ($?) ; | |
4557 | `chmod +w sjm_4.cmd` ; | |
4558 | die ("DIE. could not change permission of sjm_4 diag") if ($?) ; | |
4559 | ||
4560 | `cp ${sjm_full_path}/sjm_5.cmd sjm_5.cmd` ; | |
4561 | die ("DIE. could not copy sjm_5 diag to $ENV{PWD}") if ($?) ; | |
4562 | `chmod +w sjm_5.cmd` ; | |
4563 | die ("DIE. could not change permission of sjm_5 diag") if ($?) ; | |
4564 | } | |
4565 | elsif ($opt{tomatillo}) | |
4566 | { | |
4567 | $cmd .= " -t " ; | |
4568 | system ($cmd) ; | |
4569 | die ("DIE. could not generate tomatillo sjm diag") if ($?) ; | |
4570 | } | |
4571 | else | |
4572 | { | |
4573 | system ($cmd) ; | |
4574 | die ("DIE. could not generate sjm diag") if ($?) ; | |
4575 | } | |
4576 | ||
4577 | # pre process if needed | |
4578 | &pre_process ; | |
4579 | } | |
4580 | ||
4581 | #############################################################################}}} | |
4582 | # generate an pci diag {{{ | |
4583 | ################################################################################ | |
4584 | ||
4585 | sub generate_pci_diag | |
4586 | { | |
4587 | # first clean up the diag area | |
4588 | # `rm -rf pci_4.cmd pci_5.cmd`; | |
4589 | # die ("DIE. could not clean up pci run area") if ($?) ; | |
4590 | ||
4591 | my $cmd = "pci_cmdgen.pl " ; | |
4592 | $cmd .= join (" ", @{$opt{pci_args}}) ; | |
4593 | $cmd .= " -seed=$opt{tg_seed} " ; | |
4594 | ||
4595 | if (($opt{pci_diag_name} ne "") or ($opt{pci_diag_path} ne "")) | |
4596 | { | |
4597 | my $pci_full_path = &find_diag_path ($opt{pci_diag_name}, $opt{pci_diag_path}, $opt{pci_diag_root}) ; | |
4598 | `cp ${pci_full_path}/* .` ; | |
4599 | die ("DIE. could not copy pci diag to $ENV{PWD}") if ($?) ; | |
4600 | `chmod +w *` ; | |
4601 | die ("DIE. could not change permission of pci diag") if ($?) ; | |
4602 | } | |
4603 | elsif ($opt{tomatillo}) | |
4604 | { | |
4605 | $cmd .= " -t " ; | |
4606 | system ($cmd) ; | |
4607 | die ("DIE. could not generate tomatillo pci diag") if ($?) ; | |
4608 | } | |
4609 | else | |
4610 | { | |
4611 | system ($cmd) ; | |
4612 | die ("DIE. could not generate pci diag") if ($?) ; | |
4613 | } | |
4614 | ||
4615 | # pre process if needed | |
4616 | &pre_process ; | |
4617 | } | |
4618 | ||
4619 | #############################################################################}}} | |
4620 | # locate a diag based on diag_root, diag_path and diag_name {{{ | |
4621 | ################################################################################ | |
4622 | ||
4623 | sub find_diag_path | |
4624 | { | |
4625 | my $diag_name = shift ; | |
4626 | my $diag_path = shift ; | |
4627 | my $diag_root = shift ; | |
4628 | ||
4629 | my @full_path = () ; | |
4630 | ||
4631 | print "$prg: locating diag $diag_name\n" ; | |
4632 | ||
4633 | if (($diag_path ne "") and (-e "${diag_path}/$diag_name")) | |
4634 | { | |
4635 | push (@full_path, "${diag_path}/$diag_name\n") ; | |
4636 | } | |
4637 | else | |
4638 | { | |
4639 | foreach my $root (@{$diag_root}) | |
4640 | { | |
4641 | print "$prg: Looking for diag under $root\n" ; | |
4642 | @full_path = `find $root -follow -name '$diag_name'`; | |
4643 | last if ($#full_path > -1) ; | |
4644 | } | |
4645 | } | |
4646 | ||
4647 | if ($#full_path == -1) { die ("DIE. no diag with name $diag_name found") ; } | |
4648 | if ($#full_path > 0) { die ("DIE. multiple diags with name $diag_name found") ; } | |
4649 | ||
4650 | chomp $full_path[0]; | |
4651 | print "$prg: Found diag under $full_path[0]\n" ; | |
4652 | return $full_path[0] ; | |
4653 | } | |
4654 | ||
4655 | #############################################################################}}} | |
4656 | # parse all arguments from command line and config file {{{ | |
4657 | ################################################################################ | |
4658 | ||
4659 | sub parse_args | |
4660 | { | |
4661 | my $sys = shift ; | |
4662 | my $doconfig = shift ; | |
4663 | ||
4664 | if ( $opt{vcs_full64} ) { | |
4665 | push (@{$opt{config_cpp_args}}, "-DSIMS_64BIT"); | |
4666 | print "$prg: added -DSIMS_64BIT to config_cpp_args\n" ; | |
4667 | } | |
4668 | ||
4669 | &get_config ($sys, \@ARGV) if ($opt{use_config} and $doconfig) ; | |
4670 | ||
4671 | #print "\@ARGV: @{ARGV}\n" if $opt_debug; | |
4672 | ||
4673 | foreach my $q (0 .. $#ARGV) | |
4674 | { | |
4675 | ($ARGV[$q] =~ s/(-.*?)=(.*)/$1=\"$2\"/) if (($ARGV[$q] =~ /\s/) and ($ARGV[$q] !~ /-.*?="/)) ; #" | |
4676 | } | |
4677 | ||
4678 | GetOptions (\%opt, | |
4679 | 'alias=s', | |
4680 | 'asm_diag_name=s', | |
4681 | 'asm_diag_path=s', | |
4682 | 'asm_diag_root=s@', | |
4683 | 'auditr_args=s@', | |
4684 | 'build!', | |
4685 | 'cc_dv_root=s', | |
4686 | 'clearcase!', | |
4687 | 'cdms_rel_name=s', | |
4688 | 'config_cpp_args=s@', | |
4689 | 'config_rtl=s@', | |
4690 | 'debug!', | |
4691 | 'debussy!', | |
4692 | 'dftvert!', | |
4693 | 'diag_pl_args=s@', | |
4694 | 'diaglist=s', | |
4695 | 'diaglist_cpp_args=s@', | |
4696 | 'diff_cdms_rel!', | |
4697 | 'diff_cdms_curr!', | |
4698 | 'drmlog!', | |
4699 | 'drmlog_name=s', | |
4700 | 'drmcommand_name=s', | |
4701 | 'drmconstraints_name=s', | |
4702 | 'drm_constraints_file=s', | |
4703 | 'drm_cpufreq=s', | |
4704 | 'drm_disk=s', | |
4705 | 'drm_freeprocessor=s', | |
4706 | 'drm_freeram=s', | |
4707 | 'drm_freeswap=s', | |
4708 | 'drm_license=s', | |
4709 | 'drm_on!', | |
4710 | 'drm_osver=s', | |
4711 | 'drm_priority=s', | |
4712 | 'drm_project=s', | |
4713 | 'drm_type=s', | |
4714 | 'drm_totprocessor=s', | |
4715 | 'drm_window=s', | |
4716 | 'dv_root=s', | |
4717 | 'efc!', | |
4718 | 'efc_args=s@', | |
4719 | 'efuse_image_name=s', | |
4720 | 'efuse_image_path=s', | |
4721 | 'efuse_image_root=s@', | |
4722 | 'env_base=s', | |
4723 | 'fast_boot!', | |
4724 | 'finish_mask=s', | |
4725 | 'flist=s@', | |
4726 | 'fsdb2vcd!', | |
4727 | 'fsdbfile=s', | |
4728 | 'fsdbDumplimit=s', | |
4729 | 'fsdb_glitch!', | |
4730 | 'graft_flist=s', | |
4731 | 'group=s@', | |
4732 | 'group_name=s', | |
4733 | 'gzip!', | |
4734 | 'hcs_build!', | |
4735 | 'hcs_build_args=s@', | |
4736 | 'hcs_run!', | |
4737 | 'hcs_run_args=s@', | |
4738 | 'hcs_drm_tokens=i', | |
4739 | 'axis_build!', | |
4740 | 'axis_build_args=s@', | |
4741 | 'axis_run!', | |
4742 | 'axis_run_args=s@', | |
4743 | 'image_diag_name=s', | |
4744 | 'image_diag_path=s', | |
4745 | 'image_diag_root=s@', | |
4746 | 'indrm!', | |
4747 | 'interactive!', | |
4748 | 'max_cycle=i', | |
4749 | 'midas_args=s@', | |
4750 | 'midas_only!', | |
4751 | 'midas_use_tgseed!', | |
4752 | 'model_dir=s', | |
4753 | 'ntb_lib!', | |
4754 | 'overwrite!', | |
4755 | 'palladium_build!', | |
4756 | 'palladium_build_args=s@', | |
4757 | 'palladium_run!', | |
4758 | 'palladium_run_args=s@', | |
4759 | 'pal_use_tgseed!', | |
4760 | 'pci!', | |
4761 | 'pci_args=s@', | |
4762 | 'pci_diag_name=s', | |
4763 | 'pci_diag_path=s', | |
4764 | 'pci_diag_root=s@', | |
4765 | 'post_process_cmd=s@', | |
4766 | 'pre_process_cmd=s@', | |
4767 | 'reg_count=i', | |
4768 | 'regress!', | |
4769 | 'regress_date=s', | |
4770 | 'regress_id=s', | |
4771 | 'regress_time=s', | |
4772 | 'report!', | |
4773 | 'rerun!', | |
4774 | 'result_dir=s', | |
4775 | 'rtl_timeout=i', | |
4776 | 'run_diag_pl!', | |
4777 | 'sas!', | |
4778 | 'saslog!', | |
4779 | 'sas_run_args=s@', | |
4780 | 'sims_config=s', | |
4781 | 'sims_env=s@', | |
4782 | 'simslog!', | |
4783 | 'simslog_name=s', | |
4784 | 'sjm!', | |
4785 | 'sjm_args=s@', | |
4786 | 'sjm_diag_name=s', | |
4787 | 'sjm_diag_path=s', | |
4788 | 'sjm_diag_root=s@', | |
4789 | 'spis_diag_name=s', | |
4790 | 'spis_diag_path=s', | |
4791 | 'spis_diag_root=s@', | |
4792 | 'start_dump=i', | |
4793 | 'stop_dump=i', | |
4794 | 'stub_mask=s', | |
4795 | 'sunv_args=s@', | |
4796 | 'sunv_nonprim_list=s', | |
4797 | 'sunv_run!', | |
4798 | 'sunv_use_nonprim!', | |
4799 | 'sys=s', | |
4800 | #ifdef SYSTEMC_SUPPORT | |
4801 | 'sysc_build!', | |
4802 | 'syscan_build_args=s@', | |
4803 | #endif | |
4804 | 'sim_q_command=s', | |
4805 | 'tap_diag_name=s', | |
4806 | 'tap_diag_path=s', | |
4807 | 'tap_diag_root=s@', | |
4808 | 'tcl_tap!', | |
4809 | 'tcl_tap_diag=s', | |
4810 | 'tg_seed=i', | |
4811 | 'tomatillo!', | |
4812 | 'tpt_diag_name=s', | |
4813 | 'tpt_diag_path=s', | |
4814 | 'tpt_diag_root=s@', | |
4815 | 'use_auditr!', | |
4816 | 'use_config!', | |
4817 | 'use_denalirc=s', | |
4818 | 'use_sims_iver!', | |
4819 | 'vcd!', | |
4820 | 'vcdfile=s', | |
4821 | 'sim=s', | |
4822 | 'ncv_build!', | |
4823 | 'ncv_build_args=s@', | |
4824 | 'ncv_clean!', | |
4825 | 'ncv_run!', | |
4826 | 'ncv_run_args=s@', | |
4827 | 'vcs_build!', | |
4828 | 'vcs_build_args=s@', | |
4829 | 'vcs_clean!', | |
4830 | 'vcs_cm_args=s', | |
4831 | 'vcs_cm_cond=s', | |
4832 | 'vcs_cm_config=s', | |
4833 | 'vcs_cm_fsmcfg=s', | |
4834 | 'vcs_cm_merge!', | |
4835 | 'vcs_cm_name=s', | |
4836 | 'vcs_finish=i', | |
4837 | 'vcs_prof!', | |
4838 | 'vcs_full64!', | |
4839 | 'model_rel_name=s', | |
4840 | 'vcs_run!', | |
4841 | 'vcs_run_args=s@', | |
4842 | 'vcs_use_cli!', | |
4843 | 'vcs_use_ucli!', | |
4844 | 'vcs_use_cm!', | |
4845 | 'vcs_use_fsdb!', | |
4846 | 'vcs_use_initreg!', | |
4847 | 'vcs_use_ntb!', | |
4848 | 'vcs_use_rad!', | |
4849 | 'vcs_use_radincr!', | |
4850 | 'vcs_use_sdf!', | |
4851 | 'vcs_use_vcsd!', | |
4852 | 'vcs_use_vera!', | |
4853 | 'vera_build!', | |
4854 | 'vera_build_args=s@', | |
4855 | 'vera_clean!', | |
4856 | 'vera_config_name=s', | |
4857 | 'vera_config_path=s', | |
4858 | 'vera_config_root=s@', | |
4859 | 'vera_cov_obj=s@', | |
4860 | 'vera_diag_args=s@', | |
4861 | 'vera_dummy_diag=s', | |
4862 | 'vera_pal_diag_args=s@', | |
4863 | 'vera_diag_root=s@', | |
4864 | 'vera_diag_name=s', | |
4865 | 'vera_diag_path=s', | |
4866 | 'vera_gmake!', | |
4867 | 'vera_proj_args=s@', | |
4868 | 'vera_run!', | |
4869 | 'vera_vcon_file=s', | |
4870 | 'verbose!', | |
4871 | 'vfile=s@', | |
4872 | 'vlint_args=s@', | |
4873 | 'vlint_run!', | |
4874 | 'vlint_top=s', | |
4875 | 'illust_run!', | |
4876 | 'illust_args=s@', | |
4877 | 'verix_args=s@', | |
4878 | 'verix_libs=s@', | |
4879 | 'verix_run!', | |
4880 | 'verix_top=s', | |
4881 | 'wait_cycle_to_kill=i', | |
4882 | 'zeroIn_build!', | |
4883 | 'zeroIn_dbg_args=s@', | |
4884 | 'zeroInSearch_build!', | |
4885 | 'zeroIn_checklist!', | |
4886 | 'zeroIn_build_args=s@', | |
4887 | 'parallel!', | |
4888 | 'exe_dir=s', | |
4889 | 'cache!', | |
4890 | ); | |
4891 | ||
4892 | ||
4893 | foreach my $x (@ARGV) | |
4894 | { | |
4895 | if ($x =~ /\.s/) { $opt{asm_diag_name} = $x ; } | |
4896 | elsif ($x =~ /\.pal/) { $opt{asm_diag_name} = $x ; } | |
4897 | elsif ($x =~ /\.s\.gz/) { $opt{asm_diag_name} = $x ; } | |
4898 | elsif ($x =~ /\.tpt/) { $opt{tpt_diag_name} = $x ; } | |
4899 | elsif ($x =~ /\.tap/) { $opt{tap_diag_name} = $x ; } | |
4900 | elsif ($x =~ /\.image/) { $opt{image_diag_name} = $x ; } | |
4901 | elsif ($x =~ /\.vrpal/) { $opt{vera_diag_name} = $x ; } | |
4902 | elsif ($x =~ /\.vr/) { $opt{vera_diag_name} = $x ; } | |
4903 | elsif ($x =~ /\.dat/) { $opt{efuse_image_name} = $x ; } | |
4904 | } | |
4905 | ||
4906 | # Override the vera diag name if not specified and dummy is specified | |
4907 | if (($opt{vera_dummy_diag} ne "" ) and ($opt{vera_diag_name} eq "")){ | |
4908 | print "$prg: vera dummy diag specified as $opt{vera_dummy_diag}\n"; | |
4909 | #$opt{vera_diag_name} = $opt{vera_dummy_diag}; | |
4910 | } | |
4911 | ||
4912 | # set environment variables | |
4913 | if (scalar(@{$opt{sims_env}})) { | |
4914 | foreach my $ex (@{$opt{sims_env}}) { | |
4915 | $ex =~ /(\w+)=(.*)/; | |
4916 | if (defined $ENV{$1}) { | |
4917 | print "$prg: overriding ENV{$1}=$2\n"; | |
4918 | } else { | |
4919 | print "$prg: setting ENV{$1}=$2\n"; | |
4920 | } | |
4921 | $ENV{$1}=$2; | |
4922 | } | |
4923 | } | |
4924 | # expand environment variables | |
4925 | $opt{env_base} =~ s/\$(\w+)/$ENV{$1}/g ; | |
4926 | $opt{sunv_nonprim_list} =~ s/\$(\w+)/$ENV{$1}/g ; | |
4927 | ||
4928 | # if -nobuild specified disable all build options | |
4929 | if ($opt{build} == 0) | |
4930 | { | |
4931 | $opt{sunv_run} = 0 ; | |
4932 | $opt{vcs_build} = 0 ; | |
4933 | $opt{ncv_build} = 0 ; | |
4934 | $opt{vera_build} = 0 ; | |
4935 | $opt{zeroIn_build} = 0 ; | |
4936 | $opt{zeroInSearch_build} = 0 ; | |
4937 | $opt{axis_build} = 0 ; | |
4938 | $opt{palladium_build} = 0 ; | |
4939 | $opt{hcs_build} = 0 ; | |
4940 | } | |
4941 | ||
4942 | # generate a random number generator seed if not specified | |
4943 | ||
4944 | if ($opt{tg_seed} == -1) | |
4945 | { | |
4946 | my $seed ; | |
4947 | open (RANDOM, "< /dev/random") or die "DIE. Could not open /dev/random" ; | |
4948 | sysread (RANDOM, $seed, 4) ; | |
4949 | close (RANDOM) ; | |
4950 | $opt{tg_seed} = unpack ("L*", $seed) & 0x7fffffff; | |
4951 | } | |
4952 | ||
4953 | print "$prg: using random seed $opt{tg_seed}\n" ; | |
4954 | ||
4955 | # let ntb over ride vera so users can try NTB from the command line w/o having | |
4956 | # to edit the bench config file. | |
4957 | if ($opt{vcs_use_ntb} and $opt{vcs_use_vera}) | |
4958 | { | |
4959 | undef $opt{vcs_use_vera}; | |
4960 | undef $opt{vera_run}; | |
4961 | $opt{drm_license} =~ s/,*vera=1//o; # No Vera license required .. | |
4962 | } | |
4963 | ||
4964 | } | |
4965 | ||
4966 | #############################################################################}}} | |
4967 | # get options from the diaglist if necessary {{{ | |
4968 | ################################################################################ | |
4969 | ||
4970 | sub get_opt_from_diaglist | |
4971 | { | |
4972 | # put the pre-processed diaglist in here | |
4973 | ||
4974 | die ("DIE. Diag list $diaglist not found") if (! -f $diaglist) ; | |
4975 | ||
4976 | print "$prg: processing diaglist ($diaglist)..\n" ; | |
4977 | my $diagcppargs = join(' ', @{$opt{diaglist_cpp_args}}); | |
4978 | system ("bw_cpp -B -undef $diagcppargs -I$dv_root/verif/diag $diaglist > master_diaglist") ; | |
4979 | die ("DIE. Could not pre-process the master_diaglist") if ($?) ; | |
4980 | ||
4981 | # open the diaglist and look for the group in it | |
4982 | ||
4983 | my $diagList = DiagList->new ("master_diaglist", $opt{null}, ${$opt{group}} [0]) ; | |
4984 | my $group = $diagList->find_group (${$opt{group}} [0]) ; | |
4985 | ||
4986 | die ("DIE. Group name $opt{group} not found in diag list $diaglist") if (! defined $group) ; | |
4987 | ||
4988 | my @tags = $group->build_tags () ; | |
4989 | ||
4990 | die ("DIE. Group name $opt{group} corrresponds to multiple build tags") if ($#tags > 0) ; | |
4991 | ||
4992 | my $tag = $tags [0] ; | |
4993 | my $buildargs = $diagList->build_args ($tag) ; | |
4994 | my ($sys) = ($buildargs =~ /sys\s*=\s*([a-z0-9_]+)\s*/i) ; | |
4995 | ||
4996 | foreach my $diagname ($group->list_diags($tag)) | |
4997 | { | |
4998 | my $diag = $group->find_diag($tag, $diagname) ; | |
4999 | my $alias = $diag->get_name () ; | |
5000 | ||
5001 | if ($alias eq $opt{alias}) | |
5002 | { | |
5003 | my @runargs = $diag->get_cmd_argv() ; | |
5004 | print "$prg: found alias $alias with arguments -sys=$sys @runargs\n" ; | |
5005 | ||
5006 | unshift (@ARGV, "-sys=$sys") ; | |
5007 | unshift (@ARGV, @runargs) ; | |
5008 | return ; | |
5009 | } | |
5010 | } | |
5011 | ||
5012 | die ("DIE. The alias $opt{alias} could not be found in the diaglist") ; | |
5013 | } | |
5014 | ||
5015 | #############################################################################}}} | |
5016 | # format 64bit dump_start/stop time into t+ht {{{ | |
5017 | ################################################################################ | |
5018 | ||
5019 | sub bigtime2plus | |
5020 | { | |
5021 | use Math::BigInt; | |
5022 | my $time = shift; | |
5023 | my $btime = Math::BigInt->new($time); | |
5024 | return (($btime&4294967295)."+".($btime>>32)); | |
5025 | ||
5026 | } | |
5027 | #############################################################################}}} | |
5028 | # deep copy any data structure {{{ | |
5029 | ################################################################################ | |
5030 | sub deep_copy { | |
5031 | my $this = shift; | |
5032 | if (not ref $this) { | |
5033 | $this; | |
5034 | } elsif (ref $this eq "SCALAR") { | |
5035 | $this; | |
5036 | } elsif (ref $this eq "ARRAY") { | |
5037 | [map deep_copy($_), @$this]; | |
5038 | } elsif (ref $this eq "HASH") { | |
5039 | +{map { $_ => deep_copy($this->{$_}) } keys %$this}; | |
5040 | } else { die "DIE deep_copy: what type is $_?\n" } | |
5041 | }#}}} | |
5042 | ||
5043 | ||
5044 | ||
5045 | ################################################################################ | |
5046 | ################################################################################ | |
5047 | ||
5048 | # # ##### # ##### ####### | |
5049 | # # # # # # # # # | |
5050 | # # # # # # # | |
5051 | # # ##### # # # #### ##### | |
5052 | # # # ####### # # # | |
5053 | # # # # # # # # # | |
5054 | ##### ##### # # ##### ####### | |
5055 | ||
5056 | ################################################################################ | |
5057 | ################################################################################ | |
5058 | ||
5059 | sub usage | |
5060 | { | |
5061 | ||
5062 | print <<EOF; | |
5063 | ||
5064 | NAME | |
5065 | ||
5066 | sims - Verilog rtl simulation environment and regression script | |
5067 | ||
5068 | SYNOPSIS | |
5069 | ||
5070 | sims [args ...] | |
5071 | where args are: | |
5072 | ||
5073 | NOTE: Use "=" instead of "space" to separate args and their options. | |
5074 | ||
5075 | SIMULATION ENV | |
5076 | ||
5077 | -sys=NAME | |
5078 | sys is a pointer to a specific testbench configuration | |
5079 | to be built and run. a config file is used to associate | |
5080 | the sys with a set of default options to build the | |
5081 | testbench and run diagnostics on it. the arguments | |
5082 | in the config file are the same as the arguments passed | |
5083 | on the command line. | |
5084 | ||
5085 | -group=NAME | |
5086 | group name identifies a set of diags to run in a | |
5087 | regression. The presence of this argument indicates | |
5088 | that this is a regession run. the group must be found | |
5089 | in the diaglist. multiple groups may be specified to be | |
5090 | run within the same regression. | |
5091 | ||
5092 | NOTE: If -sys=NAME option is specified then NAME.diaglist | |
5093 | is used as root diaglist instead of the master diaglist. | |
5094 | ||
5095 | -group=NAME -alias=ALIAS | |
5096 | this combination of options gets the diag run time options | |
5097 | from the diaglist based on the given group and alias. | |
5098 | the group must be found in the diaglist. the alias is | |
5099 | made up of diag_alias:name_tag. only one group should be | |
5100 | specified when using this command format. | |
5101 | ||
5102 | ||
5103 | VERILOG COMPILATION RELATED | |
5104 | ||
5105 | -sim_q_command="command" | |
5106 | defines which job queue manager command to use to launch jobs. | |
5107 | Defaults to /bin/sh and runs simulation jobs on the local machine. | |
5108 | ||
5109 | -flist=FLIST | |
5110 | full path to flist to be appended together to generate the | |
5111 | final verilog flist. multiple such arguments may be used and | |
5112 | each flist will be concatenated into the final verilog flist | |
5113 | used to build the model. | |
5114 | ||
5115 | -graft_flist=GRAFTFILE | |
5116 | GRAFTFILE is the full path to a file that lists each verilog | |
5117 | file that will be grafted into the design. the full path to | |
5118 | the verilog files must also be given in the GRAFTFILE. | |
5119 | ||
5120 | -vfile=FILE | |
5121 | verilog file to be included into the flist | |
5122 | ||
5123 | -config_rtl=DEFINE | |
5124 | each such parameter is place as a `define in config.v to | |
5125 | configure the model being built properly. this allows | |
5126 | each testbench to select only the rtl code that it needs | |
5127 | from the top level rtl file (ciop.v in blackwidow). | |
5128 | ||
5129 | -model=NAME | |
5130 | the name of a model to be built. the full path to a model | |
5131 | is MODEL_DIR/model/vcs_rel_name. | |
5132 | ||
5133 | -vcs_rel_name=NAME | |
5134 | specify the release of the model to be built. the full path | |
5135 | to a model is MODEL_DIR/model/vcs_rel_name. | |
5136 | ||
5137 | SYNOPSYS' VCS COMPILATION RELATED | |
5138 | ||
5139 | -vcs_build/-novcs_build | |
5140 | builds a vcs model and the vera testbench. defaults to off. | |
5141 | ||
5142 | -vcs_build_args=OPTION | |
5143 | vcs compile options. multiple options can be specified using | |
5144 | multiple such arguments. | |
5145 | ||
5146 | -vcs_clean/-novcs_clean | |
5147 | wipes out the model directory and rebuilds it from scratch. | |
5148 | defaults to off. | |
5149 | ||
5150 | -vcs_full64 | |
5151 | sets the vcs -full64 compile flag so that the compiler is a | |
5152 | 64 bit executable, and produces a 64 bit executable simv. | |
5153 | will use the 64 bit version of vera, and link in the 64 bit | |
5154 | versions of 0in, debussy, and denali tools. | |
5155 | ||
5156 | -vcs_use_2state/-novcs_use_2state | |
5157 | builds a 2state model instead of the default 4state model. | |
5158 | this defaults to off. | |
5159 | ||
5160 | -vcs_use_initreg/-novcs_use_initreg | |
5161 | initialize all registers to a valid state (1/0). | |
5162 | this feature works with -tg_seed to set the seed of the random | |
5163 | initialization. this defaults to off. | |
5164 | ||
5165 | -vcs_use_fsdb/-novcs_use_fsdb | |
5166 | use the debussy fsdb pli and include the dump calls in the | |
5167 | testbench. this defaults to on. | |
5168 | ||
5169 | -vcs_use_vcsd/-novcs_use_vcsd | |
5170 | use the vcs direct kernel interface to dump out debussy files. | |
5171 | this defaults to on. | |
5172 | ||
5173 | -vcs_use_vera/-novcs_use_vera | |
5174 | compile in the vera libraries. if -vcs_use_ntb and -vcs_use_vera are | |
5175 | used, -vcs_use_ntb wins. | |
5176 | this defaults to off. | |
5177 | ||
5178 | -vcs_use_ntb/-novcs_use_ntb | |
5179 | enable the use of NTB when building model (simv) and running simv. | |
5180 | if -vcs_use_ntb and -vcs_use_vera are used, -vcs_use_ntb wins. | |
5181 | this defaults to off. | |
5182 | ||
5183 | -vcs_use_rad/-novcs_use_rad | |
5184 | use the +rad option when building a vcs model (simv). | |
5185 | defaults to off. | |
5186 | ||
5187 | -vcs_use_sdf/-novcs_use_sdf | |
5188 | build vcs model (simv) with an sdf file. | |
5189 | defaults to off. | |
5190 | ||
5191 | -vcs_use_radincr/-novcs_use_radincr | |
5192 | use incremental +rad when building a vcs model (simv). | |
5193 | defaults to off. | |
5194 | this is now permanently disabled as synopsys advises against | |
5195 | using it. | |
5196 | ||
5197 | -vcs_use_cli/-novcs_use_cli | |
5198 | use the +cli -line options when building a vcs model (simv). | |
5199 | defaults to off. | |
5200 | ||
5201 | use this switch, in conjunction with -nosimslog during runtime | |
5202 | if you need to pass ctrl-c to the vcs/axis model and continue | |
5203 | with CLI activity. | |
5204 | ||
5205 | Use this with VCS versions before 2006. | |
5206 | ||
5207 | -vcs_use_ucli/-novcs_use_ucli (Unified cli) | |
5208 | use the -debug_all option when building a vcs model (simv). | |
5209 | defaults to off. | |
5210 | ||
5211 | use this switch, in conjunction with -nosimslog during runtime | |
5212 | if you need to pass ctrl-c to the vcs/axis model and continue | |
5213 | with UCLI activity. | |
5214 | ||
5215 | At runtime, use -vcs_run_arg=-ucli to get the UCLI at time zero, | |
5216 | or use -vcs_run_arg=-gui to get the UCLI GUI at time zero. | |
5217 | At runtime, use -vcs_run_arg=-tbug to get NTB debug in the GUI. | |
5218 | ||
5219 | Use this with VCS versions 2006 and up. | |
5220 | ||
5221 | CADENCE's NC-VERILOG COMPILATION RELATED | |
5222 | ||
5223 | -ncv_build/-noncv_build | |
5224 | builds a ncverilog model and the vera testbench. defaults to off. | |
5225 | ||
5226 | -ncv_build_args=OPTION | |
5227 | ncverilog compile options. multiple options can be specified using | |
5228 | multiple such arguments. | |
5229 | ||
5230 | -ncv_clean/-noncv_clean | |
5231 | wipes out the model directory and rebuilds it from scratch. | |
5232 | defaults to off. | |
5233 | ||
5234 | SYSTEMC COMPILATION RELATED | |
5235 | ||
5236 | -sysc_build | |
5237 | builds the systemc model. | |
5238 | ||
5239 | VERA/NTB COMPILATION RELATED | |
5240 | ||
5241 | VERA and NTB share all of the vera options except a few. | |
5242 | See NTB RELATED section below. | |
5243 | ||
5244 | -vera_build/-novera_build | |
5245 | builds the vera/ntb testbench. default on. | |
5246 | ||
5247 | -vera_clean/-novera_clean | |
5248 | performs a gmake clean on the vera/ntb testbench before building | |
5249 | the model. defaults to off. | |
5250 | ||
5251 | -vera_build_args=OPTION | |
5252 | vera/NTB testbench compile time options. | |
5253 | Multiple options can be specified using multiple such | |
5254 | options. these are passed as arguments to the gmake call | |
5255 | when building the vera/NTB testbench. | |
5256 | (Eg: -vera_build_args=VERA_SYS_DEFS=\"-DSPC_BENCH -DGATESIM\") | |
5257 | ||
5258 | For NTB, -vera_build_args=NTB_BUILD_ARGS=\"+error+10 -ntb_define ABCD\" | |
5259 | can be used to add something directly to the \"vcs -ntb_cmp\" command. | |
5260 | For the -ntb_lib option, NTB_BUILD_ARGS will affect both the vshell and | |
5261 | bench+diag builds. See -vera_diag_args to not affect the vshell build. | |
5262 | ||
5263 | ||
5264 | -vera_diag_args=OPTION | |
5265 | vera/ntb diag compile time options. | |
5266 | Multiple options can be specified using multiple such | |
5267 | options. For Vera, these args are appended to the | |
5268 | \"vera -cmp ...\" command for the diag only. | |
5269 | (Eg: -vera_diag_args=\"-max_error 10\" or -vera_diag_args=-DNCU_ACK_DLY1=100) | |
5270 | ||
5271 | For NTB, these args are passed as arguments to the gmake | |
5272 | call as NTB_DIAG_ARGS=\" ...\" to be part of the NTB | |
5273 | bench+diag compile. These NTB_DIAG_ARGS are appended to | |
5274 | the \"vcs -ntb_cmp\" command when making the libtb.so so | |
5275 | they better be legal in that context. For NTB, these args | |
5276 | really affect the entire bench build, not just the diag, | |
5277 | BUT they they do not affect the vshell build. | |
5278 | (Eg. -vera_diag_args=+error+10 or -vera_diag_args=\"-ntb_define NCU_ACK_DLY1=100\") | |
5279 | ||
5280 | -vera_dummy_diag=PATH | |
5281 | ||
5282 | This option is used to give vera/NTB a path to a default | |
5283 | diag or diag class (or a default program top if using RVM) | |
5284 | that can be used for building purposes before an actual | |
5285 | diag is chosen (NTB build of vshell file before regression | |
5286 | for example). | |
5287 | ||
5288 | Also, some benches may run both asm and vera diags but the | |
5289 | vera diags are only run sometimes. In this case, you need a | |
5290 | dummy vera testcase class/program top to fill in when an | |
5291 | actual vera diag is not being used for that run (aka the | |
5292 | sometimes diag problem). If your openVera code refers to a | |
5293 | testcase class, you better have one even if it does nothing | |
5294 | else you will not be able to build. The dummy lets you | |
5295 | build. If your diag is implemented as the program top | |
5296 | (RVM) then the dummy must have #includes for ALL of your | |
5297 | vera interfaces or your vshell will be broken. | |
5298 | ||
5299 | Whenever the actual vera/NTB diag is specified, the dummy | |
5300 | is automatically *not* used (at regression time for | |
5301 | example). The vera_dummy_diag should be specified in the | |
5302 | bench config file. This option applies to Vera and NTB | |
5303 | (but NTB only when using the -ntb_lib option). | |
5304 | ||
5305 | -vera_pal_diag_args=OPTION | |
5306 | vera/ntb pal diag expansion options | |
5307 | (i.e. "pal OPTIONS -o diag.vr diag.vrpal") | |
5308 | multiple options can be specified using multiple such arguments. | |
5309 | ||
5310 | -vera_proj_args=OPTION | |
5311 | vera proj file generation options. multiple options can be | |
5312 | specified using multiple such arguments. | |
5313 | ||
5314 | -vera_vcon_file=ARG | |
5315 | name of the vera vcon file that is used when running the simulation. | |
5316 | ||
5317 | -vera_cov_obj=OBJ | |
5318 | this argument is passed to the vera Makefile as a OBJ=1 and to | |
5319 | vera as -DOBJ to enable a given vera coverage object. multiple | |
5320 | such arguments can be specified for multiple coverage objects. | |
5321 | ||
5322 | -vera_gmake/-novera_gmake | |
5323 | this argument optionally lets the flow skip running gmake for the | |
5324 | vera/NTB build, while maintaining other operations within the | |
5325 | -vera_build flow. default ON (execute gmake) | |
5326 | ||
5327 | NTB RELATED | |
5328 | ||
5329 | NTB and VERA share all of the vera options except these: | |
5330 | ||
5331 | -vcs_use_ntb/-novcs_use_ntb | |
5332 | enable the use of NTB (compiled vera) rather than the | |
5333 | conventional Vera. if -vcs_use_ntb and -vcs_use_vera are | |
5334 | used at once, then -vcs_use_ntb wins. defaults to off. | |
5335 | ||
5336 | -ntb_lib/-nontb_lib | |
5337 | enables the NTB 2 part compile where the openVera files | |
5338 | get compiled separately into a libtb.so file which is | |
5339 | dynamically loaded by vcs at runtime. The libtb.so file | |
5340 | is built by the Vera/NTB Makefile, not sims. Use the | |
5341 | Makefile to affect the build. If not using -ntb_lib, sims | |
5342 | will build VCS and the openVera files together in one | |
5343 | pass (uses Makefile to affect that build as well). default | |
5344 | is off. | |
5345 | ||
5346 | The ntb_lib method is know as the NTB LIB method. When not | |
5347 | using this ntb_lib method, the ALL IN ONE method is used. | |
5348 | ||
5349 | The NTB LIB method allows the bench to run unique openVera diags | |
5350 | that are separate from the bench (via a diaglist if desired). | |
5351 | ||
5352 | The NTB ALL IN ONE method does not allow the bench to run | |
5353 | unique openVera diags that are separate from the bench. | |
5354 | Use this for benches that do not run openVera diags | |
5355 | (perhaps the bench only runs asm diags | |
5356 | ||
5357 | SYNOPSYS VERA RUNTIME RELATED | |
5358 | ||
5359 | -vera_run/-novera_run | |
5360 | runs the ncverilog/vcs simulation and loads in the vera proj file | |
5361 | or the ntb libtb.so file. defaults to on. | |
5362 | ||
5363 | SIMV (SYNOPSYS' VCS) RELATED | |
5364 | ||
5365 | -vcd/-novcd | |
5366 | signals the bench to dump in VCD format | |
5367 | ||
5368 | -vcdfile=filename | |
5369 | the name of the vcd dump file. if the file name starts with | |
5370 | a "/", that is the file dumped to, otherwise, the actual file is | |
5371 | created under tmp_dir/vcdfile and copied back to the current | |
5372 | directory when the simulation ends. use "-vcdfile=`pwd`/filename" | |
5373 | to force the file to be written in the current directory directly | |
5374 | (not efficient since dumping is done over network instead of to | |
5375 | a local disk). | |
5376 | ||
5377 | -vcs_run/-novcs_run | |
5378 | runs the vcs simulation (simv). defaults to off. | |
5379 | ||
5380 | -vcs_run_args=OPTION | |
5381 | vcs (simv) runtime options. multiple options can be specified | |
5382 | using multiple such arguments. | |
5383 | ||
5384 | The order of vcs_run_args (plusargs) given to simv is: | |
5385 | args embedded in diag (using !SIMS+ARGS: ..), if any | |
5386 | args given in the command line, if any | |
5387 | args from diaglist : alias definition, if any | |
5388 | args from diaglist : <runargs>..</runargs>, if any | |
5389 | args from the config file, if any | |
5390 | ||
5391 | -vcs_finish=TIMESTAMP | |
5392 | forces vcs to finish and exit at the specified timestamp. | |
5393 | ||
5394 | -fast_boot/-nofast_boot | |
5395 | speeds up booting when using the ciop model. this passes the | |
5396 | +fast_boot switch to the simv run and the -sas_run_args=-DFAST_BOOT | |
5397 | and -midas_args=-DFAST_BOOT to sas and midas. Also sends | |
5398 | -DFAST_BOOT to the diaglist and config file preprocessors. | |
5399 | ||
5400 | -debussy/-nodebussy | |
5401 | enable debussy dump. this must be implemented in the testbench | |
5402 | to work properly. defaults to off. | |
5403 | ||
5404 | -start_dump=START | |
5405 | start dumping out a waveform after START number of units | |
5406 | ||
5407 | -stop_dump=STOP | |
5408 | stop dumping out a waveform after STOP number of units | |
5409 | ||
5410 | -fsdb2vcd | |
5411 | runs fsdb2vcd after the simulation has completed to generate a vcd file. | |
5412 | ||
5413 | -fsdbfile=filename | |
5414 | the name of the debussy dump file. | |
5415 | If the file name starts with a "/", that is the file dumped to, | |
5416 | otherwise, the actual file is created under tmp_dir/fsdbfile | |
5417 | and copied back to the current directory when the simulation ends. | |
5418 | Use "-fsdbfile=`pwd`/filename" to force the file to be | |
5419 | written in the current directory directly (not efficient since | |
5420 | dumping is done over network instead of to a local disk). | |
5421 | ||
5422 | -fsdbDumplimit=SIZE_IN_MB | |
5423 | max size of Debussy dump file. minimum value is 32MB. | |
5424 | Latest values of signal values making up that size is saved. | |
5425 | ||
5426 | -fsdb_glitch | |
5427 | turn on glitch and sequence dumping in fsdb file. this will collect | |
5428 | glitches and sequence of events within time in the fsdb waveform. | |
5429 | beware that this will cause the fsdb file size to grow significantly. | |
5430 | this is turned off by default. this option effectively does this: | |
5431 | setenv FSDB_ENV_DUMP_SEQ_NUM 1 | |
5432 | setenv FSDB_ENV_MAX_GLITCH_NUM 0 | |
5433 | ||
5434 | -rerun | |
5435 | rerun the simulation from an existing regression run directory. | |
5436 | ||
5437 | -overwrite | |
5438 | overwrite current run dir when doing a -rerun. default is to | |
5439 | create a rerun_<n> subdir for reruns. | |
5440 | ||
5441 | -post_process_cmd=COMMAND | |
5442 | post processing command to be run after vcs (simv) run completes | |
5443 | ||
5444 | -pre_process_cmd=COMMAND | |
5445 | pre processing command to be run before vcs (simv) run starts | |
5446 | ||
5447 | -use_denalirc=FILE | |
5448 | use FILE as the .denalirc in the run area. Default copies | |
5449 | env_base/.denalirc | |
5450 | ||
5451 | NCSIM (CADENCE's NC-VERILOG) RELATED | |
5452 | ||
5453 | -ncv_run/-noncv_run | |
5454 | runs the NC-Verilog simulation (ncsim). defaults to off. | |
5455 | ||
5456 | -ncv_run_args=OPTION | |
5457 | ncsim runtime options. multiple options can be specified | |
5458 | using multiple such arguments. | |
5459 | ||
5460 | -rerun | |
5461 | rerun the simulation from an existing regression run directory. | |
5462 | you can just say "% sims -rerun", and sims will automatically | |
5463 | extract the required arguments. | |
5464 | ||
5465 | -overwrite | |
5466 | overwrite current run dir when doing a -rerun. default is to | |
5467 | create a rerun_<n> subdir for reruns. | |
5468 | ||
5469 | -debussy/-nodebussy | |
5470 | enable debussy dump. this must be implemented in the testbench | |
5471 | to work properly. defaults to off. | |
5472 | ||
5473 | ||
5474 | VLINT OPTIONS | |
5475 | ||
5476 | -vlint_run/-novlint_run | |
5477 | runs the vlint program. defaults to off. | |
5478 | ||
5479 | -vlint_args | |
5480 | vlint options. The <sysName>.config file can contain | |
5481 | the desired vlint arguments, or they can also be given on | |
5482 | the command line. Typically the -vlint_compile is given | |
5483 | on the command line. | |
5484 | ||
5485 | vlint also requires identification of a rules deck. | |
5486 | ||
5487 | -illust_run | |
5488 | run illust after x2e | |
5489 | ||
5490 | -illust_args | |
5491 | illust options | |
5492 | ||
5493 | -vlint_top | |
5494 | top level module on which to run vlint | |
5495 | ||
5496 | VERIX OPTIONS | |
5497 | ||
5498 | -verix_run/-noverix_run | |
5499 | runs the verix program. defaults to off. | |
5500 | ||
5501 | -verix_libs | |
5502 | specify the library files to add to the vlist | |
5503 | ||
5504 | -verix_args | |
5505 | verix template options. The <sysName>.config file can contain | |
5506 | these desired verix arguments | |
5507 | ||
5508 | verix also requires <top>.verix.tmplt in the config dir. | |
5509 | ||
5510 | -verix_top | |
5511 | top level module on which to run verix | |
5512 | ||
5513 | ||
5514 | THARAS HAMMER RELATED | |
5515 | ||
5516 | -hcs_build | |
5517 | build a model to be run on the Hammer Hardware Accelerator. | |
5518 | ||
5519 | -hcs_build_args | |
5520 | build arguments for Hammer Hardware Accelerator | |
5521 | ||
5522 | -hcs_run | |
5523 | run a model on the Hammer Hardware Accelerator. | |
5524 | ||
5525 | -hcs_run_args | |
5526 | run arguments for the Hammer Hardware Accelerator. | |
5527 | ||
5528 | -hcs_drm_tokens | |
5529 | tokens for drmsubmit licenses | |
5530 | ||
5531 | AXIS RELATED | |
5532 | ||
5533 | -axis_build | |
5534 | build a model to be run on the Axis Hardware Accelerator. | |
5535 | ||
5536 | -axis_build_args | |
5537 | build arguments for Axis Hardware Accelerator | |
5538 | ||
5539 | -axis_run | |
5540 | run a model on the Axis Hardware Accelerator. | |
5541 | ||
5542 | -axis_run_args | |
5543 | run arguments for the Axis Hardware Accelerator. | |
5544 | ||
5545 | PALLADIUM RELATED | |
5546 | ||
5547 | -palladium_build | |
5548 | build a model to be run on the palladium Hardware Accelerator. | |
5549 | ||
5550 | -palladium_build_args | |
5551 | build arguments for palladium Hardware Accelerator | |
5552 | ||
5553 | -palladium_run | |
5554 | run a model on the palladium Hardware Accelerator. | |
5555 | ||
5556 | -palladium_run_args | |
5557 | run arguments for the palladium Hardware Accelerator. | |
5558 | ||
5559 | ||
5560 | ZEROIN RELATED | |
5561 | ||
5562 | -zeroIn_checklist | |
5563 | run 0in checklist | |
5564 | ||
5565 | -zeroIn_build | |
5566 | build 0In pli for simulation into vcs model | |
5567 | ||
5568 | -zeroInSearch_build | |
5569 | build 0in search pli for simulation into vcs model | |
5570 | ||
5571 | -zeroIn_build_args | |
5572 | additional arguments to be passed to the 0in command | |
5573 | ||
5574 | -zeroIn_dbg_args | |
5575 | additional debug arguments to be passed to the 0in shell | |
5576 | ||
5577 | SAS/SIMICS RELATED | |
5578 | ||
5579 | -sas/-nosas | |
5580 | run architecture-simulator. If vcs_run option is OFF, | |
5581 | simulation is sas-only. If vcs_run option is ON, sas | |
5582 | runs in lock-step with rtl. default to off. | |
5583 | ||
5584 | -sas_run_args=DARGS | |
5585 | Define arguments for sas. | |
5586 | ||
5587 | TCL/TAP RELATED | |
5588 | ||
5589 | -tcl_tap/-notcl_tap | |
5590 | run tcl/expect TAP program. If vcs_run option is OFF, | |
5591 | simulation is tcl-only. If vcs_run option is ON, tcl | |
5592 | runs in lock-step with rtl. default to off. | |
5593 | NOTE: You _must_ compile with -tcl_tap as well, to enable | |
5594 | to enable functions that are needed for running with tcl | |
5595 | ||
5596 | -tcl_tap_diag=diagname | |
5597 | Define top level tcl/expect diag name. | |
5598 | ||
5599 | MIDAS | |
5600 | ||
5601 | midas is the diag assembler | |
5602 | ||
5603 | -midas_args=DARGS | |
5604 | arguments for midas. midas creates memory image and user-event | |
5605 | files from the assembly diag. | |
5606 | ||
5607 | -midas_only | |
5608 | Compile the diag using midas and exit without running it. | |
5609 | ||
5610 | -midas_use_tgseed | |
5611 | Add -DTG_SEED=tg_seed to midas command line. Use -tg_seed to | |
5612 | set the value passed to midas or use a random value from /dev/random. | |
5613 | ||
5614 | PCI | |
5615 | ||
5616 | pci is the tomatillo pci bus functional model | |
5617 | ||
5618 | -pci_args | |
5619 | arguments to be passed in to pci_cmdgen.pl for generation of a pci | |
5620 | random diagnostic. | |
5621 | ||
5622 | -pci/-nopci | |
5623 | generates a random pci diagnostic using the -tg_seed if provided. | |
5624 | default is off. | |
5625 | ||
5626 | -tomatillo | |
5627 | generates a random tomatillo diagnostic using the -tg_seed if provided | |
5628 | ||
5629 | -tg_seed | |
5630 | random generator seed for pci/tomatillo random test generators | |
5631 | also the value passed to +initreg+ to randomly initialize registers | |
5632 | when -vcs_use_initreg is used. | |
5633 | ||
5634 | SJM | |
5635 | ||
5636 | sjm is the jalapeno jbus bus functional model | |
5637 | ||
5638 | -sjm_args | |
5639 | arguments to be passed in to sjm_tstgen.pl for generation of an sjm | |
5640 | random diagnostic. | |
5641 | ||
5642 | -sjm/-nosjm | |
5643 | generates a random sjm diagnostic using the -tg_seed if provided. | |
5644 | default is off. | |
5645 | ||
5646 | -tomatillo | |
5647 | generates a random tomatillo diagnostic using the -tg_seed if provided | |
5648 | ||
5649 | -tg_seed | |
5650 | random generator seed for sjm/tomatillo random test generators | |
5651 | also the value passed to +initreg+ to randomly initialize registers | |
5652 | when -vcs_use_initreg is used. | |
5653 | ||
5654 | EFCGEN | |
5655 | ||
5656 | efcgen.pl is a script to generate efuse.img files (default random), | |
5657 | which is used by the efuse controller after reset. | |
5658 | It is invoked by -efc. | |
5659 | ||
5660 | -efc/-noefc | |
5661 | generates an efuse image file using the -tg_seed if provided. | |
5662 | default is off. Random if no -efc_args specified. | |
5663 | ||
5664 | -efc_args | |
5665 | arguments to be passed in to efcgen.pl for generation of | |
5666 | an efuse image file. | |
5667 | Default is random efuse replacement for each block. | |
5668 | ||
5669 | -tg_seed | |
5670 | random generator seed for efcgen.pl script | |
5671 | also the value passed to +initreg+ to randomly initialize | |
5672 | registers when -vcs_use_initreg is used. | |
5673 | ||
5674 | VCS COVERMETER | |
5675 | ||
5676 | -vcs_use_cm/-novcs_use_cmd | |
5677 | passes in the -cm switch to vcs at build time and simv at runtime | |
5678 | default to off. | |
5679 | ||
5680 | -vcs_cm_args=ARGS | |
5681 | argument to be given to the -cm switch | |
5682 | ||
5683 | -vcs_cm_cond=ARGS | |
5684 | argument to be given to the -cm_cond switch. | |
5685 | ||
5686 | -vcs_cm_config=ARGS | |
5687 | argument to be given to the -cm_hier switch | |
5688 | ||
5689 | -vcs_cm_fsmcfg=ARGS | |
5690 | argument to be given to the -cm_fsmcfg switch | |
5691 | specifies an FSM coverage configuration file | |
5692 | ||
5693 | -vcs_cm_name=ARGS | |
5694 | argument to be given to the -cm_name switch. defaults to cm_data. | |
5695 | ||
5696 | DFT | |
5697 | ||
5698 | -dftvert | |
5699 | modifies the sims flow to accomodate dftvert. this skips compiling | |
5700 | the vera testbench and modifies the simv command line at runtime. | |
5701 | ||
5702 | ||
5703 | MISC | |
5704 | ||
5705 | -regress | |
5706 | pretend this is a regression and run the job in DRMJOBSCRATCHSPACE | |
5707 | instead of the launch directory. useful with -indrm and | |
5708 | -interactive options and single jobs. automatically added for | |
5709 | regressions. | |
5710 | ||
5711 | -nobuild | |
5712 | this is a master switch to disable all building options. | |
5713 | there is no such thing as -build to enable all build options. | |
5714 | ||
5715 | -copyall/-nocopyall | |
5716 | copy back all files to launch directory after passing | |
5717 | regression run. Normally, only failing runs cause a | |
5718 | copy back of files. | |
5719 | Default is off. | |
5720 | ||
5721 | -copydump/-nocopydump | |
5722 | copy back dump file to launch directory after passing | |
5723 | regression run. Normally, only failing runs cause a copy | |
5724 | back of non-log files. The file copied back is vcs.fsdb, | |
5725 | or vcs.vcd if -fsdb2vcd option is set. | |
5726 | Default is off. | |
5727 | ||
5728 | -tarcopy/-notarcopy | |
5729 | copy back files using 'tar'. This only works in copyall or | |
5730 | in the case the simulations 'fails' (per sims' determination). | |
5731 | Default is to use 'cp'. | |
5732 | ||
5733 | -diag_pl_args=ARGS | |
5734 | If the assembly diag has a Perl portion at the end, it | |
5735 | is put into diag.pl and is run as a Perl script. | |
5736 | This allows you to give arguments to that Perl script. | |
5737 | The arguments accumulate, if the option is used multiple | |
5738 | times. | |
5739 | ||
5740 | -pal_use_tgseed | |
5741 | Send '-seed=<tg_seed_value> to pal diags. Adds | |
5742 | -pal_diag_args=-seed=tg_seed to midas command line, and | |
5743 | -seed=tg_seed to pal options (vrpal diags). Use -tg_seed to set | |
5744 | the value passed to midas or use a random value from /dev/random. | |
5745 | ||
5746 | -parallel | |
5747 | when specifying multiple groups for regressions this switch will | |
5748 | submit each group to DReAM to be executed as a separate regression. | |
5749 | this has the effect of speeding up regression submissions. | |
5750 | NOTE: This switch must not be used with -indrm | |
5751 | ||
5752 | -reg_count=COUNT | |
5753 | runs the specified group multiple times in regression mode. this | |
5754 | is useful when we want to run the same diag multiple times using | |
5755 | a different random generator seed each time or some such. | |
5756 | ||
5757 | -regress_id=ID | |
5758 | specify the name of the regression | |
5759 | ||
5760 | -report | |
5761 | This flag is used to produce a report of a an old or running | |
5762 | regression. With -group options, sims produces the report | |
5763 | after the regression run. Report for the previous | |
5764 | regression run can be produced using -regress_id=ID | |
5765 | option along with this option, | |
5766 | ||
5767 | -finish_mask=MASK | |
5768 | masks for vcs simulation termination. Simulation terminates | |
5769 | when it hits 'good_trap' or 'bad_trap'. For multithread | |
5770 | simulation, simulation terminates when any of the thread | |
5771 | hits bad_trap, or all the threads specified by the finish_mask | |
5772 | hits the good_trap. | |
5773 | example: -finish_mask=0xe | |
5774 | Simulation will be terminated by good_trap, if thread 1, 2 and | |
5775 | 3 hits the good_trap. | |
5776 | ||
5777 | -stub_mask=MASK | |
5778 | mask for vcs simulation termination. Simulation ends when the | |
5779 | stub driving the relevant bit in the mask is asserted. This | |
5780 | is a hexadecimal value similar to -finish_mask | |
5781 | ||
5782 | -wait_cycle_to_kill=VAL | |
5783 | passes a +wait_cycle_to_kill to the simv run. a testbench | |
5784 | may chose to implement this plusarg to delay killing a | |
5785 | simulation by a number of clock cycles to allow collection | |
5786 | of some more data before exiting (e.g. waveform). | |
5787 | ||
5788 | -rtl_timeout | |
5789 | passes a +TIMEOUT to the simv run. | |
5790 | sets the number of clock cycles after all threads have become | |
5791 | inactive for the diag to exit with an error. if all threads hit | |
5792 | good trap on their own the diag exits right away. if any of the | |
5793 | threads is inactive without hitting good trap/bad trap the | |
5794 | rtl_timeout will be reached and the diag fails. default is 1000. | |
5795 | this is only implemented in the cmp based testbenches. | |
5796 | ||
5797 | -max_cycle | |
5798 | passes a +max_cycle to the simv run. | |
5799 | sets the maximum number of clock cycle that the diag will take | |
5800 | to complete. the default is 30000. if max_cycle is hit the diag | |
5801 | exits with a failure. not all testbenches implement this | |
5802 | feature. | |
5803 | ||
5804 | -norun_diag_pl | |
5805 | Does not run diag.pl (if it exists) after simv (vcs) run. | |
5806 | Use this option if, for some reason, you want to run an | |
5807 | existing assembly diag without the Perl part that is in | |
5808 | the original diag. | |
5809 | ||
5810 | -nosaslog | |
5811 | turns off redirection of sas stdout to the sas.log file. | |
5812 | use this option when doing interactive runs with sas. | |
5813 | ||
5814 | -nosimslog | |
5815 | turns off redirection of stdout and stderr to the sims.log | |
5816 | file. use this option in conjunction with -vcs_use_cli or | |
5817 | -vcs_use_ucli to get to the cli prompt when using vcs or to | |
5818 | see a truncated vcs.log file that exited with an | |
5819 | error. this must be used if you want control-c to work | |
5820 | while vcs is running. | |
5821 | ||
5822 | -nogzip | |
5823 | turns off compression of log files before they are copied over | |
5824 | during regressions. | |
5825 | ||
5826 | -version | |
5827 | print version number. | |
5828 | ||
5829 | -help | |
5830 | prints this | |
5831 | ||
5832 | IT SYSTEM RELATED | |
5833 | ||
5834 | -use_iver=FILE | |
5835 | full path to iver file for frozen tools | |
5836 | ||
5837 | -use_sims_iver/-nouse_sims_iver | |
5838 | For reruns of regression tests only, use sims.iver to choose | |
5839 | TRE tool versions saved during original regression run. | |
5840 | Defaults to true. | |
5841 | ||
5842 | -use_cdms_iver/-nouse_cdms_iver | |
5843 | Uses the frozen iver file located under DV_ROOT if present. | |
5844 | This defaults to true. This has no effect if an iver file | |
5845 | is not found under the cdms tree. | |
5846 | ||
5847 | -dv_root=PATH | |
5848 | absolute path to design root directory. this overrides DV_ROOT. | |
5849 | ||
5850 | -model_dir=PATH | |
5851 | absolute path to model root directory. this overrides MODEL_DIR. | |
5852 | ||
5853 | -tmp_dir=PATH | |
5854 | path where temporary files such as debussy dumps will be created | |
5855 | ||
5856 | -sims_config=FILE | |
5857 | full path to sims config file | |
5858 | ||
5859 | -sims_env=ENVAR=value | |
5860 | force sims to set ENVAR variable to specified value. | |
5861 | ||
5862 | -env_base=PATH | |
5863 | this specifies the root directory for the bench environment. | |
5864 | it is typically defined in the bench config file. It has no | |
5865 | default. | |
5866 | ||
5867 | -config_cpp_args=OPTION | |
5868 | this allows the user to provide CPP arguments (defines/undefines) | |
5869 | that will be used when the testbench configuration file is | |
5870 | processed through cpp. Multiple options are concatenated | |
5871 | together. | |
5872 | ||
5873 | -result_dir=PATH | |
5874 | this allows the regression run to be launched from a different | |
5875 | directory than the one sims was launced from. defaults to | |
5876 | PWD. | |
5877 | ||
5878 | -diaglist=FILE | |
5879 | full path to diaglist file | |
5880 | ||
5881 | -diaglist_cpp_args=OPTION | |
5882 | this allows the user to provide CPP arguments (defines/undefines) | |
5883 | that will be used when the diaglist file is processed through | |
5884 | cpp. Multiple options are concatenated together. | |
5885 | ||
5886 | -asm_diag_name=NAME | |
5887 | -tpt_diag_name=NAME | |
5888 | -tap_diag_name=NAME | |
5889 | -vera_diag_name=NAME | |
5890 | -vera_config_name=NAME | |
5891 | -efuse_image_name=NAME | |
5892 | -image_diag_name=NAME | |
5893 | -sjm_diag_name=NAME | |
5894 | -pci_diag_name=NAME | |
5895 | name of the diagnostic to be run. | |
5896 | ||
5897 | -asm_diag_root=PATH | |
5898 | -tpt_diag_root=PATH | |
5899 | -tap_diag_root=PATH | |
5900 | -vera_diag_root=PATH | |
5901 | -vera_config_root=PATH | |
5902 | -efuse_image_root=PATH | |
5903 | -image_diag_root=PATH | |
5904 | -sjm_diag_root=PATH | |
5905 | -pci_diag_root=PATH | |
5906 | absolute path to diag root directory. sims will perform a find | |
5907 | from here to find the specified type of diag. if more than one | |
5908 | instance of the diag name is found under root sims exits with | |
5909 | an error. this option can be specified multiple times to allow | |
5910 | multiple roots to be searched for the diag. | |
5911 | ||
5912 | -asm_diag_path=PATH | |
5913 | -tpt_diag_path=PATH | |
5914 | -tap_diag_path=PATH | |
5915 | -vera_diag_path=PATH | |
5916 | -vera_config_path=PATH | |
5917 | -efuse_image_path=PATH | |
5918 | -image_diag_path=PATH | |
5919 | -sjm_diag_path=PATH | |
5920 | -pci_diag_path=PATH | |
5921 | absolute path to diag directory. sims expects the specified | |
5922 | diag to be in this directory. the last value of this option | |
5923 | is the one used as the path. | |
5924 | ||
5925 | ClearCase | |
5926 | ||
5927 | -clearcase | |
5928 | assume we are in ClearCase environment for setting DV_ROOT and | |
5929 | launching DReAM commands. default is off (CDMS++ version control) | |
5930 | ||
5931 | -noclearcase | |
5932 | force clearcase option off | |
5933 | ||
5934 | -cc_dv_root=PATH | |
5935 | ClearCase path to design root directory. this overrides CC_DV_ROOT. | |
5936 | ||
5937 | DReAM | |
5938 | ||
5939 | Please refer to the drmsubmit man pages for more info on the following. | |
5940 | ||
5941 | -indrm | |
5942 | resubmits any sims command to DReAM. | |
5943 | ||
5944 | -noindrm | |
5945 | this is used in conjunction with -group to prevent a regression from | |
5946 | being submitted to DReAM. this will effectively run each job serially | |
5947 | on the local machine where the job was launched. | |
5948 | e.g. sims -group=ciop_regr -noindrm | |
5949 | ||
5950 | -interactive | |
5951 | resubmits any sims command to DReAM and runs it as an interactive session. | |
5952 | this effectively adds -i -m to the drmsubmit command. | |
5953 | ||
5954 | -drm_type=ARG | |
5955 | the type constraint for DReAM jobs. This constraint determines | |
5956 | the queue where a job will be submitted. The project is hardcoded | |
5957 | to be bw in sims. this deafults to vcs. | |
5958 | ||
5959 | -drm_constraints_file=FILE | |
5960 | the file specifying constraints for DReAM jobs. If this option | |
5961 | is specified, other -drm_* options are ignored. | |
5962 | ||
5963 | -drm_cpufreq=ARG | |
5964 | the cpufreq constraint for DReAM jobs. | |
5965 | ||
5966 | -drm_disk=ARG | |
5967 | the disk constraint for DReAM jobs. | |
5968 | ||
5969 | -drm_freeram=ARG | |
5970 | the freeram constraint for DReAM jobs. | |
5971 | ||
5972 | -drm_freeswap=ARG | |
5973 | the freeswap constraint for DReAM jobs. | |
5974 | ||
5975 | -drm_freeprocessor=ARG | |
5976 | the free processor constraint for DReAM jobs. | |
5977 | ||
5978 | -drm_totprocessor=ARG | |
5979 | the totprocessor constraint for DReAM jobs. | |
5980 | ||
5981 | -drm_priority=ARG | |
5982 | the priority constraint for DReAM jobs. | |
5983 | ||
5984 | -drm_license=ARG | |
5985 | the license constraint for DReAM jobs. this defaults to [vcs=1,vera=1]. | |
5986 | ||
5987 | ENV VARIABLES | |
5988 | ||
5989 | sims sets the following ENV variables that may be used with pre/post | |
5990 | processing scripts, and other internal tools: | |
5991 | ||
5992 | ASM_DIAG_NAME : Contains the assembly diag name. | |
5993 | SIMS_LAUNCH_DIR : Path to launch directory where sims is running the | |
5994 | job. Useful when job is run in dream scratch space. | |
5995 | VERA_LIBDIR : Dir where Vera/NTB files are compiled or results are stored. | |
5996 | DV_ROOT : -dv_root if specifed | |
5997 | MODEL_DIR : -model_dir if specified | |
5998 | TRE_SEARCH : Based on -use_iver, -use_cdms_iver -use_sims_iver | |
5999 | DENALI : Based on configsrch | |
6000 | VCS_HOME : Based on configsrch | |
6001 | VERA_HOME : Based on configsrch | |
6002 | ||
6003 | PLUSARGS | |
6004 | ||
6005 | +args are not implemented in sims. they are passed directly to vcs at | |
6006 | compile time and simv at runtime. the plusargs listed here are for | |
6007 | reference purposes only. | |
6008 | ||
6009 | +STACK_DIMM 32 bits physical address space - default is 31 bits | |
6010 | ||
6011 | +STACK_DIMM +RANK_DIMM 33 bits physical address space - default is 31 bits | |
6012 | ||
6013 | +max_cycle see -max_cycle | |
6014 | ||
6015 | +TIMEOUT see -rtl_timeout | |
6016 | ||
6017 | +vcs+finish see -vcs_finish | |
6018 | ||
6019 | +wait_cycle_to_kill see -wait_cycle_to_kill | |
6020 | ||
6021 | DESCRIPTION | |
6022 | ||
6023 | sims is the frontend for vcs to run single simulations and regressions | |
6024 | ||
6025 | HOWTO | |
6026 | ||
6027 | Build models | |
6028 | ||
6029 | Build a model using DV_ROOT as design root | |
6030 | ||
6031 | sims -sys=cmp -vcs_build | |
6032 | ||
6033 | Build the vera testbench only using DV_ROOT as design root | |
6034 | ||
6035 | sims -sys=cmp -vera_build | |
6036 | ||
6037 | Build a model from any design root | |
6038 | ||
6039 | sims -sys=cmp -vcs_build -dv_root=/home/regress/2002_06_03 | |
6040 | ||
6041 | Build a graft model from any design root | |
6042 | ||
6043 | sims -sys=cmp -vcs_build -dv_root=/model/2002_06_03 \ | |
6044 | -graft_flist=/regress/graftfile | |
6045 | ||
6046 | Build a model and re-build the vera | |
6047 | ||
6048 | sims -sys=cmp -vcs_build -vera_clean | |
6049 | ||
6050 | Build a model and turn off incremental compile | |
6051 | ||
6052 | sims -sys=cmp -vcs_build -vcs_clean | |
6053 | ||
6054 | Build a model with a given name | |
6055 | ||
6056 | sims -sys=cmp -vcs_build -vcs_rel_name=mymodel | |
6057 | ||
6058 | RUN MODELS | |
6059 | ||
6060 | Run a diag with default model | |
6061 | ||
6062 | sims -sys=cmp -vcs_run diag.s | |
6063 | ||
6064 | Run a diag with a specified model | |
6065 | ||
6066 | sims -sys=cmp -vcs_rel_name=mymodel -vcs_run diag.s | |
6067 | ||
6068 | Run a diag with debussy dump with default model | |
6069 | ||
6070 | sims -sys=cmp -debussy -vcs_run diag.s <dump scope args> | |
6071 | ||
6072 | Run a diag using arguments form specified alias in a diaglist | |
6073 | ||
6074 | sims -vcs_run -sys=spc2 -group isa_mt -alias=isa_mmu_21:isa_mt isa_mmu_21.s | |
6075 | ||
6076 | Run regressions | |
6077 | ||
6078 | Run a regression using DV_ROOT as design root | |
6079 | ||
6080 | sims -group=mini | |
6081 | ||
6082 | Run a regression using DV_ROOT as design root and specify the diaglist | |
6083 | ||
6084 | sims -group=mini -diaglist=/home/user/my_dialist | |
6085 | ||
6086 | Run a regression using any design root | |
6087 | ||
6088 | sims -group=mini -dv_root=/afara/design/regress/model/2002_06_03 | |
6089 | ||
6090 | Run a regression using any design root and a graft model | |
6091 | ||
6092 | sims -group=mini -dv_root=/regress/model/2002_06_03 \ | |
6093 | -graft_flist=/home/regress/graftfile | |
6094 | ||
6095 | Rerun a diag in a regression (in new rerun_x subdir) | |
6096 | ||
6097 | sims -rerun | |
6098 | ||
6099 | Rerun a diag, overwriting same directory | |
6100 | ||
6101 | sims -rerun -overwrite | |
6102 | ||
6103 | ||
6104 | EOF | |
6105 | } | |
6106 | ||
6107 | # POD {{{ | |
6108 | __END__ | |
6109 | ||
6110 | =pod | |
6111 | ||
6112 | B<Sims(1.272) modified for release with OpenSparc T2 (SUN Niagara-2 Design)> | |
6113 | ||
6114 | ||
6115 | =head1 NAME | |
6116 | ||
6117 | sims - Verilog rtl simulation environment and regression script | |
6118 | ||
6119 | =head1 SYNOPSIS | |
6120 | ||
6121 | sims [args ...] | |
6122 | where args are: | |
6123 | ||
6124 | B<IMPORTANT: Use "=" instead of "space" to separate args and their options.> | |
6125 | ||
6126 | =head2 SIMULATION ENV | |
6127 | ||
6128 | -sys=NAME | |
6129 | sys is a pointer to a specific testbench configuration | |
6130 | to be built and run. a config file is used to associate | |
6131 | the sys with a set of default options to build the | |
6132 | testbench and run diagnostics on it. the arguments | |
6133 | in the config file are the same as the arguments passed | |
6134 | on the command line. | |
6135 | ||
6136 | -group=NAME | |
6137 | group name identifies a set of diags to run in a | |
6138 | regression. The presence of this argument indicates | |
6139 | that this is a regession run. the group must be found | |
6140 | in the diaglist. multiple groups may be specified to be | |
6141 | run within the same regression. | |
6142 | ||
6143 | B<Note: If -sys=NAME option is specified then NAME.diaglist | |
6144 | is used as root diaglist instead of the master diaglist.> | |
6145 | ||
6146 | -group=NAME -alias=ALIAS | |
6147 | this combination of options gets the diag run time options | |
6148 | from the diaglist based on the given group and alias. | |
6149 | the group must be found in the diaglist. the alias is | |
6150 | made up of diag_alias:name_tag. only one group should be | |
6151 | specified when using this command format. | |
6152 | ||
6153 | ||
6154 | =head2 VERILOG COMPILATION RELATED | |
6155 | ||
6156 | -sim_q_command="command ... ... ... " | |
6157 | 'command' is essentially a script you have devised | |
6158 | that allows you to dispatch your job on a free available CPU resource | |
6159 | in an effort to parallelize your runs (which can be substantial in number | |
6160 | depending on how many diags or tests are declared in the diaglist file. | |
6161 | Defaults to /bin/sh and runs simulation jobs on local machine. | |
6162 | ||
6163 | -flist=FLIST | |
6164 | full path to flist to be appended together to generate the | |
6165 | final verilog flist. multiple such arguments may be used and | |
6166 | each flist will be concatenated into the final verilog flist | |
6167 | used to build the model. | |
6168 | ||
6169 | -graft_flist=GRAFTFILE | |
6170 | GRAFTFILE is the full path to a file that lists each verilog | |
6171 | file that will be grafted into the design. the full path to | |
6172 | the verilog files must also be given in the GRAFTFILE. | |
6173 | ||
6174 | -vfile=FILE | |
6175 | verilog file to be included into the flist | |
6176 | ||
6177 | -config_rtl=DEFINE | |
6178 | each such parameter is place as a `define in config.v to | |
6179 | configure the model being built properly. this allows | |
6180 | each testbench to select only the rtl code that it needs | |
6181 | from the top level rtl file (ciop.v in blackwidow). | |
6182 | ||
6183 | -model_rel_name=NAME | |
6184 | specify the name of the simulation binary to be built. the full path | |
6185 | to a model is $MODEL_DIR/$sys/$model_rel_name. | |
6186 | ||
6187 | ||
6188 | =head2 CADENCE's NC-VERILOG COMPILATION RELATED | |
6189 | ||
6190 | -ncv_build/-noncv_build | |
6191 | builds a ncverilog model and the vera testbench. defaults to off. | |
6192 | ||
6193 | -ncv_build_args=OPTION | |
6194 | ncverilog compile options. multiple options can be specified using | |
6195 | multiple such arguments. | |
6196 | ||
6197 | -ncv_clean/-noncv_clean | |
6198 | wipes out the model directory and rebuilds it from scratch. | |
6199 | defaults to off. | |
6200 | ||
6201 | ||
6202 | =head2 SYNOPSYS' VCS COMPILATION RELATED | |
6203 | ||
6204 | -vcs_build/-novcs_build | |
6205 | builds a vcs model and the vera testbench. defaults to off. | |
6206 | ||
6207 | -vcs_build_args=OPTION | |
6208 | vcs compile options. multiple options can be specified using | |
6209 | multiple such arguments. | |
6210 | ||
6211 | -vcs_clean/-novcs_clean | |
6212 | wipes out the model directory and rebuilds it from scratch. | |
6213 | defaults to off. | |
6214 | ||
6215 | -vcs_full64 | |
6216 | sets the vcs -full64 compile flag so that the compiler is a | |
6217 | 64 bit executable, and produces a 64 bit executable simv. | |
6218 | will use the 64 bit version of vera, and link in the 64 bit | |
6219 | versions of 0in, debussy, and denali tools. | |
6220 | ||
6221 | -vcs_use_initreg/-novcs_use_initreg | |
6222 | initialize all registers to a valid state (1/0). | |
6223 | this feature works with -tg_seed to set the seed of the random | |
6224 | initialization. this defaults to off. | |
6225 | ||
6226 | -vcs_use_fsdb/-novcs_use_fsdb | |
6227 | use the debussy fsdb pli and include the dump calls in the | |
6228 | testbench. this defaults to on. | |
6229 | ||
6230 | -vcs_use_vcsd/-novcs_use_vcsd | |
6231 | use the vcs direct kernel interface to dump out debussy files. | |
6232 | this defaults to on. | |
6233 | ||
6234 | -vcs_use_vera/-novcs_use_vera | |
6235 | compile in the vera libraries. if -vcs_use_ntb and -vcs_use_vera are | |
6236 | used, -vcs_use_ntb wins. | |
6237 | this defaults to off. | |
6238 | ||
6239 | -vcs_use_ntb/-novcs_use_ntb | |
6240 | enable the use of NTB when building model (simv) and running simv. | |
6241 | if -vcs_use_ntb and -vcs_use_vera are used, -vcs_use_ntb wins. | |
6242 | this defaults to off. | |
6243 | ||
6244 | -vcs_use_rad/-novcs_use_rad | |
6245 | use the +rad option when building a vcs model (simv). | |
6246 | defaults to off. | |
6247 | ||
6248 | -vcs_use_sdf/-novcs_use_sdf | |
6249 | build vcs model (simv) with an sdf file. | |
6250 | defaults to off. | |
6251 | ||
6252 | -vcs_use_radincr/-novcs_use_radincr | |
6253 | use incremental +rad when building a vcs model (simv). | |
6254 | defaults to off. | |
6255 | this is now permanently disabled as synopsys advises against | |
6256 | using it. | |
6257 | ||
6258 | -vcs_use_cli/-novcs_use_cli | |
6259 | use the +cli -line options when building a vcs model (simv). | |
6260 | defaults to off. | |
6261 | ||
6262 | use this switch, in conjunction with -nosimslog during runtime | |
6263 | if you need to pass ctrl-c to the vcs/axis model and continue | |
6264 | with CLI activity. | |
6265 | ||
6266 | Use this with VCS versions before 2006. | |
6267 | ||
6268 | -vcs_use_ucli/-novcs_use_ucli (Unified cli) | |
6269 | use the -debug_all option when building a vcs model (simv). | |
6270 | defaults to off. | |
6271 | ||
6272 | use this switch, in conjunction with -nosimslog during runtime | |
6273 | if you need to pass ctrl-c to the vcs/axis model and continue | |
6274 | with UCLI activity. | |
6275 | ||
6276 | At runtime, use -vcs_run_arg=-ucli to get the UCLI at time zero, | |
6277 | or use -vcs_run_arg=-gui to get the UCLI GUI at time zero. | |
6278 | At runtime, use -vcs_run_arg=-tbug to get NTB debug in the GUI. | |
6279 | ||
6280 | Use this with VCS versions 2006 and up. | |
6281 | ||
6282 | ||
6283 | =head2 SYNOPSYS VERA/NTB COMPILATION RELATED | |
6284 | ||
6285 | VERA and NTB share all of the vera options except a few. | |
6286 | See NTB RELATED section below. | |
6287 | ||
6288 | -vera_build/-novera_build | |
6289 | builds the vera/ntb testbench. default on. | |
6290 | ||
6291 | -vera_clean/-novera_clean | |
6292 | performs a gmake clean on the vera/ntb testbench before building | |
6293 | the model. defaults to off. | |
6294 | ||
6295 | -vera_build_args=OPTION | |
6296 | vera/NTB testbench compile time options. | |
6297 | Multiple options can be specified using multiple such | |
6298 | options. these are passed as arguments to the gmake call | |
6299 | when building the vera/NTB testbench. | |
6300 | (Eg: -vera_build_args=VERA_SYS_DEFS=\"-DSPC_BENCH -DGATESIM\") | |
6301 | ||
6302 | For NTB, -vera_build_args=NTB_BUILD_ARGS=\"+error+10 -ntb_define ABCD\" | |
6303 | can be used to add something directly to the \"vcs -ntb_cmp\" command. | |
6304 | For the -ntb_lib option, NTB_BUILD_ARGS will affect both the vshell and | |
6305 | bench+diag builds. See -vera_diag_args to not affect the vshell build. | |
6306 | ||
6307 | ||
6308 | -vera_diag_args=OPTION | |
6309 | vera/ntb diag compile time options. | |
6310 | Multiple options can be specified using multiple such | |
6311 | options. For Vera, these args are appended to the | |
6312 | \"vera -cmp ...\" command for the diag only. | |
6313 | (Eg: -vera_diag_args=\"-max_error 10\" or -vera_diag_args=-DNCU_ACK_DLY1=100) | |
6314 | ||
6315 | For NTB, these args are passed as arguments to the gmake | |
6316 | call as NTB_DIAG_ARGS=\" ...\" to be part of the NTB | |
6317 | bench+diag compile. These NTB_DIAG_ARGS are appended to | |
6318 | the \"vcs -ntb_cmp\" command when making the libtb.so so | |
6319 | they better be legal in that context. For NTB, these args | |
6320 | really affect the entire bench build, not just the diag, | |
6321 | BUT they they do not affect the vshell build. | |
6322 | (Eg. -vera_diag_args=+error+10 or -vera_diag_args=\"-ntb_define NCU_ACK_DLY1=100\") | |
6323 | ||
6324 | -vera_dummy_diag=PATH | |
6325 | ||
6326 | This option is used to give vera/NTB a path to a default | |
6327 | diag or diag class (or a default program top if using RVM) | |
6328 | that can be used for building purposes before an actual | |
6329 | diag is chosen (NTB build of vshell file before regression | |
6330 | for example). | |
6331 | ||
6332 | Also, some benches may run both asm and vera diags but the | |
6333 | vera diags are only run sometimes. In this case, you need a | |
6334 | dummy vera testcase class/program top to fill in when an | |
6335 | actual vera diag is not being used for that run (aka the | |
6336 | sometimes diag problem). If your openVera code refers to a | |
6337 | testcase class, you better have one even if it does nothing | |
6338 | else you will not be able to build. The dummy lets you | |
6339 | build. If your diag is implemented as the program top | |
6340 | (RVM) then the dummy must have \#includes for ALL of your | |
6341 | vera interfaces or your vshell will be broken. | |
6342 | ||
6343 | Whenever the actual vera/NTB diag is specified, the dummy | |
6344 | is automatically *not* used (at regression time for | |
6345 | example). The vera_dummy_diag should be specified in the | |
6346 | bench config file. This option applies to Vera and NTB | |
6347 | (but NTB only when using the -ntb_lib option). | |
6348 | ||
6349 | -vera_pal_diag_args=OPTION | |
6350 | vera/ntb pal diag expansion options | |
6351 | (i.e. "pal OPTIONS -o diag.vr diag.vrpal") | |
6352 | multiple options can be specified using multiple such arguments. | |
6353 | ||
6354 | -vera_proj_args=OPTION | |
6355 | vera proj file generation options. multiple options can be | |
6356 | specified using multiple such arguments. | |
6357 | ||
6358 | -vera_vcon_file=ARG | |
6359 | name of the vera vcon file that is used when running the simulation. | |
6360 | ||
6361 | -vera_cov_obj=OBJ | |
6362 | this argument is passed to the vera Makefile as a OBJ=1 and to | |
6363 | vera as -DOBJ to enable a given vera coverage object. multiple | |
6364 | such arguments can be specified for multiple coverage objects. | |
6365 | ||
6366 | -vera_gmake/-novera_gmake | |
6367 | this argument optionally lets the flow skip running gmake for the | |
6368 | vera/NTB build, while maintaining other operations within the | |
6369 | -vera_build flow. default ON (execute gmake) | |
6370 | ||
6371 | =head2 NTB RELATED | |
6372 | ||
6373 | NTB and VERA share all of the vera options except these: | |
6374 | ||
6375 | -vcs_use_ntb/-novcs_use_ntb | |
6376 | enable the use of NTB (compiled vera) rather than the | |
6377 | conventional Vera. if -vcs_use_ntb and -vcs_use_vera are | |
6378 | used at once, then -vcs_use_ntb wins. defaults to off. | |
6379 | ||
6380 | -ntb_lib/-nontb_lib | |
6381 | enables the NTB 2 part compile where the openVera files | |
6382 | get compiled separately into a libtb.so file which is | |
6383 | dynamically loaded by vcs at runtime. The libtb.so file | |
6384 | is built by the Vera/NTB Makefile, not sims. Use the | |
6385 | Makefile to affect the build. If not using -ntb_lib, sims | |
6386 | will build VCS and the openVera files together in one | |
6387 | pass (uses Makefile to affect that build as well). default | |
6388 | is off. | |
6389 | ||
6390 | The ntb_lib method is know as the NTB LIB method. When not | |
6391 | using this ntb_lib method, the ALL IN ONE method is used. | |
6392 | ||
6393 | The NTB LIB method allows the bench to run unique openVera diags | |
6394 | that are separate from the bench (via a diaglist if desired). | |
6395 | ||
6396 | The NTB ALL IN ONE method does not allow the bench to run | |
6397 | unique openVera diags that are separate from the bench. | |
6398 | Use this for benches that do not run openVera diags | |
6399 | (perhaps the bench only runs asm diags | |
6400 | ||
6401 | =head2 SYNOPSYS VERA RUNTIME RELATED | |
6402 | ||
6403 | -vera_run/-novera_run | |
6404 | runs the ncverilog/vcs simulation and loads in the vera proj file | |
6405 | or the ntb libtb.so file. defaults to on. | |
6406 | ||
6407 | ||
6408 | =head2 VERILOG RUNTIME RELATED | |
6409 | ||
6410 | ||
6411 | =head2 NCSIM (CADENCE's NC-VERILOG) RELATED | |
6412 | ||
6413 | -ncv_run/-noncv_run | |
6414 | runs the NC-Verilog simulation (ncsim). defaults to off. | |
6415 | ||
6416 | -ncv_run_args=OPTION | |
6417 | ncsim runtime options. multiple options can be specified | |
6418 | using multiple such arguments. | |
6419 | ||
6420 | -rerun | |
6421 | rerun the simulation from an existing regression run directory. | |
6422 | you can just say "% sims -rerun", and sims will automatically | |
6423 | extract the required arguments. | |
6424 | ||
6425 | -overwrite | |
6426 | overwrite current run dir when doing a -rerun. default is to | |
6427 | create a rerun_<n> subdir for reruns. | |
6428 | ||
6429 | -debussy/-nodebussy | |
6430 | enable debussy dump. this must be implemented in the testbench | |
6431 | to work properly. defaults to off. | |
6432 | ||
6433 | =head2 SIMV (SYNOPSYS's VCS) RELATED | |
6434 | ||
6435 | ||
6436 | -vcs_run/-novcs_run | |
6437 | runs the VCS simulation (simv). defaults to off. | |
6438 | ||
6439 | -vcs_run_args=OPTION | |
6440 | simv runtime options. multiple options can be specified | |
6441 | using multiple such arguments. | |
6442 | ||
6443 | -vcs_finish=TIMESTAMP | |
6444 | forces vcs to finish and exit at the specified timestamp. | |
6445 | ||
6446 | -fast_boot/-nofast_boot | |
6447 | speeds up booting when using the ciop model. this passes the | |
6448 | +fast_boot switch to the simv run and the -sas_run_args=-DFAST_BOOT | |
6449 | and -midas_args=-DFAST_BOOT to sas and midas. Also sends | |
6450 | -DFAST_BOOT to the diaglist and config file preprocessors. | |
6451 | ||
6452 | -debussy/-nodebussy | |
6453 | enable debussy dump. this must be implemented in the testbench | |
6454 | to work properly. defaults to off. | |
6455 | ||
6456 | -start_dump=START | |
6457 | start dumping out a waveform after START number of units | |
6458 | ||
6459 | -stop_dump=STOP | |
6460 | stop dumping out a waveform after STOP number of units | |
6461 | ||
6462 | -fsdb2vcd | |
6463 | runs fsdb2vcd after the simulation has completed to generate a vcd file. | |
6464 | ||
6465 | -fsdbfile=filename | |
6466 | the name of the debussy dump file. | |
6467 | If the file name starts with a "/", that is the file dumped to, | |
6468 | otherwise, the actual file is created within the temporary cache | |
6469 | directory and copied over to the run directory when the simulation ends. | |
6470 | Use "-fsdbfile=`pwd`/filename" to force the file to be | |
6471 | written in the current directory directly (not efficient since | |
6472 | dumping is done over network instead of to a local disk). | |
6473 | ||
6474 | -fsdbDumplimit=SIZE_IN_MB | |
6475 | max size of Debussy dump file. minimum value is 32MB. | |
6476 | Latest values of signal values making up that size is saved. | |
6477 | ||
6478 | -fsdb_glitch | |
6479 | turn on glitch and sequence dumping in fsdb file. this will collect | |
6480 | glitches and sequence of events within time in the fsdb waveform. | |
6481 | beware that this will cause the fsdb file size to grow significantly. | |
6482 | this is turned off by default. this option effectively does this: | |
6483 | setenv FSDB_ENV_DUMP_SEQ_NUM 1 | |
6484 | setenv FSDB_ENV_MAX_GLITCH_NUM 0 | |
6485 | ||
6486 | -rerun | |
6487 | rerun the simulation from an existing regression run directory. | |
6488 | you can just say "% sims -rerun", and sims will automatically | |
6489 | extract the required arguments. | |
6490 | ||
6491 | -overwrite | |
6492 | overwrite current run dir when doing a -rerun. default is to | |
6493 | create a rerun_<n> subdir for reruns. | |
6494 | ||
6495 | -post_process_cmd=COMMAND | |
6496 | post processing command to be run after simv / ncsim ends | |
6497 | ||
6498 | -pre_process_cmd=COMMAND | |
6499 | pre processing command to be run before simv / ncsim starts | |
6500 | ||
6501 | -use_denalirc=FILE | |
6502 | use FILE as the .denalirc in the run area. Default copies | |
6503 | $env_base/.denalirc | |
6504 | ||
6505 | -vcd/-novcd | |
6506 | signals the bench to dump in VCD format | |
6507 | ||
6508 | -vcdfile=filename | |
6509 | the name of the vcd dump file. if the file name starts with | |
6510 | a "/", that is the file dumped to, otherwise, the actual file is | |
6511 | created within the temporary cache directory and copied over to | |
6512 | the run directory when the simulation ends. use "-vcdfile=`pwd`/filename" | |
6513 | to force the file to be written in the current directory directly | |
6514 | (not efficient since dumping is done over network instead of to | |
6515 | a local disk). | |
6516 | ||
6517 | =head2 SUNV OPTIONS | |
6518 | ||
6519 | -sunv_run/-nosunv_run | |
6520 | runs the sunv program to convert structural files, | |
6521 | e.g. <file>.sv to verilog. defaults to off. | |
6522 | ||
6523 | -sunv_args=ARGS | |
6524 | sunv options. Multiple options can be specified using | |
6525 | multiple such arguments. In addition, a portion of | |
6526 | these arguments can be provided in a file using the | |
6527 | sunv option -optfile=<file>. | |
6528 | ||
6529 | -sunv_use_nonprim/-nosunv_use_nonprim | |
6530 | use a list to hold primitives that we want to remove from the | |
6531 | default primitive.list. defaults to off. | |
6532 | ||
6533 | -sunv_nonprim_list=FILE | |
6534 | name of file holding the list of primitives that we want to remove. | |
6535 | this is only used if -sunv_use_nonprim is specified. | |
6536 | ||
6537 | =head2 VLINT OPTIONS | |
6538 | ||
6539 | -vlint_run/-novlint_run | |
6540 | runs the vlint program. defaults to off. | |
6541 | ||
6542 | -vlint_args | |
6543 | vlint options. The <sysName>.config file can contain | |
6544 | the desired vlint arguments, or they can also be given on | |
6545 | the command line. Typically the -vlint_compile is given | |
6546 | on the command line. | |
6547 | ||
6548 | vlint also requires identification of a rules deck. | |
6549 | ||
6550 | -illust_run | |
6551 | run illust after x2e | |
6552 | ||
6553 | -illust_args | |
6554 | illust options | |
6555 | ||
6556 | -vlint_top | |
6557 | top level module on which to run vlint | |
6558 | ||
6559 | =head2 VERIX OPTIONS | |
6560 | ||
6561 | -verix_run/-noverix_run | |
6562 | runs the verix program. defaults to off. | |
6563 | ||
6564 | -verix_libs | |
6565 | specify the library files to add to the vlist | |
6566 | ||
6567 | -verix_args | |
6568 | verix template options. The <sysName>.config file can contain | |
6569 | these desired verix arguments | |
6570 | ||
6571 | verix also requires <top>.verix.tmplt in the config dir. | |
6572 | ||
6573 | -verix_top | |
6574 | top level module on which to run verix | |
6575 | ||
6576 | ||
6577 | =head2 THARAS HAMMER RELATED | |
6578 | ||
6579 | -hcs_build | |
6580 | build a model to be run on the Hammer Hardware Accelerator. | |
6581 | ||
6582 | -hcs_build_args | |
6583 | build arguments for Hammer Hardware Accelerator | |
6584 | ||
6585 | -hcs_run | |
6586 | run a model on the Hammer Hardware Accelerator. | |
6587 | ||
6588 | -hcs_run_args | |
6589 | run arguments for the Hammer Hardware Accelerator. | |
6590 | ||
6591 | -hcs_drm_tokens | |
6592 | tokens for drmsubmit licenses | |
6593 | ||
6594 | =head2 AXIS RELATED | |
6595 | ||
6596 | -axis_build | |
6597 | build a model to be run on the Axis Hardware Accelerator. | |
6598 | ||
6599 | -axis_build_args | |
6600 | build arguments for Axis Hardware Accelerator | |
6601 | ||
6602 | -axis_run | |
6603 | run a model on the Axis Hardware Accelerator. | |
6604 | ||
6605 | -axis_run_args | |
6606 | run arguments for the Axis Hardware Accelerator. | |
6607 | ||
6608 | =head2 PALLADIUM RELATED | |
6609 | ||
6610 | -palladium_build | |
6611 | build a model to be run on the palladium Hardware Accelerator. | |
6612 | ||
6613 | -palladium_build_args | |
6614 | build arguments for palladium Hardware Accelerator | |
6615 | ||
6616 | -palladium_run | |
6617 | run a model on the palladium Hardware Accelerator. | |
6618 | ||
6619 | -palladium_run_args | |
6620 | run arguments for the palladium Hardware Accelerator. | |
6621 | ||
6622 | ||
6623 | =head2 ZEROIN RELATED | |
6624 | ||
6625 | -zeroIn_checklist | |
6626 | run 0in checklist | |
6627 | ||
6628 | -zeroIn_build | |
6629 | build 0In pli for simulation into ncverilog/vcs model | |
6630 | ||
6631 | -zeroInSearch_build | |
6632 | build 0in search pli for simulation into ncverilog/vcs model | |
6633 | ||
6634 | -zeroIn_build_args | |
6635 | additional arguments to be passed to the 0in command | |
6636 | ||
6637 | -zeroIn_dbg_args | |
6638 | additional debug arguments to be passed to the 0in shell | |
6639 | ||
6640 | =head2 SAS/SIMICS RELATED | |
6641 | ||
6642 | -sas/-nosas | |
6643 | run architecture-simulator. If vcs_run/ncv_run option is OFF, | |
6644 | simulation is sas-only. If vcs_run/ncv_run option is ON, sas | |
6645 | runs in lock-step with rtl. default to off. | |
6646 | ||
6647 | -sas_run_args=DARGS | |
6648 | Define arguments for sas. | |
6649 | ||
6650 | =head2 TCL/TAP RELATED | |
6651 | ||
6652 | -tcl_tap/-notcl_tap | |
6653 | run tcl/expect TAP program. If vcs_run option is OFF, | |
6654 | simulation is tcl-only. If vcs_run/ncv_run option is ON, tcl | |
6655 | runs in lock-step with rtl. default to off. | |
6656 | NOTE: You _must_ compile with -tcl_tap as well, to enable | |
6657 | to enable functions that are needed for running with tcl | |
6658 | ||
6659 | -tcl_tap_diag=diagname | |
6660 | Define top level tcl/expect diag name. | |
6661 | ||
6662 | =head2 MIDAS | |
6663 | ||
6664 | midas is the diag assembler | |
6665 | ||
6666 | -midas_args=DARGS | |
6667 | arguments for midas. midas creates memory image and user-event | |
6668 | files from the assembly diag. | |
6669 | ||
6670 | -midas_only | |
6671 | Compile the diag using midas and exit without running it. | |
6672 | ||
6673 | -midas_use_tgseed | |
6674 | Add -DTG_SEED=tg_seed to midas command line. Use -tg_seed to | |
6675 | set the value passed to midas or use a random value from /dev/random. | |
6676 | ||
6677 | =head2 PCI | |
6678 | ||
6679 | pci is the tomatillo pci bus functional model | |
6680 | ||
6681 | -pci_args | |
6682 | arguments to be passed in to pci_cmdgen.pl for generation of a pci | |
6683 | random diagnostic. | |
6684 | ||
6685 | -pci/-nopci | |
6686 | generates a random pci diagnostic using the -tg_seed if provided. | |
6687 | default is off. | |
6688 | ||
6689 | -tomatillo | |
6690 | generates a random tomatillo diagnostic using the -tg_seed if provided | |
6691 | ||
6692 | -tg_seed | |
6693 | random generator seed for pci/tomatillo random test generators | |
6694 | also the value passed to +initreg+ to randomly initialize registers | |
6695 | when -vcs_use_initreg is used. | |
6696 | ||
6697 | =head2 SJM | |
6698 | ||
6699 | sjm is the jalapeno jbus bus functional model | |
6700 | ||
6701 | -sjm_args | |
6702 | arguments to be passed in to sjm_tstgen.pl for generation of an sjm | |
6703 | random diagnostic. | |
6704 | ||
6705 | -sjm/-nosjm | |
6706 | generates a random sjm diagnostic using the -tg_seed if provided. | |
6707 | default is off. | |
6708 | ||
6709 | -tomatillo | |
6710 | generates a random tomatillo diagnostic using the -tg_seed if provided | |
6711 | ||
6712 | -tg_seed | |
6713 | random generator seed for sjm/tomatillo random test generators | |
6714 | also the value passed to +initreg+ to randomly initialize registers | |
6715 | when -vcs_use_initreg is used. | |
6716 | ||
6717 | =head2 EFCGEN | |
6718 | ||
6719 | efcgen.pl is a script to generate efuse.img files (default random), | |
6720 | which is used by the efuse controller after reset. | |
6721 | It is invoked by -efc. | |
6722 | ||
6723 | -efc/-noefc | |
6724 | generates an efuse image file using the -tg_seed if provided. | |
6725 | default is off. Random if no -efc_args specified. | |
6726 | ||
6727 | -efc_args | |
6728 | arguments to be passed in to efcgen.pl for generation of | |
6729 | an efuse image file. | |
6730 | Default is random efuse replacement for each block. | |
6731 | ||
6732 | -tg_seed | |
6733 | random generator seed for efcgen.pl script | |
6734 | also the value passed to +initreg+ to randomly initialize | |
6735 | registers when -vcs_use_initreg is used. | |
6736 | ||
6737 | =head2 VCS COVERAGE METRICS | |
6738 | ||
6739 | -vcs_use_cm/-novcs_use_cmd | |
6740 | passes in the -cm switch to vcs at build time and simv at runtime | |
6741 | default to off. | |
6742 | ||
6743 | -vcs_cm_args=ARGS | |
6744 | argument to be given to the -cm switch | |
6745 | ||
6746 | -vcs_cm_cond=ARGS | |
6747 | argument to be given to the -cm_cond switch. | |
6748 | ||
6749 | -vcs_cm_config=ARGS | |
6750 | argument to be given to the -cm_hier switch | |
6751 | ||
6752 | -vcs_cm_fsmcfg=ARGS | |
6753 | argument to be given to the -cm_fsmcfg switch | |
6754 | specifies an FSM coverage configuration file | |
6755 | ||
6756 | -vcs_cm_name=ARGS | |
6757 | argument to be given to the -cm_name switch. defaults to cm_data. | |
6758 | ||
6759 | =head2 DFT | |
6760 | ||
6761 | -dftvert | |
6762 | modifies the sims flow to accomodate dftvert. this skips compiling | |
6763 | the vera testbench and modifies the simv command line at runtime. | |
6764 | ||
6765 | =head2 CDMS | |
6766 | ||
6767 | -cdms_rel_name=CDMSREL | |
6768 | specify the cdms++ release that must be collected for this model. | |
6769 | ||
6770 | -diff_cdms_rel | |
6771 | performs a diff_release of CDMSREL from -cdms_rel_name and | |
6772 | records it in a file called diff_rel.log lcoated in the model | |
6773 | area. This file is copied into each run directory from the | |
6774 | model area at runtime. | |
6775 | ||
6776 | -diff_cdms_curr | |
6777 | uses the current (in localdir) release of CDMSREL for the | |
6778 | diff_release command. Ignored if -cdms_rel_name and -diff_cdms_rel | |
6779 | are not specified. | |
6780 | ||
6781 | =head2 MISC | |
6782 | ||
6783 | -regress | |
6784 | pretend this is a regression and run the job in DRMJOBSCRATCHSPACE | |
6785 | instead of the launch directory. useful with -indrm and | |
6786 | -interactive options and single jobs. automatically added for | |
6787 | regressions. | |
6788 | ||
6789 | -nobuild | |
6790 | this is a master switch to disable all building options. | |
6791 | there is no such thing as -build to enable all build options. | |
6792 | ||
6793 | -diag_pl_args=ARGS | |
6794 | If the assembly diag has a Perl portion at the end, it | |
6795 | is put into diag.pl and is run as a Perl script. | |
6796 | This allows you to give arguments to that Perl script. | |
6797 | The arguments accumulate, if the option is used multiple | |
6798 | times. | |
6799 | ||
6800 | -pal_use_tgseed | |
6801 | Send '-seed=<tg_seed_value> to pal diags. Adds | |
6802 | -pal_diag_args=-seed=tg_seed to midas command line, and | |
6803 | -seed=tg_seed to pal options (vrpal diags). Use -tg_seed to set | |
6804 | the value passed to midas or use a random value from /dev/random. | |
6805 | ||
6806 | -reg_count=COUNT | |
6807 | runs the specified group multiple times in regression mode. this | |
6808 | is useful when we want to run the same diag multiple times using | |
6809 | a different random generator seed each time or some such. | |
6810 | ||
6811 | -regress_id=ID | |
6812 | specify the name of the regression | |
6813 | ||
6814 | -report | |
6815 | This flag is used to produce a report of a an old or running | |
6816 | regression. With -group options, sims produces the report | |
6817 | after the regression run. Report for the previous | |
6818 | regression run can be produced using -regress_id=ID | |
6819 | option along with this option, | |
6820 | ||
6821 | -finish_mask=MASK | |
6822 | masks for ncsim/vcs simulation termination. Simulation terminates | |
6823 | when it hits 'good_trap' or 'bad_trap'. For multithread | |
6824 | simulation, simulation terminates when any of the thread | |
6825 | hits bad_trap, or all the threads specified by the finish_mask | |
6826 | hits the good_trap. | |
6827 | example: -finish_mask=0xe | |
6828 | Simulation will be terminated by good_trap, if thread 1, 2 and | |
6829 | 3 hits the good_trap. | |
6830 | ||
6831 | -stub_mask=MASK | |
6832 | mask for ncsim/vcs simulation termination. Simulation ends when the | |
6833 | stub driving the relevant bit in the mask is asserted. This | |
6834 | is a hexadecimal value similar to -finish_mask | |
6835 | ||
6836 | -wait_cycle_to_kill=VAL | |
6837 | passes a +wait_cycle_to_kill to the simv run. a testbench | |
6838 | may chose to implement this plusarg to delay killing a | |
6839 | simulation by a number of clock cycles to allow collection | |
6840 | of some more data before exiting (e.g. waveform). | |
6841 | ||
6842 | -rtl_timeout | |
6843 | passes a +TIMEOUT to the simv run. | |
6844 | sets the number of clock cycles after all threads have become | |
6845 | inactive for the diag to exit with an error. if all threads hit | |
6846 | good trap on their own the diag exits right away. if any of the | |
6847 | threads is inactive without hitting good trap/bad trap the | |
6848 | rtl_timeout will be reached and the diag fails. default is 1000. | |
6849 | this is only implemented in the cmp based testbenches. | |
6850 | ||
6851 | -max_cycle | |
6852 | passes a +max_cycle to the simv run. | |
6853 | sets the maximum number of clock cycle that the diag will take | |
6854 | to complete. the default is 30000. if max_cycle is hit the diag | |
6855 | exits with a failure. not all testbenches implement this | |
6856 | feature. | |
6857 | ||
6858 | -norun_diag_pl | |
6859 | Does not run diag.pl (if it exists) after ncsim snapshot or VCS simv run. | |
6860 | Use this option if, for some reason, you want to run an | |
6861 | existing assembly diag without the Perl part that is in | |
6862 | the original diag. | |
6863 | ||
6864 | -nosaslog | |
6865 | turns off redirection of sas stdout to the sas.log file. | |
6866 | use this option when doing interactive runs with sas. | |
6867 | ||
6868 | -nosimslog | |
6869 | turns off redirection of stdout and stderr to the sims.log | |
6870 | file. use this option in conjunction with -vcs_use_cli or | |
6871 | -vcs_use_ucli to get to the cli prompt when using vcs or to | |
6872 | see a truncated vcs.log file that exited with an | |
6873 | error. this must be used if you want control-c to work | |
6874 | while vcs is running. | |
6875 | ||
6876 | -nogzip | |
6877 | turns off compression of log files before they are copied over | |
6878 | during regressions. | |
6879 | ||
6880 | -version | |
6881 | print version number. | |
6882 | ||
6883 | -help | |
6884 | prints this | |
6885 | ||
6886 | =head2 IT SYSTEM RELATED | |
6887 | ||
6888 | -use_iver=FILE | |
6889 | full path to iver file for frozen tools | |
6890 | ||
6891 | -use_sims_iver/-nouse_sims_iver | |
6892 | For reruns of regression tests only, use sims.iver to choose | |
6893 | TRE tool versions saved during original regression run. | |
6894 | Defaults to true. | |
6895 | ||
6896 | -use_cdms_iver/-nouse_cdms_iver | |
6897 | Uses the frozen iver file located under $DV_ROOT if present. | |
6898 | This defaults to true. This has no effect if an iver file | |
6899 | is not found under the cdms tree. | |
6900 | ||
6901 | -dv_root=PATH | |
6902 | absolute path to design root directory. this overrides $DV_ROOT. | |
6903 | ||
6904 | -model_dir=PATH | |
6905 | absolute path to model root directory. this overrides $MODEL_DIR. | |
6906 | ||
6907 | -sims_config=FILE | |
6908 | full path to sims config file | |
6909 | ||
6910 | -sims_env=ENVAR=value | |
6911 | force sims to set ENVAR variable to specified value. | |
6912 | ||
6913 | -env_base=PATH | |
6914 | this specifies the root directory for the bench environment. | |
6915 | it is typically defined in the bench config file. It has no | |
6916 | default. | |
6917 | ||
6918 | -config_cpp_args=OPTION | |
6919 | this allows the user to provide CPP arguments (defines/undefines) | |
6920 | that will be used when the testbench configuration file is | |
6921 | processed through cpp. Multiple options are concatenated | |
6922 | together. | |
6923 | ||
6924 | -result_dir=PATH | |
6925 | this allows the regression run to be launched from a different | |
6926 | directory than the one sims was launced from. defaults to | |
6927 | $ENV{PWD}. | |
6928 | ||
6929 | -diaglist=FILE | |
6930 | full path to diaglist file | |
6931 | ||
6932 | -diaglist_cpp_args=OPTION | |
6933 | this allows the user to provide CPP arguments (defines/undefines) | |
6934 | that will be used when the diaglist file is processed through | |
6935 | cpp. Multiple options are concatenated together. | |
6936 | ||
6937 | -asm_diag_name=NAME | |
6938 | -tpt_diag_name=NAME | |
6939 | -tap_diag_name=NAME | |
6940 | -vera_diag_name=NAME | |
6941 | -vera_config_name=NAME | |
6942 | -efuse_image_name=NAME | |
6943 | -image_diag_name=NAME | |
6944 | -sjm_diag_name=NAME | |
6945 | -pci_diag_name=NAME | |
6946 | name of the diagnostic to be run. | |
6947 | ||
6948 | -asm_diag_root=PATH | |
6949 | -tpt_diag_root=PATH | |
6950 | -tap_diag_root=PATH | |
6951 | -vera_diag_root=PATH | |
6952 | -vera_config_root=PATH | |
6953 | -efuse_image_root=PATH | |
6954 | -image_diag_root=PATH | |
6955 | -sjm_diag_root=PATH | |
6956 | -pci_diag_root=PATH | |
6957 | absolute path to diag root directory. sims will perform a find | |
6958 | from here to find the specified type of diag. if more than one | |
6959 | instance of the diag name is found under root sims exits with | |
6960 | an error. this option can be specified multiple times to allow | |
6961 | multiple roots to be searched for the diag. | |
6962 | ||
6963 | -asm_diag_path=PATH | |
6964 | -tpt_diag_path=PATH | |
6965 | -tap_diag_path=PATH | |
6966 | -vera_diag_path=PATH | |
6967 | -vera_config_path=PATH | |
6968 | -efuse_image_path=PATH | |
6969 | -image_diag_path=PATH | |
6970 | -sjm_diag_path=PATH | |
6971 | -pci_diag_path=PATH | |
6972 | absolute path to diag directory. sims expects the specified | |
6973 | diag to be in this directory. the last value of this option | |
6974 | is the one used as the path. | |
6975 | ||
6976 | =head2 ClearCase | |
6977 | ||
6978 | -clearcase | |
6979 | assume we are in ClearCase environment for setting DV_ROOT and | |
6980 | launching DReAM commands. default is off (CDMS++ version control) | |
6981 | ||
6982 | -noclearcase | |
6983 | force clearcase option off | |
6984 | ||
6985 | -cc_dv_root=PATH | |
6986 | ClearCase path to design root directory. this overrides $CC_DV_ROOT. | |
6987 | ||
6988 | =head2 DReAM | |
6989 | ||
6990 | Please refer to the drmsubmit man pages for more info on the following. | |
6991 | ||
6992 | -indrm | |
6993 | resubmits any sims command to DReAM. | |
6994 | ||
6995 | -noindrm | |
6996 | this is used in conjunction with -group to prevent a regression from | |
6997 | being submitted to DReAM. this will effectively run each job serially | |
6998 | on the local machine where the job was launched. | |
6999 | e.g. sims -group=ciop_regr -noindrm | |
7000 | ||
7001 | -interactive | |
7002 | resubmits any sims command to DReAM and runs it as an interactive session. | |
7003 | this effectively adds -i -m to the drmsubmit command. | |
7004 | ||
7005 | -drm_type=ARG | |
7006 | the type constraint for DReAM jobs. This constraint determines | |
7007 | the queue where a job will be submitted. | |
7008 | ||
7009 | -drm_constraints_file=FILE | |
7010 | the file specifying constraints for DReAM jobs. If this option | |
7011 | is specified, other -drm_* options are ignored. | |
7012 | ||
7013 | -drm_cpufreq=ARG | |
7014 | the cpufreq constraint for DReAM jobs. | |
7015 | ||
7016 | -drm_disk=ARG | |
7017 | the disk constraint for DReAM jobs. | |
7018 | ||
7019 | -drm_freeram=ARG | |
7020 | the freeram constraint for DReAM jobs. | |
7021 | ||
7022 | -drm_freeswap=ARG | |
7023 | the freeswap constraint for DReAM jobs. | |
7024 | ||
7025 | -drm_freeprocessor=ARG | |
7026 | the free processor constraint for DReAM jobs. | |
7027 | ||
7028 | -drm_totprocessor=ARG | |
7029 | the totprocessor constraint for DReAM jobs. | |
7030 | ||
7031 | -drm_priority=ARG | |
7032 | the priority constraint for DReAM jobs. | |
7033 | ||
7034 | -drm_license=ARG | |
7035 | the license constraint for DReAM jobs. this defaults to [vcs=1,vera=1]. | |
7036 | ||
7037 | =head2 ENV VARIABLES | |
7038 | ||
7039 | sims sets the following ENV variables that may be used with pre/post | |
7040 | processing scripts, and other internal tools: | |
7041 | ||
7042 | ASM_DIAG_NAME : Contains the assembly diag name. | |
7043 | SIMS_LAUNCH_DIR : Path to launch directory where sims is running the | |
7044 | job. Useful when job is run in dream scratch space. | |
7045 | VERA_LIBDIR : Dir where Vera/NTB files are compiled or results are stored. | |
7046 | DV_ROOT : -dv_root if specifed | |
7047 | MODEL_DIR : -model_dir if specified | |
7048 | TRE_SEARCH : Based on -use_iver, -use_cdms_iver -use_sims_iver | |
7049 | DENALI : Based on configsrch | |
7050 | NCV_HOME : Based on configsrch | |
7051 | CDS_INST_DIR : Based on configsrch | |
7052 | ||
7053 | =head2 PLUSARGS | |
7054 | ||
7055 | +args are not implemented in sims. they are passed directly to ncverilog / vcs at | |
7056 | compile time and the simulation snapshot (or executable) called | |
7057 | inca*pak / simv at runtime. the plusargs listed here are for | |
7058 | reference purposes only. | |
7059 | ||
7060 | +STACK_DIMM 32 bits physical address space - default is 31 bits | |
7061 | ||
7062 | +STACK_DIMM +RANK_DIMM 33 bits physical address space - default is 31 bits | |
7063 | ||
7064 | +max_cycle see -max_cycle | |
7065 | ||
7066 | +TIMEOUT see -rtl_timeout | |
7067 | ||
7068 | +vcs+finish see -vcs_finish | |
7069 | ||
7070 | +wait_cycle_to_kill see -wait_cycle_to_kill | |
7071 | ||
7072 | =head1 DESCRIPTION | |
7073 | ||
7074 | sims is the frontend for Synopsys' VCS and Cadence's NC-Verilog to run single simulations and also regressions | |
7075 | ||
7076 | =head1 HOWTO | |
7077 | ||
7078 | =head2 Build models | |
7079 | ||
7080 | Build a model using $DV_ROOT as design root | |
7081 | ||
7082 | % sims -sys=cmp1 -vcs_build -vera_build // use Synopsys' VCS simulator | |
7083 | % sims -sys=cmp1 -ncv_build -vera_build // use Cadence's NC-Verilog simulator (ncvlog+ncelab+ncsim) | |
7084 | % sims -sys=cmp8 -vcs_build -vera_build | |
7085 | % sims -sys=fc1 -vcs_build -vera_build | |
7086 | % sims -sys=fc8 -vcs_build -vera_build | |
7087 | ||
7088 | ||
7089 | [ Here, cmp1 means compiling 1 sparc core only, crossbar and Level 2 cache RTL. | |
7090 | cmp8 means compiling 8 sparc cores, crossbar and Level 2 cache RTL. | |
7091 | fc1 means compiling 1 sparc core only, crossbar, Level 2 cache RTL, memory controller unit RTL, as well as all of the system-on-chip components that goes on the chip | |
7092 | fc8 means compiling 8 sparc cores, crossbar, Level 2 cache RTL, memory controller unit RTL, as well as all of the system-on-chip components that goes on the chip | |
7093 | *** fc8 is essentially the entire Niagara-2 chip. | |
7094 | ] | |
7095 | ||
7096 | ||
7097 | Build a model from any design root | |
7098 | ||
7099 | % sims -sys=cmp1 -vcs_build -dv_root=/home/username/cdmspp_localdir1 | |
7100 | ||
7101 | Build a model and re-build the vera | |
7102 | ||
7103 | % sims -sys=cmp1 -vcs_build -vera_clean -vera_build | |
7104 | ||
7105 | Build a model and turn off incremental compile, i.e. re-build the vcs binary | |
7106 | ||
7107 | % sims -sys=cmp1 -vcs_build -vcs_clean | |
7108 | ||
7109 | Build a model with a given name | |
7110 | ||
7111 | % sims -sys=cmp1 -vcs_build -model_rel_name=vcs_binary_no_1 | |
7112 | ||
7113 | =head2 Run models | |
7114 | ||
7115 | Run a diag with a specified model | |
7116 | ||
7117 | % sims -sys=cmp1 -model_rel_name=vcs_binary_no_1 -vcs_run diag.s | |
7118 | ||
7119 | Run a diag with debussy dump ON with default model (dump certain scopes only, | |
7120 | the scope definitions are defined inside the file :/verif/env/cmp/dump_scope.vh ) | |
7121 | ||
7122 | % sims -sys=cmp1 -debussy -vcs_run diag.s -model_rel_name=vcs_binary_no_1 \ | |
7123 | -vcs_run_args=+DUMP_LIMIT \ | |
7124 | -vcs_run_args=+DUMP_ENV -vcs_run_args=+DUMP_MCU \ | |
7125 | -vcs_run_args=+DUMP_L2_0 -vcs_run_args=+DUMP_L2_1 | |
7126 | ||
7127 | ||
7128 | =head2 Run regressions | |
7129 | ||
7130 | Run a regression using $DV_ROOT as design root | |
7131 | ||
7132 | % sims -sys=cmp1 -group=cmp1_all_T2 // using a VCS binary | |
7133 | % sims -sys=cmp1 -group=cmp1_all_T2 -sim=ncv // using a NC-Verilog snapshot | |
7134 | ||
7135 | Some other examples, e.g. at the fullchip level | |
7136 | % sims -sys=fc1 -group=fc1_all_T2 | |
7137 | % sims -sys=fc8 -group=fc8_all_T2 | |
7138 | ||
7139 | Run a regression using $DV_ROOT as design root and specify the diaglist | |
7140 | ||
7141 | % sims -sys=cmp1 -group=cmp1_mini_T2 -diaglist=/home/username/cdmspp_localdir/dialist | |
7142 | ||
7143 | Run a regression using any design root | |
7144 | ||
7145 | % sims -sys=cmp1 -group=cmp1_mini_T2 -dv_root=/home/username/cdmspp_localdir | |
7146 | ||
7147 | Run a regression using any design root and a graft model | |
7148 | ||
7149 | % sims -sys=cmp1 -group=cmp1_mini_T2 -dv_root=/home/username/cdmspp_localdir \ | |
7150 | -graft_flist=/home/regress/graftfile | |
7151 | ||
7152 | Rerun a diag in a regression (results will be put inside a new rerun_<N> subdir) | |
7153 | Command to be issued from inside the original run directory | |
7154 | ||
7155 | % sims -rerun | |
7156 | ||
7157 | Rerun a diag, overwriting the original run directory | |
7158 | ||
7159 | % sims -rerun -overwrite | |
7160 | ||
7161 | ||
7162 | ||
7163 | =head1 Example Makefile showing NTB usage | |
7164 | ||
7165 | ################################################################################ | |
7166 | ## Description: | |
7167 | ## ----------- | |
7168 | ## Top level Makefile for compiling Vera/NTB environment. | |
7169 | ## runs with "gmake" only, not with "make". | |
7170 | ## | |
7171 | ## See sims help for standard Makefile example | |
7172 | ## | |
7173 | ################################################################################ | |
7174 | ||
7175 | # To do a quick NTB compile after source changes, do this. It is faster than running sims. | |
7176 | # gmake VERA_SYS_DEFS="-DSPC_BENCH" NTB_DIAG=wherever/diag.vr ntb_diag | |
7177 | # If you are using these provided defines below (USE_NTB_ALL or USE_NTB_LIB) | |
7178 | # then add USE_NTB_LIB=1, etc, to gmake call. | |
7179 | # | |
7180 | ||
7181 | # what does sims pass in to gmake? | |
7182 | # If using the two pass libtb.so method: | |
7183 | # 1) If you use this in your config file, -vera_build_args=VERA_SYS_DEFS="-DSPC_BENCH" | |
7184 | # then gmake passes VERA_SYS_DEFS="-DSPC_BENCH" | |
7185 | # 2) Path to "diag" or a dummy diag. NTB_DIAG=/import/n3-aus-dump1/jp148204/wrk1/r1/diag.vr | |
7186 | # 3) Sets this define, USE_NTB_LIB=1 | |
7187 | # 4) ntb_diag as the 'target' | |
7188 | # 5) Your vera program block must be called vera_top!!! | |
7189 | # | |
7190 | # If using the all-in-one compile method: | |
7191 | # 1) If you use this in your config file, -vera_build_args=VERA_SYS_DEFS="-DSPC_BENCH" | |
7192 | # then gmake passes VERA_SYS_DEFS="-DSPC_BENCH" | |
7193 | # 2) Sets this define, USE_NTB_ALL=1 | |
7194 | # 3) ntb_all as the 'target' | |
7195 | # 4) Your vera program block should be called vera_top | |
7196 | ||
7197 | # To enable RVM, use -vera_build_args=USE_RVM=1 in your config file. | |
7198 | # This Makefile does not support non-NTB + RVM. | |
7199 | ||
7200 | ||
7201 | ################################################################################ | |
7202 | # variable declarations | |
7203 | ################################################################################ | |
7204 | ||
7205 | .SUFFIXES: | |
7206 | ||
7207 | ||
7208 | # CHANGE THIS LINE vvvvv <------------------ | |
7209 | SYS_NAME ?= sparc | |
7210 | # CHANGE THIS LINE ^^^^^ <------------------ | |
7211 | ||
7212 | ||
7213 | ||
7214 | ECHO := echo | |
7215 | COPY_CMD = cp -pf $< $@ | |
7216 | SPACE := $(EMPTY) $(EMPTY) | |
7217 | # sims over-rides this. Do not remove. | |
7218 | VERA_LIBDIR ?= ${PWD}/lib | |
7219 | # NOT for users to use, ONLY CONFIG FILE and sims. Do not remove. | |
7220 | VERA_SYS_DEFS ?= | |
7221 | NTB_BUILD_ARGS ?= | |
7222 | NTB_DIAG_ARGS ?= | |
7223 | # NOT for users to use, ONLY SIMS. For special 2 pass vcs options. Do not remove. | |
7224 | VCS_USE_CLI ?= | |
7225 | VCS_USE_VCSD ?= | |
7226 | ||
7227 | ||
7228 | # These 3 defines are for any user to use and over-ride at will. | |
7229 | # Example: | |
7230 | # -vera_build_args="VERA_DEFS2=-DMYDEFINE -DTHIS" for either NTB or vera. | |
7231 | # -vera_build_args="VERA_DEFS2=-ntb_define THIS THAT" will work if NTB ONLY. | |
7232 | VERA_DEFS ?= | |
7233 | VERA_DEFS2 ?= | |
7234 | # User options that need to be applied when making libtb.so file AND the simv file. | |
7235 | TWOPASS_OPTION ?= | |
7236 | ||
7237 | ||
7238 | # other compile options that users could possibly over-ride, CAREFULLY. | |
7239 | # NTB_OPTS | |
7240 | # VERA_DEBUG | |
7241 | # DEBUG | |
7242 | ||
7243 | # Use -vera_build_args=VERA_DEBUG=1 | |
7244 | ifdef USE_VERA_DEBUG | |
7245 | VERA_DEBUG ?= -g | |
7246 | endif | |
7247 | ||
7248 | # use -vera_build_args=TEST=1 | |
7249 | ifdef TEST | |
7250 | TESTING := test | |
7251 | else | |
7252 | TESTING := | |
7253 | endif | |
7254 | ||
7255 | ||
7256 | ############################################# | |
7257 | # PATHS & FILES SPECIFIC TO YOUR BENCH # | |
7258 | # These are places where files can be found # | |
7259 | ############################################# | |
7260 | BENCH_DIR := ${DV_ROOT}/verif/env/$(SYS_NAME)/vera | |
7261 | COMMON_VERA := ${DV_ROOT}/verif/env/common/vera | |
7262 | COMMON_VERILOG := ${DV_ROOT}/verif/env/common/verilog | |
7263 | COMMON_RTL := ${DV_ROOT}/design/sys/cpu_common | |
7264 | ||
7265 | # VPATH holds all paths to all include files. Do not change VPATH name or delete it!!! | |
7266 | # This path is searched by gmake/vera/vcs, IN ORDER, until include file is found. | |
7267 | # !!! KEEP UP TO DATE !!! | |
7268 | ||
7269 | VPATH := $(BENCH_DIR) $(BENCH_DIR)/interfaces $(BENCH_DIR)/include \ | |
7270 | $(BENCH_DIR)/classes $(COMMON_VERA)/include $(COMMON_VERA)/classes $(COMMON_VERA) $(COMMON_RTL)/include | |
7271 | ||
7272 | # All files that we want to *compile*. | |
7273 | # Files will be processed IN THIS ORDER. Put base classes first, etc. | |
7274 | # If Vera, will get fresh .vro files made from these files if the .vr has changed | |
7275 | # or any vrh/vri has changed. If NTB, all will be compiled but only if needed. | |
7276 | # | |
7277 | # NTB needs a list with FULL PATH, so ALWAYS use FULL PATH! | |
7278 | ORDERD_SRC_LIST := \ | |
7279 | $(COMMON_VERA)/classes/std_display_class.vr \ | |
7280 | $(COMMON_VERA)/classes/baseParamsClass.vr \ | |
7281 | $(COMMON_VERA)/classes/sparcParams.vr \ | |
7282 | $(COMMON_VERA)/classes/memArray.vr \ | |
7283 | $(COMMON_VERA)/classes/l1tag.vr \ | |
7284 | $(COMMON_VERA)/classes/baseUtilsClass.vr \ | |
7285 | $(COMMON_VERA)/ccxDevices/ccxDevBaseBFM.vr \ | |
7286 | $(COMMON_VERA)/ccxDevices/ccxDevMemBFM.vr \ | |
7287 | $(COMMON_VERA)/classes/sparcBenchUtils.vr \ | |
7288 | $(BENCH_DIR)/classes/utilsClass.vr \ | |
7289 | $(BENCH_DIR)/classes/sparcEnv.vr \ | |
7290 | $(COMMON_VERA)/ccxDevices/basePktClass.vr \ | |
7291 | $(COMMON_VERA)/ccxDevices/cpxPktClass.vr \ | |
7292 | $(COMMON_VERA)/ccxDevices/pcxPktClass.vr \ | |
7293 | $(COMMON_VERA)/ccxDevices/ccxPktMon.vr | |
7294 | ||
7295 | # The bench_top.vr file and the vera/NTB diag... | |
7296 | ||
7297 | # default bench top for vera/ntb | |
7298 | BENCH_TOP = $(BENCH_DIR)/spc2_top.vr | |
7299 | ||
7300 | # If using NTB all-in-one compile method (no vera diags), the top is straightforward. | |
7301 | # NTB_DIAG will not be defined. | |
7302 | ifdef USE_NTB_ALL | |
7303 | BENCH_TOP = $(BENCH_DIR)/sparc_top.vr | |
7304 | endif | |
7305 | ||
7306 | # If using ntb_lib (libtb.so) method, there may be a diag and the diag | |
7307 | # and top may be the same (common with RVM method). This is up to the developer. | |
7308 | ifdef USE_NTB_LIB | |
7309 | # If your diag is a class or task definition then you will have a permanent top | |
7310 | # and a potential diag so use the next 2 lines. | |
7311 | # BENCH_TOP += $(BENCH_DIR)/sparc_top.vr | |
7312 | # ORDERD_SRC_LIST += $(NTB_DIAG) | |
7313 | # Otherwise, if your diag is *also* the bench top (common with RVM method), | |
7314 | # then BENCH_TOP and NTB_DIAG are the same. We will use the passed in NTB_DIAG | |
7315 | # as the BENCH_TOP. | |
7316 | BENCH_TOP += $(NTB_DIAG) | |
7317 | endif | |
7318 | ||
7319 | ORDERD_SRC_LIST += $(BENCH_TOP) | |
7320 | ||
7321 | ############################## | |
7322 | ### NTB ONLY ### | |
7323 | ############################## | |
7324 | # make an include path list so files can be found. | |
7325 | NTB_INCDIR := $(subst $(SPACE),"+",$(VPATH)) | |
7326 | ||
7327 | # -ntb_opts are compile time opts | |
7328 | NTB_OPTS ?= -ntb_opts check+dep_check+tb_timescale=1ps/1ps+partsel+compat | |
7329 | ifdef USE_RVM | |
7330 | NTB_OPTS += +rvm | |
7331 | endif | |
7332 | # nullcheck for debug but is SLOW | |
7333 | ||
7334 | # If defines come in as -DTHIS then make them NTB style | |
7335 | NTB_DEFS := $(subst -D,-ntb_define$(SPACE),$(VERA_DEFS)) | |
7336 | NTB_DEFS += $(subst -D,-ntb_define$(SPACE),$(VERA_DEFS2)) | |
7337 | NTB_DEFS += $(subst -D,-ntb_define$(SPACE),$(VERA_SYS_DEFS)) | |
7338 | ||
7339 | # applies to the libtb.so compile AND the all-in-one compile. | |
7340 | NTB_COMMON := -ntb_define NTB $(NTB_DEFS) \ | |
7341 | -ntb_filext .vr+.vrh+.vri+.vrl+.vh+ $(NTB_OPTS) -ntb_incdir $(NTB_INCDIR) \ | |
7342 | +define+NTB $(NTB_BUILD_ARGS) $(ORDERD_SRC_LIST) | |
7343 | ||
7344 | # How to compile VCS for lib file use. This will create a $(VERA_LIBDIR)/ntb_flist | |
7345 | # file that sims uses directly when doing the VCS build (using the vshell). | |
7346 | NTB_LIB_FLIST := -ntb_vl $(TWOPASS_OPTION) $(VCS_USE_CLI) $(VCS_USE_VCSD) \ | |
7347 | +define+NTB +define+NTB_LIB $(VERA_LIBDIR)/${SYS_NAME}_top_shell.v | |
7348 | ||
7349 | # command to do the libtb.so file compile and to do the vshell compile. | |
7350 | NTB_LIB_COMPILE := vcs -ntb_cmp $(TWOPASS_OPTION) $(VCS_USE_CLI) $(VCS_USE_VCSD) \ | |
7351 | -ntb_sfname ${SYS_NAME}_top_shell.v -ntb_sname vera_top -ntb_spath $(VERA_LIBDIR) \ | |
7352 | +error+5 -ntb_define NTB_LIB $(NTB_COMMON) | |
7353 | ||
7354 | # How to compile NTB and VCS together at once (all-in-one method). | |
7355 | # This will create a $(VERA_LIBDIR)/ntb_flist file that sims | |
7356 | # uses directly when doing the VCS build. | |
7357 | NTB_ALL_FLIST := -ntb $(NTB_COMMON) +define+NTB_ALL | |
7358 | ||
7359 | ||
7360 | ############################## | |
7361 | ### VERA & NTB ### | |
7362 | ############################## | |
7363 | DEPENDENCIES := $(foreach dir,$(VPATH),$(wildcard $(dir)/*.vr?)) | |
7364 | ||
7365 | ||
7366 | ############################## | |
7367 | ### VERA ONLY ### | |
7368 | ############################## | |
7369 | # all .vr files without full path | |
7370 | ORDERD_LIST := $(notdir $(ORDERD_SRC_LIST)) | |
7371 | # ORDERD_VRH := $(patsubst %.vr,$(VERA_LIBDIR)/%.vrh,$(ORDERD_LIST)) | |
7372 | # targets list. .vro's we want to make. | |
7373 | ORDERD_VRO := $(patsubst %.vr,$(VERA_LIBDIR)/%.vro,$(ORDERD_LIST)) | |
7374 | EMPTY := | |
7375 | VERA_OPTS ?= -max_error 5 -q | |
7376 | VERA_INCDIR := $(subst $(SPACE),$(SPACE)-I,$(VPATH)) | |
7377 | VERA_INCDIR := -I$(VERA_INCDIR) -I$(VERA_LIBDIR) | |
7378 | VERA_VRH := vera -cmp $(VERA_INCDIR) $(VERA_OPTS) -hnu $(VERA_DEFS) $(VERA_DEFS2) $(VERA_DEFS3) $(VERA_SYS_DEFS) $(LOCAL_DEFS) | |
7379 | VERA_VRO := vera -cmp $(VERA_INCDIR) $(VERA_OPTS) $(VERA_DEFS) $(VERA_DEFS2) $(VERA_DEFS3) $(VERA_SYS_DEFS) $(LOCAL_DEFS) $(VERA_DEBUG) | |
7380 | ||
7381 | ||
7382 | ||
7383 | ################################################################################ | |
7384 | # targets | |
7385 | ################################################################################ | |
7386 | # default target is vera | |
7387 | all: vera | |
7388 | ||
7389 | # Make a flist for VCS to use during simv compile. | |
7390 | # Make the NTB vshell file to use during simv compile if ntb_lib. | |
7391 | # NTB diag is handled later in ntb_diag: | |
7392 | ifdef USE_NTB_LIB | |
7393 | ntb_build: $(TESTING) makedir $(VERA_LIBDIR)/${SYS_NAME}_top_shell.v | |
7394 | @if (test -f $(VERA_LIBDIR)/ntb_flist) then rm -f $(VERA_LIBDIR)/ntb_flist ; fi | |
7395 | @echo $(NTB_LIB_FLIST) > $(VERA_LIBDIR)/ntb_flist | |
7396 | else | |
7397 | # NTB/VCS all-in-one compile. Just make a flist for simv compile. | |
7398 | # This method does NOT allow you to build in unique vera diags. | |
7399 | ntb_build: $(TESTING) makedir | |
7400 | @if (test -f $(VERA_LIBDIR)/ntb_flist) then rm -f $(VERA_LIBDIR)/ntb_flist ; fi | |
7401 | @echo $(NTB_ALL_FLIST) > $(VERA_LIBDIR)/ntb_flist | |
7402 | endif | |
7403 | ||
7404 | clean: | |
7405 | rm -rf $(VERA_LIBDIR)/* ; rm -f $(VERA_LIBDIR)/../${SYS_NAME}_top_shell.v | |
7406 | ||
7407 | # Second pass of the NTB two pass libtb.so compile method. | |
7408 | # This compiles libtb.so in a unique location using a unique (or default/dummy) vera diag. | |
7409 | ntb_diag: $(TESTING) $(VERA_LIBDIR)/libtb.so | |
7410 | ||
7411 | makedir: | |
7412 | @if (test ! -d $(VERA_LIBDIR)) then mkdir -p $(VERA_LIBDIR) ; fi | |
7413 | ||
7414 | test: | |
7415 | @echo "<<Invoke Dir>>" ${PWD} "\n" | |
7416 | @echo "<<BENCH_DIR>>" $(BENCH_DIR) "\n" | |
7417 | @echo "<<DEPENDENCIES>>" $(DEPENDENCIES) "\n" | |
7418 | @echo "<<NTB_INCDIR>>" $(NTB_INCDIR) "\n" | |
7419 | @echo "<<VERA_INCDIR>>" $(VERA_INCDIR) "\n" | |
7420 | @echo "<<ORDERD_VRO>>" $(ORDERD_VRO) "\n" | |
7421 | @echo "<<NTB_BUILD_ARGS>>" $(NTB_BUILD_ARGS) "\n" | |
7422 | @echo "<<NTB_DIAG_ARGS>>" $(NTB_DIAG_ARGS) "\n" | |
7423 | @echo "<<VERA_VRO>>" $(VERA_VRO) "\n" | |
7424 | @echo "<<ORDERD_SRC_LIST>>" $(ORDERD_SRC_LIST) "\n" | |
7425 | @echo "<<NTB_ALL_FLIST>>" $(NTB_ALL_FLIST) "\n" | |
7426 | @echo "<<NTB_LIB_FLIST>>" $(NTB_LIB_FLIST) "\n" | |
7427 | @echo "<<NTB_LIB_COMPILE>>" $(NTB_LIB_COMPILE) "\n" | |
7428 | @echo "<<VERA_LIBDIR>>" $(VERA_LIBDIR) "\n" | |
7429 | @echo "<<NTB_DIAG>>" $(NTB_DIAG) "\n" | |
7430 | ||
7431 | ||
7432 | ################################# | |
7433 | # Original Vera, not NTB, targets | |
7434 | ################################# | |
7435 | ||
7436 | vera: $(TESTING) makedir copy_vera_stuff copy_dep $(ORDERD_VRO) | |
7437 | ||
7438 | # When using vera diags, you must copy any include files/$(DEPENDENCIES) | |
7439 | # that the diag needs into VERA_LIBDIR. | |
7440 | # Be aware, you could possibly get name collisions in $(VERA_LIBDIR) | |
7441 | # which could cause problems. See VPATH | |
7442 | copy_dep: | |
7443 | @cp -fp $(DEPENDENCIES) $(VERA_LIBDIR) | |
7444 | ||
7445 | copy_vera_stuff: | |
7446 | @vera -V | |
7447 | @rm -f $(VERA_LIBDIR)/../$(SYS_NAME)_top_shell.v | |
7448 | @cp -fp include/*vcon* $(VERA_LIBDIR) | |
7449 | ||
7450 | vrh: | |
7451 | @echo "To make a vrh for your class do --> " $(VERA_VRH) "path_to_class" | |
7452 | ||
7453 | ||
7454 | ||
7455 | ################################################################################ | |
7456 | # lowest level rules | |
7457 | ################################################################################ | |
7458 | ||
7459 | # vera vr files: | |
7460 | # About $(DEPENDENCIES)... This is a list of vrh/vri files that are in | |
7461 | # the directories identified by the bench developer. Vera is given | |
7462 | # this list in the form of include paths. Vera will compile with the | |
7463 | # ORIGINAL vrh/vri file, not a copy. You -->MUST<-- use #include <file> | |
7464 | # syntax, not #include "file", if you want Vera's -I to find the right | |
7465 | # include file every time. See VPATH. | |
7466 | # | |
7467 | # This dependency technique is not perfect (there are more explicit | |
7468 | # ways) but what it WILL do is base a Vera compile on whether any Vera | |
7469 | # include/dependency file has changed. If any $(DEPENDENCIES) file has | |
7470 | # changed, a new .vro file will be made for every .vr file. If only a | |
7471 | # single .vr file has changed, a new .vro is made only for that .vr | |
7472 | # file. | |
7473 | $(VERA_LIBDIR)/%.vro: %.vr $(DEPENDENCIES) | |
7474 | @$(ECHO) $(INDENT) ">>>> Vera: compiling $(notdir $<)" | |
7475 | ifeq ($(TESTING), test) | |
7476 | @$(ECHO) $(VERA_VRO) $< $@ | |
7477 | endif | |
7478 | @$(VERA_VRO) $< $@ | |
7479 | ||
7480 | # ntb w/ lib file use, shell file: | |
7481 | # Will rebuild the shell if any DEPENDENCIES file or BENCH_TOP or Makefile has changed. | |
7482 | $(VERA_LIBDIR)/${SYS_NAME}_top_shell.v: $(BENCH_DIR)/Makefile $(DEPENDENCIES) $(ORDERD_SRC_LIST) | |
7483 | @$(ECHO) $(INDENT) ">>>> Vera/NTB: compiling NTB testbench shell file (-ntb_shell_only) from ${PWD}: $(NTB_LIB)" | |
7484 | ifeq ($(TESTING), test) | |
7485 | @$(ECHO) $(NTB_LIB_COMPILE) -ntb_shell_only | |
7486 | endif | |
7487 | $(NTB_LIB_COMPILE) -ntb_shell_only | |
7488 | ||
7489 | # ntb w/ lib file use, libtb.so file: | |
7490 | # Will rebuild if any DEPENDENCIES file or ORDERD_SRC_LIST or the Makefile file has changed. | |
7491 | # add $(VERA_LIBDIR)/diagChanged to end of next line for sims 1.272 | |
7492 | $(VERA_LIBDIR)/libtb.so: $(BENCH_DIR)/Makefile $(DEPENDENCIES) $(ORDERD_SRC_LIST) | |
7493 | @$(ECHO) $(INDENT) ">>>> Vera/NTB: compiling NTB testbench libtb.so file (-ntb_noshell) from ${PWD}: $(NTB_LIB)" | |
7494 | ifeq ($(TESTING), test) | |
7495 | @$(ECHO) $(NTB_LIB_COMPILE) $(NTB_DIAG_ARGS) -ntb_noshell | |
7496 | endif | |
7497 | $(NTB_LIB_COMPILE) $(NTB_DIAG_ARGS) -ntb_noshell | |
7498 | ||
7499 | ||
7500 | ifndef DEBUG | |
7501 | .SILENT: | |
7502 | endif | |
7503 | ||
7504 | ||
7505 | ||
7506 | =cut | |
7507 | #}}} |