OpenASIP
2.0
|
#include <Unit.hh>
Public Member Functions | |
virtual | ~Unit () |
virtual bool | hasPort (const std::string &name) const |
virtual Port * | port (const std::string &name) const |
virtual Port * | port (int index) const |
virtual int | portCount () const |
virtual int | outputPortCount (bool countBidir=false) const |
virtual int | inputPortCount (bool countBidir=false) const |
virtual int | bidirPortCount () const |
virtual void | setMachine (Machine &mach) |
virtual void | unsetMachine () |
virtual ObjectState * | saveState () const |
virtual void | loadState (const ObjectState *state) |
Public Member Functions inherited from TTAMachine::Component | |
virtual | ~Component () |
virtual TCEString | name () const |
virtual void | setName (const std::string &name) |
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_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 | |
Unit (const std::string &name) | |
Unit (const ObjectState *state) | |
virtual void | removePort (Port &port) |
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 Types | |
typedef std::vector< Port * > | PortTable |
Container for ports. More... | |
typedef std::set< std::string > | NameSet |
Set type for strings. More... | |
Private Member Functions | |
Unit (const Unit &) | |
Copying forbidden. More... | |
Unit & | operator= (const Unit &) |
Assingment forbidden. More... | |
void | addPort (Port &port) |
void | deleteAllPorts () |
void | deleteOtherPorts (const NameSet &portsToLeave) |
void | loadStateWithoutReferences (const ObjectState *state) |
Static Private Member Functions | |
static NameSet | portNames (const ObjectState *state) |
Private Attributes | |
PortTable | ports_ |
Contains all the ports of the unit. More... | |
Friends | |
class | Port |
An Abstract base class for the different units in the machine.
|
private |
|
private |
|
virtual |
Destructor.
Definition at line 84 of file Unit.cc.
References deleteAllPorts().
|
protected |
Constructor.
name | The name of the unit. |
InvalidName | If the given name is not a valid component name. |
|
protected |
Constructor.
Loads the state of the unit from the given ObjectState instance. Does not load connections to other components.
state | The ObjectState instance from which the name is taken. |
ObjectStateLoadingException | If the given ObjectState instance is invalid. |
Definition at line 71 of file Unit.cc.
References deleteAllPorts(), and loadStateWithoutReferences().
|
private |
Copying forbidden.
|
private |
Adds a port to the unit.
This method can be called from Port constructor only.
port | Port to be added. |
ComponentAlreadyExists | If another port with the same name exists. |
Definition at line 213 of file Unit.cc.
References assert, hasPort(), TTAMachine::Port::name(), TTAMachine::Port::parentUnit(), port(), and ports_.
Referenced by TTAMachine::Port::Port().
|
virtual |
Definition at line 174 of file Unit.cc.
References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), port(), and ports_.
Referenced by Automagic::checkForSelectableRF(), and ProGeTools::checkForSelectableRF().
|
private |
|
private |
Deletes all the ports which has a name that does not appear in the given name set.
portsToLeave | A set of names of ports to leave. |
Definition at line 389 of file Unit.cc.
References AssocTools::containsKey(), TTAMachine::Port::name(), port(), and portCount().
Referenced by loadStateWithoutReferences().
|
virtual |
Returns true if the requested port is found, otherwise false.
name | Name of the port. |
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 96 of file Unit.cc.
References TTAMachine::Component::name(), and ports_.
Referenced by addPort(), TTAProgram::TPEFProgramFactory::findGuard(), TTAProgram::TPEFProgramFactory::findPort(), MachineResourceManager::functionUnitPortResource(), TTAMachine::FunctionUnit::hasOperationPort(), TTAMachine::ControlUnit::hasSpecialRegisterPort(), TTAProgram::TPEFResourceUpdater::initCache(), loadStateWithoutReferences(), TTAMachine::FunctionUnit::port(), and TTAMachine::ControlUnit::specialRegisterPort().
|
virtual |
countBidir | True if we should count bidirectional ports |
Definition at line 160 of file Unit.cc.
References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), port(), and ports_.
Referenced by Automagic::checkForSelectableRF(), ProGeTools::checkForSelectableRF(), and ProGe::RV32MicroCodeGenerator::findRF().
|
virtual |
Loads the state of the unit from the given ObjectState instance.
state | The ObjectState instance. |
ObjectStateLoadingException | If the given ObjectState instance is invalid or if references to sockets cannot be made. |
Reimplemented from TTAMachine::Component.
Reimplemented in TTAMachine::FunctionUnit, TTAMachine::RegisterFile, TTAMachine::NullRegisterFile, TTAMachine::ControlUnit, TTAMachine::ImmediateUnit, TTAMachine::BaseRegisterFile, UnboundedRegisterFile, and UniversalFunctionUnit.
Definition at line 309 of file Unit.cc.
References ObjectState::child(), ObjectState::childCount(), TTAMachine::Port::loadState(), loadStateWithoutReferences(), ObjectState::name(), TTAMachine::Port::OSKEY_NAME, TTAMachine::FUPort::OSNAME_FUPORT, TTAMachine::RFPort::OSNAME_RFPORT, TTAMachine::SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT, port(), and ObjectState::stringAttribute().
Referenced by TTAMachine::BaseRegisterFile::loadState(), and TTAMachine::FunctionUnit::loadState().
|
private |
Loads its state from the given ObjectState instance without references to other components.
state | The ObjectState instance. |
ObjectStateLoadingException | If the given ObjectState instance is invalid. |
Definition at line 334 of file Unit.cc.
References ObjectState::child(), ObjectState::childCount(), deleteOtherPorts(), Exception::errorMessage(), hasPort(), ObjectState::name(), TTAMachine::Port::OSKEY_NAME, TTAMachine::FUPort::OSNAME_FUPORT, TTAMachine::RFPort::OSNAME_RFPORT, TTAMachine::SpecialRegisterPort::OSNAME_SPECIAL_REG_PORT, portNames(), and ObjectState::stringAttribute().
Referenced by loadState(), and Unit().
|
virtual |
countBidir | True if we should count bidirectional ports |
Definition at line 145 of file Unit.cc.
References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), port(), and ports_.
Referenced by Automagic::checkForSelectableRF(), ProGeTools::checkForSelectableRF(), ProGe::RV32MicroCodeGenerator::findRF(), and DefaultDecoderGenerator::verifyCompatibility().
|
virtual |
Returns the requested port.
name | Name of the port. |
InstanceNotFound | If a port is not found by the given name. |
Reimplemented in TTAMachine::FunctionUnit, and TTAMachine::BaseRegisterFile.
Definition at line 116 of file Unit.cc.
References TTAMachine::Component::name(), and ports_.
Referenced by addPort(), MachineConnectivityCheck::appendConnectedDestinationBuses(), MachineConnectivityCheck::appendConnectedSourceBuses(), bidirPortCount(), MachineConnectivityCheck::busConnectedToRF(), ADFCombiner::connectPorts(), deleteOtherPorts(), MachineConnectivityCheck::findReadPorts(), MachineConnectivityCheck::findWritePorts(), inputPortCount(), loadState(), RFPortDialog::onOK(), IUPortDialog::onOK(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), outputPortCount(), TTAMachine::BaseRegisterFile::port(), TTAMachine::FunctionUnit::port(), removePort(), saveState(), TTAMachine::Port::setName(), and unsetMachine().
|
virtual |
Returns a port by the given index.
The index must be greater or equal to 0 and smaller than the number of ports in the unit.
index | Index. |
OutOfRange | If the given index is out of range. |
Reimplemented in TTAMachine::FunctionUnit, and TTAMachine::BaseRegisterFile.
Definition at line 195 of file Unit.cc.
References portCount(), and ports_.
|
virtual |
Returns the number of ports in the unit.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 135 of file Unit.cc.
References ports_.
Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), RegisterCopyAdder::addConnectionRegisterCopies(), RegisterCopyAdder::addConnectionRegisterCopiesImmediate(), ProGe::NetlistGenerator::addGCUToNetlist(), ProGe::NetlistGenerator::addGeneratableFUsToNetlist(), DefaultDecoderGenerator::addGlockPortToDecoder(), DefaultDecoderGenerator::addLockReqPortToDecoder(), MachineStateBuilder::addVirtualOpcodeSettingPortsToFU(), InputPSocketBroker::allAvailableResources(), OutputPSocketBroker::allAvailableResources(), TDGen::analyzeMachineRegisters(), TDGen::analyzeRegisters(), MachineConnectivityCheck::appendConnectedDestinationBuses(), MachineConnectivityCheck::appendConnectedSourceBuses(), CostDatabase::buildFunctionUnits(), MachineStateBuilder::buildMachineState(), MachineConnectivityCheck::busConnectedToRF(), MachineTester::canConnect(), RFPortCheck::check(), FullyConnectedCheck::check(), SimulatorFrontend::compareState(), DefaultDecoderGenerator::completeDecoderBlock(), ADFCombiner::connectPorts(), ProGe::RV32MicroCodeGenerator::connectRF(), ADFCombiner::copyGuards(), RegisterCopyAdder::countAndAddConnectionRegisterCopiesToRR(), FUFactory::createEditPart(), RFFactory::createEditPart(), IUFactory::createEditPart(), ADFCombiner::createPortsAndSockets(), TTAProgram::CodeGenerator::createTerminalRegister(), llvm::LLVMTCEBuilder::createTerminalRegister(), deleteOtherPorts(), AddFUImplementationCmd::Do(), ProximFUDetailsCmd::Do(), llvm::LLVMTCEBuilder::emitMove(), llvm::LLVMTCEBuilder::emitSPInitialization(), UniversalFunctionUnit::ensureInputPorts(), InfoPortsCommand::execute(), ProgrammabilityValidator::findConnections(), MachineConnectivityCheck::findPossibleSourcePorts(), MachineConnectivityCheck::findReadPorts(), ProgramOperation::findTriggerFromUnit(), BasicBlockScheduler::findTriggerFromUnit(), MachineConnectivityCheck::findWritePorts(), TTAMachine::RegisterFile::firstReadPort(), TTAMachine::RegisterFile::firstWritePort(), FullyConnectedCheck::fix(), MachineConnectivityCheck::fromRfConnected(), HDBToHtml::fuArchToHtml(), CompiledSimCodeGenerator::fuOutputPorts(), TTAMachine::FUPort::FUPort(), DefaultDecoderGenerator::glockPortWidth(), DefaultDecoderGenerator::glockRequestWidth(), MachineConnectivityCheck::immBits(), OutputPSocketBroker::isAnyResourceAvailable(), TTAMachine::RegisterFile::isArchitectureEqual(), ExecutionPipelineResource::isAvailable(), MachineConnectivityCheck::isConnected(), DefaultICGenerator::isGcuPort(), ComponentImplementationSelector::iuImplementations(), TTAMachine::FUPort::loadStateWithoutReferences(), MachineAnalysis::MachineAnalysis(), AddFUFromHDBDialog::onAdd(), AddWatchDialog::onFUChoice(), FUGuardDialog::onFUChoice(), BlockImplementationDialog::onHDBSelection(), RFPortDialog::onOK(), IUPortDialog::onOK(), FUArchitectureDialog::onOK(), SRPortDialog::onOK(), FUPortDialog::onOK(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::FunctionUnit::operationPortCount(), port(), UniversalFunctionUnit::portWithWidth(), MachineResourceManager::registerFileIndexReference(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), MachineResourceManager::rFPortOrFUIndexReference(), saveState(), TTAMachine::Port::setName(), TTAMachine::FUPort::setTriggering(), ExecutionPipelineBroker::setupResourceLinks(), OutputFUBroker::setupResourceLinks(), InputFUBroker::setupResourceLinks(), IUBroker::setupResourceLinks(), TTAMachine::ControlUnit::specialRegisterPort(), TTAMachine::ControlUnit::specialRegisterPortCount(), MachineConnectivityCheck::toRfConnected(), TTAMachine::FunctionUnit::triggerPort(), unsetMachine(), FUArchitectureDialog::update(), ProximPortWindow::update(), TTAMachine::RegisterFile::updateMaxReadsAndWrites(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeFUCntrlSignals(), DefaultDecoderGenerator::writeRFCntrlSignals(), DefaultDecoderGenerator::writeRFSRAMDecodingProcess(), DefaultDecoderGenerator::writeRulesForDestinationControlSignals(), and DefaultDecoderGenerator::writeRulesForSourceControlSignals().
|
staticprivate |
Creates a set of port names that exists in the given ObjectState tree.
state | An ObjectState instance representing an unit. |
KeyNotFound | If the given ObjectState instance is invalid. |
Definition at line 409 of file Unit.cc.
References ObjectState::child(), ObjectState::childCount(), TTAMachine::Port::OSKEY_NAME, and ObjectState::stringAttribute().
Referenced by loadStateWithoutReferences().
|
protectedvirtual |
Removes the given port.
This method should only be called by Port destructor.
port | Port to be removed. |
Reimplemented in TTAMachine::ControlUnit.
Definition at line 235 of file Unit.cc.
References assert, TTAMachine::Port::parentUnit(), port(), ports_, and ContainerTools::removeValueIfExists().
Referenced by TTAMachine::ControlUnit::removePort(), and TTAMachine::Port::~Port().
|
virtual |
Saves the state of the object to an ObjectState tree.
Reimplemented from TTAMachine::Component.
Reimplemented in TTAMachine::FunctionUnit, TTAMachine::RegisterFile, TTAMachine::NullRegisterFile, TTAMachine::ControlUnit, TTAMachine::ImmediateUnit, and TTAMachine::BaseRegisterFile.
Definition at line 285 of file Unit.cc.
References ObjectState::addChild(), OSNAME_UNIT, port(), portCount(), TTAMachine::Port::saveState(), TTAMachine::Component::saveState(), and ObjectState::setName().
Referenced by TTAMachine::BaseRegisterFile::saveState(), and TTAMachine::FunctionUnit::saveState().
|
virtual |
Registers the unit to a machine.
mach | Machine to which the unit is to be registered. |
ComponentAlreadyExists | If there is another unit by the same name and type in the machine. |
Implements TTAMachine::Component.
Reimplemented in TTAMachine::ControlUnit, and TTAMachine::NullRegisterFile.
Definition at line 253 of file Unit.cc.
References TTAMachine::Machine::addUnit(), and TTAMachine::Component::internalSetMachine().
Referenced by AddFUCmd::Do(), AddRFCmd::Do(), and AddIUCmd::Do().
|
virtual |
Removes registration of the unit from its current machine.
Implements TTAMachine::Component.
Reimplemented in TTAMachine::FunctionUnit, TTAMachine::RegisterFile, TTAMachine::ImmediateUnit, TTAMachine::ControlUnit, and TTAMachine::NullRegisterFile.
Definition at line 262 of file Unit.cc.
References TTAMachine::Port::detachAllSockets(), TTAMachine::Component::internalUnsetMachine(), TTAMachine::Component::machine(), port(), and portCount().
Referenced by TTAMachine::ImmediateUnit::unsetMachine(), TTAMachine::RegisterFile::unsetMachine(), and TTAMachine::FunctionUnit::unsetMachineDerived().
|
static |
|
private |
Contains all the ports of the unit.
Definition at line 96 of file Unit.hh.
Referenced by addPort(), bidirPortCount(), deleteAllPorts(), hasPort(), inputPortCount(), outputPortCount(), port(), portCount(), and removePort().