mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Rename tracing rolloverSize and add test (#3570).
This commit is contained in:
parent
5869fdf7f6
commit
2358ced061
1
Changes
1
Changes
@ -22,6 +22,7 @@ Verilator 4.225 devel
|
||||
* Fix segfault exporting non-existant package (#3535).
|
||||
* Fix case statement comparing string literal (#3544). [Gustav Svensk]
|
||||
* Improve Verilation speed with --threads on large designs. [Geza Lore]
|
||||
* Rename trace rolloverSize() (#3570).
|
||||
|
||||
|
||||
Verilator 4.224 2022-06-19
|
||||
|
@ -120,13 +120,13 @@ void VerilatedVcd::open(const char* filename) VL_MT_SAFE_EXCLUDES(m_mutex) {
|
||||
// Set member variables
|
||||
m_filename = filename; // "" is ok, as someone may overload open
|
||||
|
||||
openNextImp(m_rolloverMB != 0);
|
||||
openNextImp(m_rolloverSize != 0);
|
||||
if (!isOpen()) return;
|
||||
|
||||
dumpHeader();
|
||||
|
||||
// When using rollover, the first chunk contains the header only.
|
||||
if (m_rolloverMB) openNextImp(true);
|
||||
if (m_rolloverSize) openNextImp(true);
|
||||
}
|
||||
|
||||
void VerilatedVcd::openNext(bool incFilename) VL_MT_SAFE_EXCLUDES(m_mutex) {
|
||||
@ -180,7 +180,7 @@ void VerilatedVcd::openNextImp(bool incFilename) {
|
||||
}
|
||||
|
||||
bool VerilatedVcd::preChangeDump() {
|
||||
if (VL_UNLIKELY(m_rolloverMB && m_wroteBytes > m_rolloverMB)) openNextImp(true);
|
||||
if (VL_UNLIKELY(m_rolloverSize && m_wroteBytes > m_rolloverSize)) openNextImp(true);
|
||||
return isOpen();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
bool m_fileNewed; // m_filep needs destruction
|
||||
bool m_isOpen = false; // True indicates open file
|
||||
std::string m_filename; // Filename we're writing to (if open)
|
||||
uint64_t m_rolloverMB = 0; // MB of file size to rollover at
|
||||
uint64_t m_rolloverSize = 0; // File size to rollover at
|
||||
int m_modDepth = 0; // Depth of module hierarchy
|
||||
|
||||
char* m_wrBufp; // Output buffer
|
||||
@ -124,8 +124,8 @@ public:
|
||||
~VerilatedVcd();
|
||||
|
||||
// ACCESSORS
|
||||
// Set size in megabytes after which new file should be created
|
||||
void rolloverMB(uint64_t rolloverMB) { m_rolloverMB = rolloverMB; }
|
||||
// Set size in bytes after which new file should be created.
|
||||
void rolloverSize(uint64_t size) { m_rolloverSize = size; }
|
||||
|
||||
// METHODS - All must be thread safe
|
||||
// Open the file; call isOpen() to see if errors
|
||||
@ -271,8 +271,12 @@ public:
|
||||
/// The header is only in the first file created, this allows
|
||||
/// "cat" to be used to combine the header plus any number of data files.
|
||||
void openNext(bool incFilename = true) VL_MT_SAFE { m_sptrace.openNext(incFilename); }
|
||||
/// Set size in megabytes after which new file should be created
|
||||
void rolloverMB(size_t rolloverMB) VL_MT_SAFE { m_sptrace.rolloverMB(rolloverMB); }
|
||||
/// Set size in bytes after which new file should be created
|
||||
/// This will create a header file, followed by each separate file
|
||||
/// which might be larger than the given size (due to chunking and
|
||||
/// alignment to a start of a given time's dump). Any file but the
|
||||
/// first may be removed. Cat files together to create viewable vcd.
|
||||
void rolloverSize(size_t size) VL_MT_SAFE { m_sptrace.rolloverSize(size); }
|
||||
/// Close dump
|
||||
void close() VL_MT_SAFE { m_sptrace.close(); }
|
||||
/// Flush dump
|
||||
|
45
test_regress/t/t_trace_rollover.cpp
Normal file
45
test_regress/t/t_trace_rollover.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
||||
//
|
||||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||
// any use, without warranty, 2008 by Wilson Snyder.
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
#include <verilated.h>
|
||||
#include <verilated_vcd_c.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include VM_PREFIX_INCLUDE
|
||||
|
||||
unsigned long long main_time = 0;
|
||||
double sc_time_stamp() { return (double)main_time; }
|
||||
|
||||
int main(int argc, char** argv, char** env) {
|
||||
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
|
||||
|
||||
Verilated::debug(0);
|
||||
Verilated::traceEverOn(true);
|
||||
|
||||
std::unique_ptr<VerilatedVcdC> tfp{new VerilatedVcdC};
|
||||
top->trace(tfp.get(), 99);
|
||||
|
||||
tfp->rolloverSize(1000); // But will be increased to 8kb chunk size
|
||||
tfp->open(VL_STRINGIFY(TEST_OBJ_DIR) "/simrollover.vcd");
|
||||
|
||||
top->clk = 0;
|
||||
|
||||
while (main_time < 1900) { // Creates 2 files
|
||||
top->clk = !top->clk;
|
||||
top->eval();
|
||||
tfp->dump((unsigned int)(main_time));
|
||||
++main_time;
|
||||
}
|
||||
tfp->close();
|
||||
top->final();
|
||||
tfp.reset();
|
||||
top.reset();
|
||||
printf("*-* All Finished *-*\n");
|
||||
return 0;
|
||||
}
|
4765
test_regress/t/t_trace_rollover.out
Normal file
4765
test_regress/t/t_trace_rollover.out
Normal file
File diff suppressed because it is too large
Load Diff
36
test_regress/t/t_trace_rollover.pl
Executable file
36
test_regress/t/t_trace_rollover.pl
Executable file
@ -0,0 +1,36 @@
|
||||
#!/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-2013 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_all => 1);
|
||||
|
||||
top_filename("t_trace_cat.v");
|
||||
|
||||
compile(
|
||||
make_top_shell => 0,
|
||||
make_main => 0,
|
||||
v_flags2 => ["--trace --exe $Self->{t_dir}/t_trace_rollover.cpp"],
|
||||
);
|
||||
|
||||
execute(
|
||||
check_finished => 1,
|
||||
);
|
||||
|
||||
system("cat $Self->{obj_dir}/simrollover_cat*.vcd "
|
||||
. " > $Self->{obj_dir}/simall.vcd");
|
||||
|
||||
vcd_identical("$Self->{obj_dir}/simall.vcd",
|
||||
$Self->{golden_filename});
|
||||
|
||||
file_grep_not("$Self->{obj_dir}/simrollover_cat0000.vcd", qr/^#/i);
|
||||
file_grep("$Self->{obj_dir}/simrollover_cat0001.vcd", qr/^#/i);
|
||||
file_grep("$Self->{obj_dir}/simrollover_cat0002.vcd", qr/^#/i);
|
||||
|
||||
ok(1);
|
||||
1;
|
Loading…
Reference in New Issue
Block a user