CIRCT  19.0.0git
Public Member Functions | Public Attributes | List of all members
circt::llhd::sim::State Struct Reference

The simulator's state. More...

#include <State.h>

Collaboration diagram for circt::llhd::sim::State:
Collaboration graph
[legend]

Public Member Functions

 State ()=default
 Construct a new empty (at 0 time) state. More...
 
 ~State ()
 State destructor, ensures all malloc'd regions stored in the state are correctly free'd. More...
 
Slot popQueue ()
 Pop the head of the queue and update the simulation time. More...
 
void pushQueue (Time time, unsigned inst)
 Push a new scheduled wakeup event in the event queue. More...
 
llvm::SmallVectorTemplateCommon< Instance >::iterator getInstanceIterator (std::string instName)
 Find an instance in the instances list by name and return an iterator for it. More...
 
int addSignal (std::string name, std::string owner)
 Add a new signal to the state. Returns the index of the new signal. More...
 
int addSignalData (int index, std::string owner, uint8_t *value, uint64_t size)
 
void addSignalElement (unsigned, unsigned, unsigned)
 
void addProcPtr (std::string name, ProcState *procStatePtr)
 Add a pointer to the process persistence state to a process instance. More...
 
void dumpSignal (llvm::raw_ostream &out, int index)
 Dump a signal to the out stream. More...
 
void dumpLayout ()
 Dump the instance layout. Used for testing purposes. More...
 
void dumpSignalTriggers ()
 Dump the instances each signal triggers. Used for testing purposes. More...
 

Public Attributes

Time time
 
std::string root
 
llvm::SmallVector< Instance, 0 > instances
 
llvm::SmallVector< Signal, 0 > signals
 
UpdateQueue queue
 

Detailed Description

The simulator's state.

It contains the current simulation time, signal values and the event queue.

Definition at line 306 of file State.h.

Constructor & Destructor Documentation

◆ State()

circt::llhd::sim::State::State ( )
default

Construct a new empty (at 0 time) state.

◆ ~State()

State::~State ( )

State destructor, ensures all malloc'd regions stored in the state are correctly free'd.

Definition at line 209 of file State.cpp.

Member Function Documentation

◆ addProcPtr()

void State::addProcPtr ( std::string  name,
ProcState procStatePtr 
)

Add a pointer to the process persistence state to a process instance.

Definition at line 246 of file State.cpp.

References circt::llhd::sim::ProcState::inst.

Referenced by allocProc().

◆ addSignal()

int State::addSignal ( std::string  name,
std::string  owner 
)

Add a new signal to the state. Returns the index of the new signal.

Definition at line 241 of file State.cpp.

◆ addSignalData()

int State::addSignalData ( int  index,
std::string  owner,
uint8_t *  value,
uint64_t  size 
)

Definition at line 254 of file State.cpp.

Referenced by allocSignal().

◆ addSignalElement()

void State::addSignalElement ( unsigned  index,
unsigned  offset,
unsigned  size 
)

Definition at line 276 of file State.cpp.

Referenced by addSigArrayElements(), and addSigStructElement().

◆ dumpLayout()

void State::dumpLayout ( )

Dump the instance layout. Used for testing purposes.

Definition at line 288 of file State.cpp.

◆ dumpSignal()

void State::dumpSignal ( llvm::raw_ostream &  out,
int  index 
)

Dump a signal to the out stream.

One entry is added for every instance the signal appears in.

Definition at line 280 of file State.cpp.

◆ dumpSignalTriggers()

void State::dumpSignalTriggers ( )

Dump the instances each signal triggers. Used for testing purposes.

Definition at line 303 of file State.cpp.

◆ getInstanceIterator()

llvm::SmallVectorTemplateCommon< Instance >::iterator State::getInstanceIterator ( std::string  instName)

Find an instance in the instances list by name and return an iterator for it.

Definition at line 231 of file State.cpp.

References assert().

Referenced by allocEntity().

◆ popQueue()

Slot State::popQueue ( )

Pop the head of the queue and update the simulation time.

Definition at line 217 of file State.cpp.

References assert().

◆ pushQueue()

void State::pushQueue ( Time  time,
unsigned  inst 
)

Push a new scheduled wakeup event in the event queue.

Definition at line 224 of file State.cpp.

Referenced by llhdSuspend().

Member Data Documentation

◆ instances

llvm::SmallVector<Instance, 0> circt::llhd::sim::State::instances

Definition at line 348 of file State.h.

◆ queue

UpdateQueue circt::llhd::sim::State::queue

Definition at line 350 of file State.h.

Referenced by driveSignal().

◆ root

std::string circt::llhd::sim::State::root

Definition at line 347 of file State.h.

◆ signals

llvm::SmallVector<Signal, 0> circt::llhd::sim::State::signals

Definition at line 349 of file State.h.

Referenced by driveSignal().

◆ time

Time circt::llhd::sim::State::time

Definition at line 346 of file State.h.

Referenced by driveSignal().


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