1#!/usr/bin/perl 2if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } 3# DESCRIPTION: Verilator: Verilog Test driver/expect definition 4# 5# Copyright 2003 by Wilson Snyder. This program is free software; you can 6# redistribute it and/or modify it under the terms of either the GNU 7# Lesser General Public License Version 3 or the Perl Artistic License 8# Version 2.0. 9 10# stats will be deleted but generation will be skipped if libs of hierarchical blocks exist. 11clean_objs(); 12 13scenarios(vlt_all => 1); 14top_filename("t/t_hier_block.v"); 15 16# CI environment offers 2 VCPUs, 2 thread setting causes the following warning. 17# %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads. 18# So use 6 threads here though it's not optimal in performace wise, but ok. 19compile( 20 v_flags2 => ['t/t_hier_block.cpp'], 21 verilator_flags2 => ['--stats', 22 '--hierarchical', 23 '+define+SHOW_TIMESCALE', 24 '+define+USE_VLT', 't/t_hier_block_vlt.vlt', 25 '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"', 26 ($Self->{vltmt} ? ' --threads 6' : '')], 27 ); 28 29execute( 30 check_finished => 1, 31 ); 32 33file_grep($Self->{obj_dir} . "/Vsub0/sub0.sv", qr/^\s+timeprecision\s+(\d+)ps;/mi, 1); 34file_grep($Self->{obj_dir} . "/Vsub0/sub0.sv", /^module\s+(\S+)\s+/, "sub0"); 35file_grep($Self->{obj_dir} . "/Vsub1/sub1.sv", /^module\s+(\S+)\s+/, "sub1"); 36file_grep($Self->{obj_dir} . "/Vsub2/sub2.sv", /^module\s+(\S+)\s+/, "sub2"); 37file_grep($Self->{stats}, qr/HierBlock,\s+Hierarchical blocks\s+(\d+)/i, 13); 38file_grep($Self->{run_log_filename}, qr/MACRO:(\S+) is defined/i, "cplusplus"); 39 40ok(1); 411; 42