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

#include <ModelInstance.h>

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

Public Member Functions

 ModelInstance ()=delete
 
 ModelInstance (const ArcRuntimeModelInfo *modelInfo, const char *args, ArcState *state)
 
 ~ModelInstance ()
 
const char * getModelName () const
 
void onInitialized (ArcState *mutableState)
 
void onEval (ArcState *mutableState)
 
uint64_t * swapTraceBuffer ()
 

Private Types

enum class  TraceMode { DUMMY , VCD , FST }
 

Private Member Functions

void parseArgs (const char *args)
 Parse and initialize the instance settings from the given argument string.
 
std::filesystem::path getTraceFilePath (const std::string &suffix)
 Get the path to the output trace file.
 

Private Attributes

const uint64_t instanceID
 
const ArcRuntimeModelInfo *const modelInfo
 
const ArcState *const state
 
std::map< std::string, std::optional< std::string > > arguments
 
std::filesystem::path workDir
 The path to the instance's working directory.
 
TraceMode traceMode
 
std::unique_ptr< TraceEncodertraceEncoder
 
bool verbose = false
 
uint64_t stepCounter = 0
 

Static Private Attributes

static const std::string kArgKeyDebug = "debug"
 Enable verbose debug output.
 
static const std::string kArgKeyFst = "fst"
 Select FST trace mode.
 
static const std::string kArgKeyTraceFile = "traceFile"
 Workdir-relative or absolute path to trace file.
 
static const std::string kArgKeyVcd = "vcd"
 Select VCD trace mode.
 
static const std::string kArgKeyWorkDir = "workDir"
 Instance's working directory. Absolute or relative to process workdir.
 

Detailed Description

Definition at line 34 of file ModelInstance.h.

Member Enumeration Documentation

◆ TraceMode

Enumerator
DUMMY 
VCD 
FST 

Definition at line 78 of file ModelInstance.h.

Constructor & Destructor Documentation

◆ ModelInstance() [1/2]

circt::arc::runtime::impl::ModelInstance::ModelInstance ( )
delete

◆ ModelInstance() [2/2]

circt::arc::runtime::impl::ModelInstance::ModelInstance ( const ArcRuntimeModelInfo modelInfo,
const char *  args,
ArcState state 
)

◆ ~ModelInstance()

circt::arc::runtime::impl::ModelInstance::~ModelInstance ( )

Member Function Documentation

◆ getModelName()

const char * circt::arc::runtime::impl::ModelInstance::getModelName ( ) const
inline

Definition at line 41 of file ModelInstance.h.

References modelInfo, and ArcRuntimeModelInfo::modelName.

Referenced by ModelInstance(), and ~ModelInstance().

◆ getTraceFilePath()

std::filesystem::path circt::arc::runtime::impl::ModelInstance::getTraceFilePath ( const std::string &  suffix)
private

Get the path to the output trace file.

Creates a default file name with the given suffix within the working directory if not explicitly set by the runtime arguments.

Definition at line 106 of file ModelInstance.cpp.

References arguments, instanceID, kArgKeyTraceFile, modelInfo, ArcRuntimeModelInfo::modelName, and workDir.

Referenced by ModelInstance().

◆ onEval()

void circt::arc::runtime::impl::ModelInstance::onEval ( ArcState mutableState)

Definition at line 124 of file ModelInstance.cpp.

References assert(), state, stepCounter, and traceEncoder.

◆ onInitialized()

void circt::arc::runtime::impl::ModelInstance::onInitialized ( ArcState mutableState)

Definition at line 131 of file ModelInstance.cpp.

References assert(), instanceID, state, traceEncoder, and verbose.

◆ parseArgs()

void circt::arc::runtime::impl::ModelInstance::parseArgs ( const char *  args)
private

Parse and initialize the instance settings from the given argument string.

Definition at line 281 of file ModelInstance.cpp.

References arguments, FST, instanceID, kArgKeyDebug, kArgKeyFst, kArgKeyVcd, kArgKeyWorkDir, circt::arc::runtime::impl::parseArgsToMap(), traceMode, VCD, verbose, and workDir.

Referenced by ModelInstance().

◆ swapTraceBuffer()

uint64_t * circt::arc::runtime::impl::ModelInstance::swapTraceBuffer ( )

Member Data Documentation

◆ arguments

std::map<std::string, std::optional<std::string> > circt::arc::runtime::impl::ModelInstance::arguments
private

Definition at line 72 of file ModelInstance.h.

Referenced by getTraceFilePath(), and parseArgs().

◆ instanceID

const uint64_t circt::arc::runtime::impl::ModelInstance::instanceID
private

◆ kArgKeyDebug

const std::string circt::arc::runtime::impl::ModelInstance::kArgKeyDebug = "debug"
inlinestaticprivate

Enable verbose debug output.

Definition at line 52 of file ModelInstance.h.

Referenced by parseArgs().

◆ kArgKeyFst

const std::string circt::arc::runtime::impl::ModelInstance::kArgKeyFst = "fst"
inlinestaticprivate

Select FST trace mode.

Definition at line 54 of file ModelInstance.h.

Referenced by parseArgs().

◆ kArgKeyTraceFile

const std::string circt::arc::runtime::impl::ModelInstance::kArgKeyTraceFile = "traceFile"
inlinestaticprivate

Workdir-relative or absolute path to trace file.

Definition at line 56 of file ModelInstance.h.

Referenced by getTraceFilePath().

◆ kArgKeyVcd

const std::string circt::arc::runtime::impl::ModelInstance::kArgKeyVcd = "vcd"
inlinestaticprivate

Select VCD trace mode.

Definition at line 58 of file ModelInstance.h.

Referenced by parseArgs().

◆ kArgKeyWorkDir

const std::string circt::arc::runtime::impl::ModelInstance::kArgKeyWorkDir = "workDir"
inlinestaticprivate

Instance's working directory. Absolute or relative to process workdir.

Definition at line 60 of file ModelInstance.h.

Referenced by parseArgs().

◆ modelInfo

const ArcRuntimeModelInfo* const circt::arc::runtime::impl::ModelInstance::modelInfo
private

Definition at line 70 of file ModelInstance.h.

Referenced by getModelName(), getTraceFilePath(), and ModelInstance().

◆ state

const ArcState* const circt::arc::runtime::impl::ModelInstance::state
private

Definition at line 71 of file ModelInstance.h.

Referenced by onEval(), onInitialized(), swapTraceBuffer(), and ~ModelInstance().

◆ stepCounter

uint64_t circt::arc::runtime::impl::ModelInstance::stepCounter = 0
private

Definition at line 82 of file ModelInstance.h.

Referenced by onEval(), and ~ModelInstance().

◆ traceEncoder

std::unique_ptr<TraceEncoder> circt::arc::runtime::impl::ModelInstance::traceEncoder
private

Definition at line 80 of file ModelInstance.h.

Referenced by ModelInstance(), onEval(), onInitialized(), swapTraceBuffer(), and ~ModelInstance().

◆ traceMode

TraceMode circt::arc::runtime::impl::ModelInstance::traceMode
private

Definition at line 79 of file ModelInstance.h.

Referenced by ModelInstance(), and parseArgs().

◆ verbose

bool circt::arc::runtime::impl::ModelInstance::verbose = false
private

◆ workDir

std::filesystem::path circt::arc::runtime::impl::ModelInstance::workDir
private

The path to the instance's working directory.

Matches the process working directory if not provided by a runtime argument.

Definition at line 75 of file ModelInstance.h.

Referenced by getTraceFilePath(), and parseArgs().


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