OpenASIP
2.0
|
#include <MachineState.hh>
Public Member Functions | |
MachineState () | |
virtual | ~MachineState () |
void | clear () |
GCUState & | gcuState () |
BusState & | busState (const std::string &name) |
FUState & | fuState (const std::string &name) |
int | FUStateCount () const |
FUState & | fuState (int index) |
void | advanceClockOfAllFUStates () |
void | endClockOfAllFUStates () |
void | advanceClockOfAllGuardStates () |
void | advanceClockOfAllLongImmediateUnitStates () |
void | resetAllFUs () |
void | clearBuses () |
PortState & | portState (const std::string &portName, const std::string &fuName) |
LongImmediateUnitState & | longImmediateUnitState (const std::string &name) |
RegisterFileState & | registerFileState (const std::string &name) |
GuardState & | guardState (const TTAMachine::Guard &guard) |
void | addGCUState (GCUState *state) |
void | addBusState (BusState *state, const std::string &name) |
void | addFUState (FUState *state, const std::string &name) |
void | addPortState (PortState *state, const std::string &name, const std::string &fuName) |
void | addLongImmediateUnitState (LongImmediateUnitState *state, const std::string &name) |
void | addRegisterFileState (RegisterFileState *state, const std::string &name) |
void | addGuardState (GuardState *state, const TTAMachine::Guard &guard) |
void | addOperationExecutor (OperationExecutor *executor) |
bool | isFinished () const |
void | setFinished (bool finished=true) |
Private Types | |
typedef std::map< std::string, BusState * > | BusContainer |
Contains bus states indexed by names. More... | |
typedef std::map< std::string, FUState * > | FUContainer |
Contains function unit states indexed by names. More... | |
typedef std::map< std::string, PortState * > | PortContainer |
Contains port states indexed by names. More... | |
typedef std::map< std::string, LongImmediateUnitState * > | LongImmediateContainer |
Contains long immediate unit states indexed by names. More... | |
typedef std::map< std::string, RegisterFileState * > | RegisterFileContainer |
Contains register file states indexed by names. More... | |
typedef std::map< const TTAMachine::Guard *, GuardState * > | GuardContainer |
Contains guard states indexed by their MOM object. More... | |
typedef std::vector< OperationExecutor * > | ExecutorContainer |
Contains operation executors. More... | |
typedef std::vector< BusState * > | BusCache |
typedef std::vector< FUState * > | FUCache |
typedef std::vector< PortState * > | PortCache |
typedef std::vector< LongImmediateUnitState * > | LongImmediateUnitCache |
typedef std::vector< RegisterFileState * > | RegisterFileCache |
typedef std::vector< GuardState * > | GuardCache |
Private Member Functions | |
MachineState (const MachineState &) | |
Copying not allowed. More... | |
MachineState & | operator= (const MachineState &) |
Assignment not allowed. More... | |
Private Attributes | |
GCUState * | GCUState_ |
GCU state. More... | |
BusContainer | busses_ |
Contains all bus states. More... | |
FUContainer | FUStates_ |
Container of function unit states for fast traversal. More... | |
PortContainer | ports_ |
Contains all port states. More... | |
LongImmediateContainer | longImmediates_ |
Contains all long immediate unit states. More... | |
RegisterFileContainer | registers_ |
Contains all register file states. More... | |
ExecutorContainer | executors_ |
Contains all operation executors. More... | |
GuardContainer | guards_ |
Contains all guard states. More... | |
std::size_t | fuStateCount_ |
Count of FUStates added in MachineState (optimization). More... | |
BusCache | busCache_ |
FUCache | fuCache_ |
PortCache | portCache_ |
LongImmediateUnitCache | longImmediateCache_ |
RegisterFileCache | rfCache_ |
GuardCache | guardCache_ |
bool | finished_ |
Root class of machine state model.
Owns all state classes.
Definition at line 61 of file MachineState.hh.
|
private |
Definition at line 131 of file MachineState.hh.
|
private |
Contains bus states indexed by names.
Definition at line 115 of file MachineState.hh.
|
private |
Contains operation executors.
Definition at line 128 of file MachineState.hh.
|
private |
Definition at line 132 of file MachineState.hh.
|
private |
Contains function unit states indexed by names.
Definition at line 117 of file MachineState.hh.
|
private |
Definition at line 136 of file MachineState.hh.
|
private |
Contains guard states indexed by their MOM object.
Definition at line 126 of file MachineState.hh.
|
private |
Contains long immediate unit states indexed by names.
Definition at line 122 of file MachineState.hh.
|
private |
Definition at line 134 of file MachineState.hh.
|
private |
Definition at line 133 of file MachineState.hh.
|
private |
Contains port states indexed by names.
Definition at line 119 of file MachineState.hh.
|
private |
Definition at line 135 of file MachineState.hh.
|
private |
Contains register file states indexed by names.
Definition at line 124 of file MachineState.hh.
MachineState::MachineState | ( | ) |
Constructor.
Definition at line 61 of file MachineState.cc.
|
virtual |
Destructor.
Definition at line 68 of file MachineState.cc.
References clear().
|
private |
Copying not allowed.
void MachineState::addBusState | ( | BusState * | state, |
const std::string & | name | ||
) |
Adds BusState to machine state.
Definition at line 255 of file MachineState.cc.
References busCache_, and busses_.
Referenced by MachineStateBuilder::buildMachineState().
void MachineState::addFUState | ( | FUState * | state, |
const std::string & | name | ||
) |
Adds FUState.
state | FUState to be added. |
name | The name of the FU in ADF. |
Definition at line 267 of file MachineState.cc.
References fuCache_, and FUStates_.
Referenced by MachineStateBuilder::buildMachineState().
void MachineState::addGCUState | ( | GCUState * | state | ) |
Adds GCUState to machine state.
state | GCUState to be added. |
Definition at line 244 of file MachineState.cc.
References GCUState_.
Referenced by MachineStateBuilder::buildMachineState().
void MachineState::addGuardState | ( | GuardState * | state, |
const TTAMachine::Guard & | guard | ||
) |
Adds GuardState.
state | State to be added. |
guard | The machine object model guard the state represents. |
Definition at line 325 of file MachineState.cc.
References guardCache_, and guards_.
Referenced by MachineStateBuilder::buildMachineState().
void MachineState::addLongImmediateUnitState | ( | LongImmediateUnitState * | state, |
const std::string & | name | ||
) |
Adds LongImmediateUnitState.
state | LongImmediateUnitState to be added. |
name | The name of the state. |
Definition at line 295 of file MachineState.cc.
References longImmediateCache_, and longImmediates_.
Referenced by MachineStateBuilder::buildMachineState().
void MachineState::addOperationExecutor | ( | OperationExecutor * | executor | ) |
Adds operation executor.
executor | Operation executor. |
Definition at line 339 of file MachineState.cc.
References executors_.
Referenced by MachineStateBuilder::addVirtualOpcodeSettingPortsToFU().
void MachineState::addPortState | ( | PortState * | state, |
const std::string & | name, | ||
const std::string & | fuName | ||
) |
Adds PortState.
state | PortState to be added. |
name | Name of the port in ADF. |
fuName | Name of the FU of the port in ADF. |
Definition at line 280 of file MachineState.cc.
References portCache_, ports_, and StringTools::stringToLower().
Referenced by MachineStateBuilder::addPortToFU(), and MachineStateBuilder::addVirtualOpcodeSettingPortsToFU().
void MachineState::addRegisterFileState | ( | RegisterFileState * | state, |
const std::string & | name | ||
) |
Adds RegisterFileState.
state | State to be added. |
name | Name of the state. |
Definition at line 310 of file MachineState.cc.
References registers_, and rfCache_.
Referenced by MachineStateBuilder::buildMachineState().
void MachineState::advanceClockOfAllFUStates | ( | ) |
Referenced by OTASimulationController::advanceMachineCycle(), and SimulationController::simulateCycle().
void MachineState::advanceClockOfAllGuardStates | ( | ) |
Referenced by OTASimulationController::advanceMachineCycle(), and SimulationController::simulateCycle().
void MachineState::advanceClockOfAllLongImmediateUnitStates | ( | ) |
Referenced by SimulationController::simulateCycle().
BusState & MachineState::busState | ( | const std::string & | name | ) |
Returns bus state with a given name.
If bus state with a given name is not found, return NullBusState.
name | Name of the bus state. |
Definition at line 116 of file MachineState.cc.
References busses_, and NullBusState::instance().
Referenced by ProximBusDetailsCmd::Do(), InfoSegmentsCommand::execute(), BusTracker::handleEvent(), and SimProgramBuilder::processMove().
void MachineState::clear | ( | ) |
Reserved memory is freed, containers are emptied.
Definition at line 76 of file MachineState.cc.
References busCache_, busses_, SequenceTools::deleteAllItems(), MapTools::deleteAllValues(), executors_, fuCache_, FUStates_, GCUState_, guardCache_, guards_, longImmediateCache_, longImmediates_, portCache_, ports_, registers_, and rfCache_.
Referenced by ~MachineState().
void MachineState::clearBuses | ( | ) |
Referenced by OTASimulationController::simulateCycle(), and SimulationController::simulateCycle().
void MachineState::endClockOfAllFUStates | ( | ) |
Referenced by OTASimulationController::advanceMachineCycle(), and SimulationController::simulateCycle().
FUState & MachineState::fuState | ( | const std::string & | name | ) |
Returns the FUState with a given name.
If FUState is not found, returns NullFUState.
name | Name of the FUState. |
Definition at line 133 of file MachineState.cc.
References FUStates_, and NullFUState::instance().
Referenced by FUTestbenchGenerator::createStimulus(), SimpleSimulatorFrontend::setOperationSimulator(), and SimulationController::SimulationController().
FUState & MachineState::fuState | ( | int | index | ) |
Returns the FUState with a given index.
index | The index of the FUState. |
OutOfRange | If index is out of range. |
Definition at line 149 of file MachineState.cc.
References __func__, FUStateCount(), and FUStates_.
int MachineState::FUStateCount | ( | ) | const |
Referenced by fuState(), and SimulationController::SimulationController().
GCUState & MachineState::gcuState | ( | ) |
Returns the GCUState of the machine state.
Definition at line 103 of file MachineState.cc.
References GCUState_.
Referenced by OTASimulationController::advanceMachineCycle(), OTASimulationController::simulateCycle(), and SimulationController::simulateCycle().
GuardState & MachineState::guardState | ( | const TTAMachine::Guard & | guard | ) |
Returns the GuardState associated with the given MOM Guard.
If not found, returns NullGuardState::instace().
name | The MOM Guard instance. |
Definition at line 230 of file MachineState.cc.
References guards_, and NullGuardState::instance().
Referenced by SimProgramBuilder::findGuardModel().
|
inline |
Definition at line 105 of file MachineState.hh.
References finished_.
Referenced by SimulationController::simulateCycle().
LongImmediateUnitState & MachineState::longImmediateUnitState | ( | const std::string & | name | ) |
Returns LongImmediateUnitState with a given name.
If LongImmediateUnitState is not found, returns NullLongImmediateUnistState.
name | The name of the LongImmediateUnitState. |
Definition at line 196 of file MachineState.cc.
References NullLongImmediateUnitState::instance(), and longImmediates_.
Referenced by ProximIUDetailsCmd::Do(), ProximRegisterWindow::loadImmediateUnit(), SimProgramBuilder::processInstruction(), and SimProgramBuilder::processSourceTerminal().
|
private |
Assignment not allowed.
PortState & MachineState::portState | ( | const std::string & | portName, |
const std::string & | fuName | ||
) |
Returns PortState with a given name.
If PortState is not found, return NullPortState.
portName | The name of the PortState. |
fuName | The name of the parent FU of the port. |
Definition at line 175 of file MachineState.cc.
References NullPortState::instance(), ports_, and StringTools::stringToLower().
Referenced by MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), MachineStateBuilder::bindPortsToOperands(), MachineStateBuilder::buildMachineState(), ProximFUPortDetailsCmd::Do(), ProximFUDetailsCmd::Do(), SimulatorFrontend::findPort(), FUTestbenchGenerator::parseFuPorts(), SimProgramBuilder::processBidirTerminal(), FUTestbenchGenerator::readValuesFromOutPorts(), ProximPortWindow::update(), and FUTestbenchGenerator::writeInputPortStimulus().
RegisterFileState & MachineState::registerFileState | ( | const std::string & | name | ) |
Returns RegisterFileState with a given name.
If RegisterFileState is not found, return NullRegisterFileState.
name | The name of the state. |
Definition at line 213 of file MachineState.cc.
References NullRegisterFileState::instance(), and registers_.
Referenced by MachineStateBuilder::buildMachineState(), RFTestbenchGenerator::createStimulus(), ProximRFDetailsCmd::Do(), SimulatorFrontend::findBooleanRegister(), SimulatorFrontend::findRegister(), ProximRegisterWindow::loadRegisterFile(), and SimProgramBuilder::processBidirTerminal().
void MachineState::resetAllFUs | ( | ) |
|
inline |
Definition at line 106 of file MachineState.hh.
References finished_.
Referenced by OTASimulationController::simulateCycle(), and SimulationController::simulateCycle().
|
private |
Definition at line 158 of file MachineState.hh.
Referenced by addBusState(), and clear().
|
private |
Contains all bus states.
Definition at line 141 of file MachineState.hh.
Referenced by addBusState(), busState(), and clear().
|
private |
Contains all operation executors.
Definition at line 151 of file MachineState.hh.
Referenced by addOperationExecutor(), and clear().
|
private |
Definition at line 167 of file MachineState.hh.
Referenced by isFinished(), and setFinished().
|
private |
Definition at line 159 of file MachineState.hh.
Referenced by addFUState(), and clear().
|
private |
Count of FUStates added in MachineState (optimization).
Definition at line 155 of file MachineState.hh.
|
private |
Container of function unit states for fast traversal.
Definition at line 143 of file MachineState.hh.
Referenced by addFUState(), clear(), and fuState().
|
private |
GCU state.
Definition at line 139 of file MachineState.hh.
Referenced by addGCUState(), clear(), and gcuState().
|
private |
Definition at line 163 of file MachineState.hh.
Referenced by addGuardState(), and clear().
|
private |
Contains all guard states.
Definition at line 153 of file MachineState.hh.
Referenced by addGuardState(), clear(), and guardState().
|
private |
Definition at line 161 of file MachineState.hh.
Referenced by addLongImmediateUnitState(), and clear().
|
private |
Contains all long immediate unit states.
Definition at line 147 of file MachineState.hh.
Referenced by addLongImmediateUnitState(), clear(), and longImmediateUnitState().
|
private |
Definition at line 160 of file MachineState.hh.
Referenced by addPortState(), and clear().
|
private |
Contains all port states.
Definition at line 145 of file MachineState.hh.
Referenced by addPortState(), clear(), and portState().
|
private |
Contains all register file states.
Definition at line 149 of file MachineState.hh.
Referenced by addRegisterFileState(), clear(), and registerFileState().
|
private |
Definition at line 162 of file MachineState.hh.
Referenced by addRegisterFileState(), and clear().