verilator/test_regress/t/t_dotfiles.pl
Morten Borup Petersen fd0446f481
Internals: Add .dot graph visualization of ThreadSchedule (#3048)
* Move MTaskState to ThreadSchedule

MTaskState does not concern itself with sandbagging, and thus solely contains information related to the finalized schedule, i.e., completion time, thread ID and next MTask on thread.

* Add .dot graph visualization of ThreadSchedule

Follow-up to #2779.

This commit adds the creation of .dot files - used by GraphViz - to visualize how mtasks are statically scheduled across the set of specified threads.
We visualize each thread as a row, with nodes of a row being the mtasks scheduled for the given thread. The width of the mtask nodes are proportional to their cost. MTask dependencies are shown using an edge between the source and sink mtasks.
2021-07-06 07:06:00 -04:00

37 lines
1.3 KiB
Perl
Executable File

#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2021 by Wilson Snyder. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(vltmt => 1);
# Use a top file which we are sure to be parallelizable
top_filename("t/t_gen_alw.v");
compile(
v_flags2 => ["--debug --debugi 5 --threads 2"]
);
foreach my $dotname ("linkcells", "task_call", "gate_simp", "gate_opt",
"acyc_simp", "orderg_pre", "orderg_acyc", "orderg_order", "orderg_domain",
"ordermv_initial", "ordermv_hazards", "ordermv_contraction",
"ordermv_transitive1", "orderg_done", "ordermv_transitive2", "schedule") {
# Some files with identical prefix are generated multiple times during
# verilation. Ensure that at least one of each $dotname-prefixed file is generated.
@dotFiles = glob("$Self->{obj_dir}/*$dotname.dot");
if (scalar @dotFiles == 0) {
error("Found no dotfiles with pattern *$dotname.dot");
}
foreach my $dotFilename (@dotFiles) {
file_grep($dotFilename, qr/digraph v3graph/);
}
}
ok(1);
1;