CIRCT 23.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
circt::arc::runtime::impl::FSTTraceEncoder Class Referencefinal

Trace buffer encoder producing an FST file. More...

#include <FSTTraceEncoder.h>

Inheritance diagram for circt::arc::runtime::impl::FSTTraceEncoder:
Inheritance graph
[legend]
Collaboration diagram for circt::arc::runtime::impl::FSTTraceEncoder:
Collaboration graph
[legend]

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< FSTSignalTableEntrysignalTable
 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.
 

Detailed Description

Trace buffer encoder producing an FST file.

Definition at line 46 of file FSTTraceEncoder.h.

Constructor & Destructor Documentation

◆ FSTTraceEncoder()

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.

Member Function Documentation

◆ createHierarchy()

void circt::arc::runtime::impl::FSTTraceEncoder::createHierarchy ( )
private

◆ encode()

void circt::arc::runtime::impl::FSTTraceEncoder::encode ( TraceBuffer work)
overrideprotectedvirtual

◆ finalize()

void circt::arc::runtime::impl::FSTTraceEncoder::finalize ( const ArcState state)
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.

◆ initialize()

bool circt::arc::runtime::impl::FSTTraceEncoder::initialize ( const ArcState state)
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.

◆ initSignalTable()

void circt::arc::runtime::impl::FSTTraceEncoder::initSignalTable ( )
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().

◆ startUpWorker()

void circt::arc::runtime::impl::FSTTraceEncoder::startUpWorker ( )
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.

◆ windDownWorker()

void circt::arc::runtime::impl::FSTTraceEncoder::windDownWorker ( )
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.

Member Data Documentation

◆ fstWriter

struct::fstWriterContext* circt::arc::runtime::impl::FSTTraceEncoder::fstWriter = nullptr
private

FST writer context.

Definition at line 71 of file FSTTraceEncoder.h.

Referenced by createHierarchy(), encode(), finalize(), and initialize().

◆ numTraceBuffers

constexpr unsigned circt::arc::runtime::impl::FSTTraceEncoder::numTraceBuffers = 4
staticconstexpr

Definition at line 48 of file FSTTraceEncoder.h.

◆ outFilePath

const std::filesystem::path circt::arc::runtime::impl::FSTTraceEncoder::outFilePath
private

Path to the output file.

Definition at line 67 of file FSTTraceEncoder.h.

Referenced by initialize().

◆ signalTable

std::vector<FSTSignalTableEntry> circt::arc::runtime::impl::FSTTraceEncoder::signalTable
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().

◆ workerStep

int64_t circt::arc::runtime::impl::FSTTraceEncoder::workerStep
private

Current time step of the worker thread.

Definition at line 73 of file FSTTraceEncoder.h.

Referenced by encode(), finalize(), and startUpWorker().


The documentation for this class was generated from the following files: