|
CIRCT 22.0.0git
|
Trace buffer encoder producing a VCD file. More...
#include <VCDTraceEncoder.h>


Public Member Functions | |
| VCDTraceEncoder (const ArcRuntimeModelInfo *modelInfo, ArcState *state, const std::filesystem::path &outFilePath, bool debug) | |
Public Member Functions inherited from circt::arc::runtime::impl::TraceEncoder | |
| TraceEncoder ()=delete | |
| TraceEncoder (const ArcRuntimeModelInfo *modelInfo, ArcState *state, unsigned numBuffers, bool debug) | |
| Construct a trace encoder for the given model and the given number of buffers. | |
| virtual | ~TraceEncoder ()=default |
| void | run (ArcState *state) |
| Begin tracing. | |
| uint64_t * | dispatch (uint32_t oldBufferSize) |
Dispatch the currently active trace buffer containing oldBufferSize valid entries to the encoder thread and return the storage of the new active buffer. | |
| void | step (const ArcState *state) |
| Signal the start of a new simulation time step. | |
| void | finish (const ArcState *state) |
| Stop tracing. | |
Static Public Attributes | |
| static constexpr unsigned | numTraceBuffers = 4 |
Protected Member Functions | |
| bool | initialize (const ArcState *state) override |
| Set-up the encoder before starting the worker thread. | |
| void | startUpWorker () override |
| Called by the worker thread before entering the encode loop. | |
| void | encode (TraceBuffer &work) override |
| Encode the given trace buffer. Called by the worker thread. | |
| void | windDownWorker () override |
| Called by the worker thread after leaving the encode loop. | |
| void | finalize (const ArcState *state) override |
| Finish trace encoding. Called by the simulation thread. | |
Private Member Functions | |
| void | initSignalTable () |
| Create the table of signals. | |
| void | createHierarchy () |
| Build and dump the signal hierarchy. | |
Private Attributes | |
| const std::filesystem::path | outFilePath |
| Path to the output file. | |
| std::vector< VCDSignalTableEntry > | signalTable |
| Table of signals: The index matches their Trace Tap ID. | |
| std::ofstream | outFile |
| Output file stream. | |
| std::unique_ptr< char[]> | fileBuffer |
| Internal buffer of the output stream. | |
| std::vector< char > | workerOutBuffer |
| Concatenation buffer of the worker thread. | |
| int64_t | workerStep |
| Current time step of the worker thread. | |
Additional Inherited Members | |
Public Attributes inherited from circt::arc::runtime::impl::TraceEncoder | |
| const unsigned | numBuffers |
| Number of trace buffers in rotation. | |
Protected Attributes inherited from circt::arc::runtime::impl::TraceEncoder | |
| const ArcRuntimeModelInfo *const | modelInfo |
| Metadata of the traced model. | |
| const bool | debug |
| Debug mode flag. | |
Trace buffer encoder producing a VCD file.
Definition at line 68 of file VCDTraceEncoder.h.
| circt::arc::runtime::impl::VCDTraceEncoder::VCDTraceEncoder | ( | const ArcRuntimeModelInfo * | modelInfo, |
| ArcState * | state, | ||
| const std::filesystem::path & | outFilePath, | ||
| bool | debug | ||
| ) |
Definition at line 88 of file VCDTraceEncoder.cpp.
|
private |
Build and dump the signal hierarchy.
Definition at line 118 of file VCDTraceEncoder.cpp.
References circt::arc::runtime::impl::appendLegalizedName(), assert(), circt::arc::runtime::impl::TraceEncoder::modelInfo, outFile, signalTable, and ArcRuntimeModelInfo::traceInfo.
Referenced by initialize().
|
overrideprotectedvirtual |
Encode the given trace buffer. Called by the worker thread.
Reimplemented from circt::arc::runtime::impl::TraceEncoder.
Definition at line 249 of file VCDTraceEncoder.cpp.
References assert(), circt::arc::runtime::impl::TraceBuffer::firstStep, circt::arc::runtime::impl::TraceBuffer::getData(), outFile, signalTable, circt::arc::runtime::impl::TraceBuffer::size, circt::arc::runtime::impl::TraceBuffer::stepMarkers, workerOutBuffer, workerStep, and circt::arc::runtime::impl::writeTimestepToBuffer().
|
overrideprotectedvirtual |
Finish trace encoding. Called by the simulation thread.
Reimplemented from circt::arc::runtime::impl::TraceEncoder.
Definition at line 298 of file VCDTraceEncoder.cpp.
References outFile.
|
overrideprotectedvirtual |
Set-up the encoder before starting the worker thread.
May return false to indicate failure. In this case, no worker thread will be created. Called by the simulation thread.
Implements circt::arc::runtime::impl::TraceEncoder.
Definition at line 209 of file VCDTraceEncoder.cpp.
References assert(), createHierarchy(), fileBuffer, initSignalTable(), circt::arc::runtime::impl::TraceEncoder::modelInfo, ArcRuntimeModelInfo::modelName, ArcState::modelState, ArcRuntimeModelInfo::numStateBytes, outFile, outFilePath, and signalTable.
|
private |
Create the table of signals.
Definition at line 95 of file VCDTraceEncoder.cpp.
References circt::arc::runtime::impl::TraceEncoder::modelInfo, signalTable, and ArcRuntimeModelInfo::traceInfo.
Referenced by initialize().
|
overrideprotectedvirtual |
Called by the worker thread before entering the encode loop.
Reimplemented from circt::arc::runtime::impl::TraceEncoder.
Definition at line 247 of file VCDTraceEncoder.cpp.
References workerStep.
|
overrideprotectedvirtual |
Called by the worker thread after leaving the encode loop.
Reimplemented from circt::arc::runtime::impl::TraceEncoder.
Definition at line 288 of file VCDTraceEncoder.cpp.
References assert(), outFile, workerOutBuffer, workerStep, and circt::arc::runtime::impl::writeTimestepToBuffer().
|
private |
Internal buffer of the output stream.
Do not access directly. Do not release until outFile is closed.
Definition at line 96 of file VCDTraceEncoder.h.
Referenced by initialize().
|
staticconstexpr |
Definition at line 70 of file VCDTraceEncoder.h.
|
private |
Output file stream.
Definition at line 93 of file VCDTraceEncoder.h.
Referenced by createHierarchy(), encode(), finalize(), initialize(), and windDownWorker().
|
private |
Path to the output file.
Definition at line 89 of file VCDTraceEncoder.h.
Referenced by initialize().
|
private |
Table of signals: The index matches their Trace Tap ID.
Definition at line 91 of file VCDTraceEncoder.h.
Referenced by createHierarchy(), encode(), initialize(), and initSignalTable().
|
private |
Concatenation buffer of the worker thread.
Definition at line 98 of file VCDTraceEncoder.h.
Referenced by encode(), and windDownWorker().
|
private |
Current time step of the worker thread.
Definition at line 100 of file VCDTraceEncoder.h.
Referenced by encode(), startUpWorker(), and windDownWorker().