OpenASIP
2.0
|
#include <ControlUnit.hh>
Public Member Functions | |
ControlUnit (const std::string &name, int delaySlots, int globalGuardLatency) | |
ControlUnit (const ObjectState *state) | |
virtual | ~ControlUnit () |
virtual ControlUnit * | copy () const |
virtual void | setMachine (Machine &mach) |
virtual void | unsetMachine () |
int | delaySlots () const |
void | setDelaySlots (int delaySlots) |
int | globalGuardLatency () const |
void | setGlobalGuardLatency (int latency) |
int | specialRegisterPortCount () const |
bool | hasSpecialRegisterPort (const std::string &name) const |
SpecialRegisterPort * | specialRegisterPort (int index) const |
SpecialRegisterPort * | specialRegisterPort (const std::string &name) const |
void | setReturnAddressPort (const SpecialRegisterPort &port) |
void | unsetReturnAddressPort () |
bool | hasReturnAddressPort () const |
SpecialRegisterPort * | returnAddressPort () const |
virtual ObjectState * | saveState () const |
virtual void | loadState (const ObjectState *state) |
Public Member Functions inherited from TTAMachine::FunctionUnit | |
FunctionUnit (const std::string &name) | |
FunctionUnit (const ObjectState *state) | |
virtual | ~FunctionUnit () |
virtual void | setName (const std::string &name) |
virtual BaseFUPort * | port (const std::string &name) const |
virtual BaseFUPort * | port (int index) const |
virtual int | operationPortCount () const |
virtual bool | hasOperationPort (const std::string &name) const |
virtual FUPort * | operationPort (const std::string &name) const |
virtual FUPort * | operationPort (int index) const |
virtual BaseFUPort * | triggerPort () const |
virtual void | addOperation (HWOperation &operation) |
virtual void | deleteOperation (HWOperation &operation) |
virtual bool | hasOperation (const std::string &name) const |
virtual bool | hasOperationLowercase (const std::string &name) const |
virtual HWOperation * | operation (const std::string &name) const |
virtual HWOperation * | operationLowercase (const std::string &name) const |
virtual HWOperation * | operation (int index) const |
virtual int | operationCount () const |
virtual void | operationNames (TCETools::CIStringSet &opNames) const |
virtual int | maxLatency () const |
virtual void | addPipelineElement (PipelineElement &element) |
virtual void | deletePipelineElement (PipelineElement &element) |
virtual int | pipelineElementCount () const |
virtual PipelineElement * | pipelineElement (int index) const |
virtual bool | hasPipelineElement (const std::string &name) const |
virtual PipelineElement * | pipelineElement (const std::string &name) const |
virtual AddressSpace * | addressSpace () const |
virtual void | setAddressSpace (AddressSpace *as) |
virtual bool | hasAddressSpace () const |
virtual void | cleanup (const std::string &resource) |
virtual bool | isArchitectureEqual (const FunctionUnit *fu, const bool checkPortWidths=true) const |
bool | needsConflictDetection () const |
virtual int | orderNumber () const |
virtual void | setOrderNumber (int) |
Public Member Functions inherited from TTAMachine::Unit | |
virtual | ~Unit () |
virtual bool | hasPort (const std::string &name) const |
virtual int | portCount () const |
virtual int | outputPortCount (bool countBidir=false) const |
virtual int | inputPortCount (bool countBidir=false) const |
virtual int | bidirPortCount () const |
Public Member Functions inherited from TTAMachine::Component | |
virtual | ~Component () |
virtual TCEString | name () const |
virtual Machine * | machine () const |
virtual void | ensureRegistration (const Component &component) const |
virtual bool | isRegistered () const |
Public Member Functions inherited from Serializable | |
virtual | ~Serializable () |
Static Public Attributes | |
static const std::string | OSNAME_CONTROL_UNIT = "control_unit" |
ObjectState name for ControlUnit. More... | |
static const std::string | OSKEY_DELAY_SLOTS = "d_slots" |
ObjectState attribute key for the number of delay slots. More... | |
static const std::string | OSKEY_GUARD_LATENCY = "g_latency" |
ObjectState attribute key for the global guard latency. More... | |
static const std::string | OSKEY_RA_PORT = "ra_port" |
ObjectState attribute key for the name of the return address port. More... | |
Static Public Attributes inherited from TTAMachine::FunctionUnit | |
static const std::string | OSNAME_FU = "fu" |
ObjectState name for function unit. More... | |
static const std::string | OSKEY_AS = "as" |
ObjectState attribute key for name of the address space. More... | |
static const std::string | OSKEY_ORDER_NUMBER = "order_no" |
ObjectState attribute key for FU order number name. More... | |
Static Public Attributes inherited from TTAMachine::Unit | |
static const std::string | OSNAME_UNIT = "unit" |
ObjectState name for Unit. More... | |
Static Public Attributes inherited from TTAMachine::Component | |
static const std::string | OSNAME_COMPONENT = "component" |
ObjectState name for component. More... | |
static const std::string | OSKEY_NAME = "name" |
ObjectState attribute key for the name of the component. More... | |
Protected Member Functions | |
virtual void | removePort (Port &port) |
Protected Member Functions inherited from TTAMachine::FunctionUnit | |
void | unsetMachineDerived () |
Protected Member Functions inherited from TTAMachine::Unit | |
Unit (const std::string &name) | |
Unit (const ObjectState *state) | |
Protected Member Functions inherited from TTAMachine::Component | |
Component (const std::string &name) | |
Component (const ObjectState *state) | |
void | internalSetMachine (Machine &machine) |
void | internalUnsetMachine () |
Protected Member Functions inherited from TTAMachine::MachinePart | |
MachinePart () | |
virtual | ~MachinePart () |
Private Member Functions | |
void | loadStateWithoutReferences (const ObjectState *state) |
Static Private Member Functions | |
static bool | hasLocalGuardLatencyOfZero (const Machine &machine) |
Private Attributes | |
int | delaySlots_ |
Number of delay instruction slots on the transport pipeline. More... | |
int | globalGuardLatency_ |
The global guard latency. More... | |
SpecialRegisterPort * | raPort_ |
The return address port. More... | |
Represents the global control unit in the machine.
Definition at line 50 of file ControlUnit.hh.
TTAMachine::ControlUnit::ControlUnit | ( | const std::string & | name, |
int | delaySlots, | ||
int | globalGuardLatency | ||
) |
Constructor.
name | Name of the control unit. |
delaySlots | Number of delay instruction slots of the transport pipeline. |
globalGuardLatency | The global guard latency. |
OutOfRange | If some of the given values is out of valid range. |
InvalidName | If the given name is not a valid component name. |
Definition at line 61 of file ControlUnit.cc.
References delaySlots(), globalGuardLatency(), setDelaySlots(), and setGlobalGuardLatency().
Referenced by copy().
TTAMachine::ControlUnit::ControlUnit | ( | const ObjectState * | state | ) |
Constructor.
Loads the state of the control unit from the given ObjectState instance. Does not load references to other components.
state | The ObjectState instance from which the name is taken. |
ObjectStateLoadingException | If the given ObjectState instance is invalid. |
Definition at line 81 of file ControlUnit.cc.
References loadStateWithoutReferences().
|
virtual |
Destructor.
Definition at line 92 of file ControlUnit.cc.
References unsetMachine().
|
virtual |
Copies the instance.
Current FunctionUnit state is copied to a new FunctionUnit object.
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 105 of file ControlUnit.cc.
References ControlUnit(), and saveState().
Referenced by ADFCombiner::addFunctionUnits().
int TTAMachine::ControlUnit::delaySlots | ( | ) | const |
Referenced by MachineStateBuilder::buildMachineState(), ControlUnit(), ProcedurePass::copyCfgToProcedure(), BasicBlockPass::copyRMToBB(), BasicBlockPass::executeDDGPass(), CopyingDelaySlotFiller::fillDelaySlots(), CompiledSimCodeGenerator::findBasicBlocks(), ControlFlowGraph::findNextIndex(), TTASimulationController::findProgramExitPoints(), ControlFlowGraph::findRelJumpDistance(), ProGe::ProGeUI::generateIDF(), BF2ScheduleFront::getPreferredLimits(), ProcedureTransferTracker::handleEvent(), CompiledSimCodeGenerator::handleJump(), CopyingDelaySlotFiller::initialize(), ScheduleEstimator::maximumSizeOfBB(), BasicBlockScheduler::scheduleMove(), BUBasicBlockScheduler::scheduleMove(), setDelaySlots(), DataDependenceGraph::setMachine(), SimpleIfConverter::SimpleIfConverter(), and DefaultDecoderGenerator::verifyCompatibility().
int TTAMachine::ControlUnit::globalGuardLatency | ( | ) | const |
Referenced by MachineStateBuilder::buildMachineState(), CompiledSimCodeGenerator::CompiledSimCodeGenerator(), ControlUnit(), TTAProgram::Move::guardLatency(), BFOptimization::jumpGuardAvailableCycle(), SimulatorFrontend::loadMachine(), TTAMachine::RegisterGuard::loadState(), MachineInfo::longestGuardLatency(), CompiledSimCodeGenerator::maxLatency(), TTAMachine::RegisterGuard::RegisterGuard(), SequentialScheduler::scheduleMove(), TTAMachine::RegisterFile::setGuardLatency(), setMachine(), and DefaultDecoderGenerator::verifyCompatibility().
|
staticprivate |
Tells whether the given machine has a guard that reads a register with local guard latency of zero.
machine | The machine. |
Definition at line 411 of file ControlUnit.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::RegisterFile::guardLatency(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), and TTAMachine::RegisterGuard::registerFile().
Referenced by setGlobalGuardLatency(), and setMachine().
bool TTAMachine::ControlUnit::hasReturnAddressPort | ( | ) | const |
Tells whether the control unit has a return address port.
Definition at line 295 of file ControlUnit.cc.
References raPort_.
Referenced by DefaultICGenerator::addICToNetlist(), MachineStateBuilder::buildMachineState(), MachineValidator::checkIMemAddrWidth(), MachineValidator::checkRAPortHasSameWidthAsPCPort(), MachineValidator::checkReturnAddressPort(), TTAProgram::TPEFProgramFactory::findPort(), TTAProgram::TPEFResourceUpdater::functionUnitPort(), ProGe::ProcessorGenerator::iMemAddressWidth(), saveState(), and DefaultDecoderGenerator::writeControlRegisterMappings().
bool TTAMachine::ControlUnit::hasSpecialRegisterPort | ( | const std::string & | name | ) | const |
Tells whether the control unit has a special register port of the given name.
Definition at line 197 of file ControlUnit.cc.
References TTAMachine::FunctionUnit::hasOperationPort(), TTAMachine::Unit::hasPort(), and TTAMachine::Component::name().
|
virtual |
Loads its state from the given ObjectState instance.
state | The ObjectState instance. |
ObjectStateLoadingException | If the given ObjectState instance invalid or if connections to other machine parts cannot be made. |
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 351 of file ControlUnit.cc.
References TTAMachine::FunctionUnit::loadState(), and loadStateWithoutReferences().
Referenced by TTAMachine::Machine::loadState().
|
private |
Loads the state of the control unit without references to other components.
state | The ObjectState instance from which the state is loaded. |
ObjectStateLoadingException | If an error occurs while loading the state. |
Definition at line 380 of file ControlUnit.cc.
References Exception::errorMessage(), ObjectState::hasAttribute(), ObjectState::intAttribute(), ObjectState::name(), OSKEY_DELAY_SLOTS, OSKEY_GUARD_LATENCY, OSKEY_RA_PORT, OSNAME_CONTROL_UNIT, setDelaySlots(), setGlobalGuardLatency(), setReturnAddressPort(), specialRegisterPort(), ObjectState::stringAttribute(), and unsetReturnAddressPort().
Referenced by ControlUnit(), and loadState().
|
protectedvirtual |
Removes the given port from the control unit and unsets the binding of return address port if necessary.
port | The port to be removed. |
Reimplemented from TTAMachine::Unit.
Definition at line 363 of file ControlUnit.cc.
References TTAMachine::FunctionUnit::port(), raPort_, TTAMachine::Unit::removePort(), and unsetReturnAddressPort().
SpecialRegisterPort * TTAMachine::ControlUnit::returnAddressPort | ( | ) | const |
Returns the return address port.
InstanceNotFound | If there is no return address port. |
Definition at line 307 of file ControlUnit.cc.
References raPort_.
Referenced by RegisterCopyAdder::addConnectionRegisterCopies(), ProGe::NetlistGenerator::addGCUToNetlist(), DefaultICGenerator::addICToNetlist(), ProGe::RV32MicroCodeGenerator::addIPorts(), ProGe::RV32MicroCodeGenerator::addUJPorts(), OutputFUBroker::assign(), InputFUBroker::assign(), MachineStateBuilder::buildMachineState(), MachineConnectivityCheck::busConnectedToDestination(), MachineValidator::checkIMemAddrWidth(), MachineValidator::checkRAPortHasSameWidthAsPCPort(), DefaultDecoderGenerator::completeDecoderBlock(), TTAProgram::CodeGenerator::createTerminalFUPort(), TTAProgram::TPEFProgramFactory::findPort(), MachineConnectivityCheck::findPossibleDestinationPorts(), MachineConnectivityCheck::findPossibleSourcePorts(), TTAProgram::TPEFResourceUpdater::functionUnitPort(), CallsToJumps::handleControlFlowGraph(), ProGe::ProcessorGenerator::iMemAddressWidth(), MachineConnectivityCheck::raConnected(), ProGe::ProGeUI::readImemParameters(), CompiledSimSymbolGenerator::returnAddressSymbol(), saveState(), SimulatorFrontend::state(), and DefaultDecoderGenerator::writeControlRegisterMappings().
|
virtual |
Saves the contents to an ObjectState tree.
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 322 of file ControlUnit.cc.
References delaySlots_, globalGuardLatency_, hasReturnAddressPort(), TTAMachine::Component::name(), OSKEY_DELAY_SLOTS, OSKEY_GUARD_LATENCY, OSKEY_RA_PORT, OSNAME_CONTROL_UNIT, returnAddressPort(), TTAMachine::FunctionUnit::saveState(), ObjectState::setAttribute(), and ObjectState::setName().
Referenced by copy(), and TTAMachine::Machine::saveState().
void TTAMachine::ControlUnit::setDelaySlots | ( | int | delaySlots | ) |
Definition at line 145 of file ControlUnit.cc.
References __func__, delaySlots(), and delaySlots_.
Referenced by ControlUnit(), and loadStateWithoutReferences().
void TTAMachine::ControlUnit::setGlobalGuardLatency | ( | int | latency | ) |
Sets the global guard latency.
latency | The new latency. |
OutOfRange | If the given latency is negative. |
Definition at line 159 of file ControlUnit.cc.
References __func__, globalGuardLatency_, hasLocalGuardLatencyOfZero(), TTAMachine::Component::isRegistered(), TTAMachine::Component::machine(), Texts::TextGenerator::text(), and MOMTextGenerator::TXT_INVALID_GUARD_LATENCY.
Referenced by ControlUnit(), loadStateWithoutReferences(), TTAMachine::RegisterFile::setGuardLatency(), and setMachine().
|
virtual |
Attaches the control unit to machine.
mach | The machine. |
ComponentAlreadyExists | If the given machine already has a global control unit. |
Reimplemented from TTAMachine::Unit.
Definition at line 119 of file ControlUnit.cc.
References globalGuardLatency(), hasLocalGuardLatencyOfZero(), TTAMachine::Component::internalSetMachine(), TTAMachine::Machine::setGlobalControl(), and setGlobalGuardLatency().
Referenced by AddGCUCmd::Do(), PasteComponentCmd::Do(), and TTAMachine::Machine::setGlobalControl().
void TTAMachine::ControlUnit::setReturnAddressPort | ( | const SpecialRegisterPort & | port | ) |
Binds the given port to return address port.
If there is another port bound to return address port already, unbinds it.
port | The port to be bound. |
IllegalRegistration | If the given port is not a port of this control unit. |
Definition at line 271 of file ControlUnit.cc.
References TTAMachine::BaseFUPort::parentUnit(), TTAMachine::FunctionUnit::port(), and raPort_.
Referenced by UniversalMachine::construct(), AddGCUCmd::Do(), CostEstimator::ICDecoderEstimatorPlugin::generateControlUnit(), and loadStateWithoutReferences().
SpecialRegisterPort * TTAMachine::ControlUnit::specialRegisterPort | ( | const std::string & | name | ) | const |
Returns a special register port by the given name.
name | Name of the port. |
InstanceNotFound | If a special register port does not exist by the given name. |
Definition at line 245 of file ControlUnit.cc.
References TTAMachine::Unit::hasPort(), TTAMachine::Component::name(), and TTAMachine::FunctionUnit::port().
SpecialRegisterPort * TTAMachine::ControlUnit::specialRegisterPort | ( | int | index | ) | const |
Returns a special register port by the given index.
index | The index. |
OutOfRange | If the given index is less than 0 or greater or equal to the number of special register ports. |
Definition at line 211 of file ControlUnit.cc.
References TTAMachine::FunctionUnit::port(), and TTAMachine::Unit::portCount().
Referenced by FullyConnectedCheck::check(), FullyConnectedCheck::connectControlUnit(), GCUFactory::createEditPart(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), and loadStateWithoutReferences().
int TTAMachine::ControlUnit::specialRegisterPortCount | ( | ) | const |
Returns the number of special register ports in the control unit.
Definition at line 185 of file ControlUnit.cc.
References TTAMachine::FunctionUnit::operationPortCount(), and TTAMachine::Unit::portCount().
Referenced by FullyConnectedCheck::check(), FullyConnectedCheck::connectControlUnit(), GCUFactory::createEditPart(), and CompiledSimCodeGenerator::generateHeaderAndMainCode().
|
virtual |
Detaches the control unit from machine.
Reimplemented from TTAMachine::FunctionUnit.
Definition at line 134 of file ControlUnit.cc.
References TTAMachine::Component::isRegistered(), TTAMachine::Component::machine(), TTAMachine::Machine::unsetGlobalControl(), and TTAMachine::FunctionUnit::unsetMachineDerived().
Referenced by TTAMachine::Machine::unsetGlobalControl(), and ~ControlUnit().
void TTAMachine::ControlUnit::unsetReturnAddressPort | ( | ) |
Unbinds the return address port if one exists.
Definition at line 284 of file ControlUnit.cc.
References raPort_.
Referenced by loadStateWithoutReferences(), and removePort().
|
private |
Number of delay instruction slots on the transport pipeline.
Definition at line 98 of file ControlUnit.hh.
Referenced by saveState(), and setDelaySlots().
|
private |
The global guard latency.
Definition at line 101 of file ControlUnit.hh.
Referenced by saveState(), and setGlobalGuardLatency().
|
static |
ObjectState attribute key for the number of delay slots.
Definition at line 84 of file ControlUnit.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute key for the global guard latency.
Definition at line 86 of file ControlUnit.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute key for the name of the return address port.
Definition at line 88 of file ControlUnit.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState name for ControlUnit.
Definition at line 82 of file ControlUnit.hh.
Referenced by TTAMachine::Machine::loadState(), loadStateWithoutReferences(), and saveState().
|
private |
The return address port.
Definition at line 103 of file ControlUnit.hh.
Referenced by hasReturnAddressPort(), removePort(), returnAddressPort(), setReturnAddressPort(), and unsetReturnAddressPort().