14#ifndef CIRCT_DIALECT_ARC_RUNTIME_VCDTRACEENCODER_H
15#define CIRCT_DIALECT_ARC_RUNTIME_VCDTRACEENCODER_H
37 inline const char *
cStr()
const {
return raw.data(); }
43 std::array<char, 16>
raw;
Abstract TraceEncoder managing trace buffers and the encoder thread.
const ArcRuntimeModelInfo *const modelInfo
Metadata of the traced model.
Trace buffer encoder producing a VCD file.
void startUpWorker() override
Called by the worker thread before entering the encode loop.
std::ofstream outFile
Output file stream.
std::vector< char > workerOutBuffer
Concatenation buffer of the worker thread.
std::unique_ptr< char[]> fileBuffer
Internal buffer of the output stream.
void windDownWorker() override
Called by the worker thread after leaving the encode loop.
void createHierarchy()
Build and dump the signal hierarchy.
const std::filesystem::path outFilePath
Path to the output file.
void encode(TraceBuffer &work) override
Encode the given trace buffer. Called by the worker thread.
static constexpr unsigned numTraceBuffers
std::vector< VCDSignalTableEntry > signalTable
Table of signals: The index matches their Trace Tap ID.
bool initialize(const ArcState *state) override
Set-up the encoder before starting the worker thread.
int64_t workerStep
Current time step of the worker thread.
void initSignalTable()
Create the table of signals.
void finalize(const ArcState *state) override
Finish trace encoding. Called by the simulation thread.
Static information for a compiled hardware model, generated by the MLIR lowering.
Combined runtime and model state for a hardware model instance.
A heap allocated buffer containing raw trace data and time step markers.
String identifier for a signal in a VCD file consisting of characters in the ASCII range from '!...
const char * cStr() const
Get the ID as null terminated string.
std::array< char, 16 > raw
unsigned getNumChars() const
Get the number of characters in the ID.
A traced signal in the VCD file.
uint64_t stateOffset
Offest of the signal in the model's simulation state.
VCDSignalId id
VCD signal ID.
unsigned getDumpSize() const
Get the number of characters required to dump this signal's ID and value.
unsigned getStride() const
Get the number of words occupied by the signal value in the trace buffer.
VCDSignalTableEntry(uint64_t index, uint64_t stateOffset, uint32_t numBits)
uint32_t numBits
Bit width of the signal.