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(vlt => 1); 12 13top_filename("t_prof.v"); 14 15ok(1); 16 17sub dotest { 18 compile( 19 verilator_flags2 => ["--stats --prof-c"], 20 ); 21 22 unlink $_ foreach (glob "$Self->{obj_dir}/gmon.out.*"); 23 setenv('GMON_OUT_PREFIX', "$Self->{obj_dir}/gmon.out"); 24 25 execute( 26 check_finished => 1, 27 ); 28 29 my $gmon_path; 30 $gmon_path = $_ foreach (glob "$Self->{obj_dir}/gmon.out.*"); 31 $gmon_path or error("Profiler did not create a gmon.out"); 32 (my $gmon_base = $gmon_path) =~ s!.*[/\\]!!; 33 34 run(cmd => ["cd $Self->{obj_dir} && gprof $Self->{VM_PREFIX} $gmon_base > gprof.out"], 35 check_finished => 0); 36} 37 381; 39