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
13top_filename("t/t_hier_block.v");
14
15# CI environment offers 2 VCPUs, 2 thread setting causes the following warning.
16# %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads.
17# So use 6 threads here though it's not optimal in performace wise, but ok.
18scenarios(vlt_all => 1);
19
20compile(
21    v_flags2 => ['t/t_hier_block.cpp'],
22    verilator_flags2 => ['--sc',
23                         '--stats',
24                         '--hierarchical',
25                         ($Self->{vltmt} ? ' --threads 6' : ''),
26                         '--CFLAGS', '"-pipe -DCPP_MACRO=cplusplus"'
27    ],
28    );
29
30execute(
31    check_finished => 1,
32    );
33
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