1#!/usr/bin/env 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 6# can 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# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 10 11scenarios(simulator => 1); 12 13top_filename("t/t_opt_table_sparse.v"); 14golden_filename("t/t_opt_table_sparse.out"); 15 16compile( 17 verilator_flags2 => ["--stats", "--output-split 1"], 18 ); 19 20if ($Self->{vlt_all}) { 21 file_grep($Self->{stats}, qr/Optimizations, Tables created\s+(\d+)/i, 1); 22 file_grep($Self->{stats}, qr/ConstPool, Tables emitted\s+(\d+)/i, 2); 23} 24 25# Splitting should set VM_PARALLEL_BUILDS to 1 by default 26file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}_classes.mk", qr/VM_PARALLEL_BUILDS\s*=\s*1/); 27 28check_splits(2); 29 30execute( 31 check_finished => 1, 32 expect_filename => $Self->{golden_filename}, 33 ); 34 35ok(1); 361; 37 38sub check_splits { 39 my $expected = shift; 40 my $n; 41 foreach my $file (glob("$Self->{obj_dir}/*.cpp")) { 42 if ($file =~ /__ConstPool_/) { 43 $n += 1; 44 } 45 } 46 $n == $expected or error("__ConstPool*.cpp not split: $n"); 47} 48