|
CIRCT 23.0.0git
|
Trace buffer encoder producing an FST file. More...
#include <FSTTraceEncoder.h>


Public Member Functions | |
| FSTTraceEncoder (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. | |
| int64_t | getTimeStep () const |
| Return the value of the internal step counter. | |
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< FSTSignalTableEntry > | signalTable |
| Table of signals: The index matches their Trace Tap ID. | |
| struct::fstWriterContext * | fstWriter = nullptr |
| FST writer context. | |
| 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 an FST file.
Definition at line 46 of file FSTTraceEncoder.h.
| circt::arc::runtime::impl::FSTTraceEncoder::FSTTraceEncoder | ( | const ArcRuntimeModelInfo * | modelInfo, |
| ArcState * | state, | ||
| const std::filesystem::path & | outFilePath, | ||
| bool | debug | ||
| ) |
Definition at line 60 of file FSTTraceEncoder.cpp.
|
private |
Build and dump the signal hierarchy.
Definition at line 75 of file FSTTraceEncoder.cpp.
References circt::arc::runtime::impl::appendLegalizedName(), assert(), fstWriter, circt::arc::runtime::impl::TraceEncoder::modelInfo, 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 193 of file FSTTraceEncoder.cpp.
References assert(), circt::arc::runtime::impl::TraceBuffer::firstSimTime, circt::arc::runtime::impl::TraceBuffer::firstStep, fstWriter, circt::arc::runtime::impl::TraceBuffer::getData(), signalTable, circt::arc::runtime::impl::TraceBuffer::size, circt::arc::runtime::impl::TraceBuffer::stepMarkers, and workerStep.
|
overrideprotectedvirtual |
Finish trace encoding. Called by the simulation thread.
Reimplemented from circt::arc::runtime::impl::TraceEncoder.
Definition at line 232 of file FSTTraceEncoder.cpp.
References assert(), fstWriter, circt::arc::runtime::impl::TraceEncoder::getTimeStep(), ArcState::modelState, and workerStep.
|
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 153 of file FSTTraceEncoder.cpp.
References assert(), createHierarchy(), fstWriter, initSignalTable(), circt::arc::runtime::impl::TraceEncoder::modelInfo, ArcRuntimeModelInfo::modelName, ArcState::modelState, ArcRuntimeModelInfo::numStateBytes, outFilePath, and signalTable.
|
private |
Create the table of signals.
Definition at line 67 of file FSTTraceEncoder.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 191 of file FSTTraceEncoder.cpp.
References workerStep.
|
overrideprotectedvirtual |
Called by the worker thread after leaving the encode loop.
Reimplemented from circt::arc::runtime::impl::TraceEncoder.
Definition at line 230 of file FSTTraceEncoder.cpp.
|
private |
FST writer context.
Definition at line 71 of file FSTTraceEncoder.h.
Referenced by createHierarchy(), encode(), finalize(), and initialize().
|
staticconstexpr |
Definition at line 48 of file FSTTraceEncoder.h.
|
private |
Path to the output file.
Definition at line 67 of file FSTTraceEncoder.h.
Referenced by initialize().
|
private |
Table of signals: The index matches their Trace Tap ID.
Definition at line 69 of file FSTTraceEncoder.h.
Referenced by createHierarchy(), encode(), initialize(), and initSignalTable().
|
private |
Current time step of the worker thread.
Definition at line 73 of file FSTTraceEncoder.h.
Referenced by encode(), finalize(), and startUpWorker().