forked from github/verilator
Fix --trace with --main/--binary (#3664)
This commit is contained in:
parent
ff49f797e5
commit
18c26b90af
@ -64,8 +64,8 @@ private:
|
||||
puts("int main(int argc, char** argv, char**) {\n");
|
||||
puts("// Setup context, defaults, and parse command line\n");
|
||||
puts("Verilated::debug(0);\n");
|
||||
if (v3Global.opt.trace()) puts("Verilated::traceEverOn(true);\n");
|
||||
puts("const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};\n");
|
||||
if (v3Global.opt.trace()) puts("contextp->traceEverOn(true);\n");
|
||||
puts("contextp->commandArgs(argc, argv);\n");
|
||||
puts("\n");
|
||||
|
||||
|
16
test_regress/t/t_trace_binary.out
Normal file
16
test_regress/t/t_trace_binary.out
Normal file
@ -0,0 +1,16 @@
|
||||
$version Generated by VerilatedVcd $end
|
||||
$date Sun Oct 9 14:08:37 2022 $end
|
||||
$timescale 1ps $end
|
||||
|
||||
$scope module TOP $end
|
||||
$scope module t $end
|
||||
$var wire 32 # sig [31:0] $end
|
||||
$upscope $end
|
||||
$upscope $end
|
||||
$enddefinitions $end
|
||||
|
||||
|
||||
#0
|
||||
b00000000000000000000000000001010 #
|
||||
#20
|
||||
b00000000000000000000000000010100 #
|
35
test_regress/t/t_trace_binary.pl
Executable file
35
test_regress/t/t_trace_binary.pl
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 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(vlt => 1);
|
||||
|
||||
if (!$Self->have_coroutines) {
|
||||
skip("No coroutine support");
|
||||
}
|
||||
else {
|
||||
compile(
|
||||
verilator_flags => [# Custom as don't want -cc
|
||||
"-Mdir $Self->{obj_dir}",
|
||||
"--debug-check", ],
|
||||
verilator_flags2 => ['--binary --trace'],
|
||||
verilator_make_cmake => 0,
|
||||
verilator_make_gmake => 0,
|
||||
make_main => 0,
|
||||
);
|
||||
|
||||
execute(
|
||||
check_finished => 1,
|
||||
);
|
||||
|
||||
vcd_identical("$Self->{obj_dir}/simx.vcd", $Self->{golden_filename});
|
||||
}
|
||||
|
||||
ok(1);
|
||||
1;
|
20
test_regress/t/t_trace_binary.v
Normal file
20
test_regress/t/t_trace_binary.v
Normal file
@ -0,0 +1,20 @@
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2020 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
`define STRINGIFY(x) `"x`"
|
||||
|
||||
module t(/*AUTOARG*/);
|
||||
int sig;
|
||||
initial begin
|
||||
sig = 10;
|
||||
$dumpfile({`STRINGIFY(`TEST_OBJ_DIR),"/simx.vcd"});
|
||||
$dumpvars();
|
||||
#20;
|
||||
sig = 20;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
endmodule
|
2
test_regress/t/t_trace_binary_flag_off.out
Normal file
2
test_regress/t/t_trace_binary_flag_off.out
Normal file
@ -0,0 +1,2 @@
|
||||
-Info: t/t_trace_binary.v:14: $dumpvar ignored, as Verilated without --trace
|
||||
*-* All Finished *-*
|
35
test_regress/t/t_trace_binary_flag_off.pl
Executable file
35
test_regress/t/t_trace_binary_flag_off.pl
Executable file
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 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(vlt => 1);
|
||||
|
||||
top_filename("t/t_trace_binary.v");
|
||||
|
||||
if (!$Self->have_coroutines) {
|
||||
skip("No coroutine support");
|
||||
}
|
||||
else {
|
||||
compile(
|
||||
verilator_flags => [# Custom as don't want -cc
|
||||
"-Mdir $Self->{obj_dir}",
|
||||
"--debug-check", ],
|
||||
verilator_flags2 => ['--binary'],
|
||||
verilator_make_cmake => 0,
|
||||
verilator_make_gmake => 0,
|
||||
make_main => 0,
|
||||
);
|
||||
|
||||
execute(
|
||||
expect_filename => $Self->{golden_filename},
|
||||
);
|
||||
}
|
||||
|
||||
ok(1);
|
||||
1;
|
Loading…
Reference in New Issue
Block a user