VCDTrace
class VCDTrace : public Trace
@brief VCD (Verilog Change Dump) file format trace reader
Reads and parses VCD waveform files produced by Verilog/VHDL simulators. Stores signal values at different time points and provides query interface.
Functions
| Name | Description |
|---|---|
| VCDTrace | @brief Constructor tid : Trace ID filename : VCD file path container : Trace container scope_filter : Optional scope prefix to filter signals during parsing (e.g., "TOP^cpu") |
| load | @brief Parse and load VCD file |
| signal_value | @brief Get signal value at given index + offset |
| signal_width | @brief Get signal width in bits |
| contains_signal | @brief Check if signal exists |
| get_all_signals | @brief Get all signal names |
| get_timestamp | @brief Get actual timestamp value at current index |
| get_time_steps | @brief Get direct access to time steps (for performance-critical operations) |
| get_initial_values | @brief Get initial signal values from $dumpvars section (keyed by VCD identifier) |
| get_signal_info | @brief Get signal info map (for performance-critical operations) |
| parse_header | @brief Parse VCD header section |
| parse_data | @brief Parse VCD data section |
| parse_value_change | @brief Parse a single value change. |
| update_current_values | @brief Update current values at specific index |
| parse_bit_value | @brief Convert binary string to integer value |
| read_file_lines | @brief Read file into lines |
| read_file_lines_mmap | @brief Read VCD file lines using memory-mapped I/O (faster for large files) |
| parse_data_parallel | @brief Parse data section in parallel (thread-safe) |
| parse_data_chunk | @brief Parse a chunk of VCD data lines (for parallel processing) |
Function Details
VCDTrace
VCDTrace(const std::string& tid, const std::string& filename, std::shared_ptr<TraceContainer> container, const std::string& scope_filter = "")
@brief Constructor
-
tid - Trace ID
-
filename - VCD file path
-
container - Trace container
-
scope_filter - Optional scope prefix to filter signals during parsing (e.g., "TOP^cpu")
contains_signal
bool contains_signal(const std::string& name) const override
@brief Check if signal exists
get_all_signals
std::vector<std::string> get_all_signals() const override
@brief Get all signal names
get_initial_values
const std::unordered_map<std::string, Value>& get_initial_values() const
@brief Get initial signal values from $dumpvars section (keyed by VCD identifier)
get_signal_info
const std::unordered_map<std::string, SignalInfo>& get_signal_info() const
@brief Get signal info map (for performance-critical operations)
get_time_steps
const std::vector<TimeStep>& get_time_steps() const
@brief Get direct access to time steps (for performance-critical operations)
get_timestamp
int64_t get_timestamp() const
@brief Get actual timestamp value at current index
load
void load()
@brief Parse and load VCD file
parse_bit_value
static Value parse_bit_value(const std::string& bits)
@brief Convert binary string to integer value
parse_data
void parse_data(const std::vector<std::string>& lines, size_t& line_idx)
@brief Parse VCD data section
parse_data_chunk
void parse_data_chunk(const std::vector<std::string>& lines, size_t start_idx, size_t end_idx, std::vector<TimeStep>& chunk_timesteps)
@brief Parse a chunk of VCD data lines (for parallel processing)
parse_data_parallel
void parse_data_parallel(const std::vector<std::string>& lines, size_t line_idx)
@brief Parse data section in parallel (thread-safe)
parse_header
void parse_header(const std::vector<std::string>& lines, size_t& line_idx)
@brief Parse VCD header section
parse_value_change
void parse_value_change(const std::string& line, int64_t& timestamp, std::unordered_map<std::string, Value>* changes = nullptr)
@brief Parse a single value change. When changes != nullptr, also records the updated (id, value) into *changes (used for sparse delta storage during data-section parsing).
read_file_lines
static std::vector<std::string> read_file_lines(const std::string& filename)
@brief Read file into lines
read_file_lines_mmap
static std::vector<std::string> read_file_lines_mmap(const std::string& filename)
@brief Read VCD file lines using memory-mapped I/O (faster for large files)
signal_value
Value signal_value(const std::string& name, int offset = 0, const std::string& scope = "") override
@brief Get signal value at given index + offset
signal_width
int signal_width(const std::string& name) override
@brief Get signal width in bits
update_current_values
void update_current_values(int index)
@brief Update current values at specific index