OpenASIP
2.0
|
#include <ImmediateUnit.hh>
Public Member Functions | |
ImmediateUnit (const std::string &name, unsigned int size, unsigned int width, unsigned int maxReads, unsigned int guardLatency, Machine::Extension extension) | |
ImmediateUnit (const ObjectState *state) | |
~ImmediateUnit () | |
virtual void | setMaxWrites (int maxWrites) |
virtual void | setName (const std::string &name) |
bool | signExtends () const |
bool | zeroExtends () const |
virtual Machine::Extension | extensionMode () const |
virtual int | latency () const |
virtual void | setExtensionMode (Machine::Extension mode) |
virtual void | unsetMachine () |
virtual ObjectState * | saveState () const |
virtual void | loadState (const ObjectState *state) |
Public Member Functions inherited from TTAMachine::RegisterFile | |
RegisterFile (const std::string &name, unsigned int size, unsigned int width, unsigned int maxReads, unsigned int maxwrites, unsigned int guardLatency, Type type, bool zeroRegister=false) | |
RegisterFile (const ObjectState *state) | |
virtual | ~RegisterFile () |
virtual RegisterFile * | copy () const |
virtual int | maxReads () const |
virtual int | maxWrites () const |
virtual RegisterFile::Type | type () const |
virtual bool | isNormal () const |
virtual bool | isVolatile () const |
virtual bool | isReserved () const |
virtual void | setMaxReads (int maxReads) |
virtual void | setType (RegisterFile::Type type) |
virtual void | setNumberOfRegisters (int registers) |
virtual int | guardLatency () const |
virtual void | setGuardLatency (int latency) |
virtual bool | isArchitectureEqual (const RegisterFile &rf) const |
virtual bool | isUsedAsGuard () const |
virtual bool | zeroRegister () const |
virtual void | setZeroRegister (const bool &value) |
Port * | firstReadPort () const |
Port * | firstWritePort () const |
Public Member Functions inherited from TTAMachine::BaseRegisterFile | |
virtual | ~BaseRegisterFile () |
virtual int | numberOfRegisters () const |
virtual int | width () const |
virtual int | size () const |
virtual void | setWidth (int width) |
virtual RFPort * | port (const std::string &name) const |
virtual RFPort * | port (int index) const |
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 |
virtual void | setMachine (Machine &mach) |
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_IMMEDIATE_UNIT |
ObjectState name for ImmediateUnit. More... | |
static const std::string | OSKEY_EXTENSION = "extension" |
ObjectState attribute key for the extension mode. More... | |
static const std::string | OSVALUE_SIGN = "sign" |
ObjectState attribute value for sign extension. More... | |
static const std::string | OSVALUE_ZERO = "zero" |
ObjectState attribute value for zero extension. More... | |
static const std::string | OSKEY_LATENCY = "latency" |
ObjectState attribute key for latency. More... | |
Static Public Attributes inherited from TTAMachine::RegisterFile | |
static const std::string | OSNAME_REGISTER_FILE = "reg_file" |
ObjectState name for RegisterFile. More... | |
static const std::string | OSKEY_TYPE = "type" |
ObjectState attribute key for register file type. More... | |
static const std::string | OSVALUE_NORMAL = "normal" |
ObjectState attribute value for normal register file type. More... | |
static const std::string | OSVALUE_RESERVED = "reserved" |
ObjectState attribute value for reserved register file type. More... | |
static const std::string | OSVALUE_VOLATILE = "volatile" |
ObjectState attribute value for volatile register file type. More... | |
static const std::string | OSKEY_MAX_READS = "max_r" |
ObjectState attribute key for maximum simultaneous readers. More... | |
static const std::string | OSKEY_MAX_WRITES = "max_w" |
ObjectState attribute key for maximum simultaneous writers. More... | |
static const std::string | OSKEY_GUARD_LATENCY = "g_latency" |
ObjectState attribute key for the guard latency. More... | |
static const std::string | OSKEY_ZERO_REGISTER = "zero_register" |
ObjectState attribute key for zero register flag. More... | |
Static Public Attributes inherited from TTAMachine::BaseRegisterFile | |
static const std::string | OSNAME_BASE_REGISTER_FILE = "baseregfile" |
ObjectState name for BaseRegisterFile. More... | |
static const std::string | OSKEY_SIZE = "size" |
ObjectState attribute key for the number of registers. More... | |
static const std::string | OSKEY_WIDTH = "width" |
ObjectState attribute key for bit width of the registers. 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... | |
Private Member Functions | |
virtual void | setLatency (int latency) |
void | loadStateWithoutReferences (const ObjectState *state) |
Private Attributes | |
Machine::Extension | extension_ |
int | latency_ |
Additional Inherited Members | |
Public Types inherited from TTAMachine::RegisterFile | |
enum | Type { NORMAL, RESERVED, VOLATILE } |
Type of the register file indicates how the RF is used. More... | |
Protected Member Functions inherited from TTAMachine::BaseRegisterFile | |
BaseRegisterFile (const std::string &name, int size, int width) | |
BaseRegisterFile (const ObjectState *state) | |
Protected Member Functions inherited from TTAMachine::Unit | |
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 () |
Represent a immediate unit in the machine.
Definition at line 50 of file ImmediateUnit.hh.
TTAMachine::ImmediateUnit::ImmediateUnit | ( | const std::string & | name, |
unsigned int | size, | ||
unsigned int | width, | ||
unsigned int | maxReads, | ||
unsigned int | guardLatency, | ||
Machine::Extension | extension | ||
) |
Constructor.
name | Name of the immediate unit. |
size | Number of immediate registers in the immediate unit. |
width | Bit width of the long immediate registers in the immediate unit. |
extension | Extension mode applied to the long immediate when it is narrower than the immediate register, see Machine::Extension. |
latency | Number of cycles needed between the encoding of a long immediate and its earliest transport on a data bus. The value "0" indicates that the long immediate can be read onto a bus in the same cycle in which the instruction that encodes it is executed. |
OutOfRange | If the given size or width is invalid. |
InvalidName | If the given name is not a valid name for a component. |
Definition at line 74 of file ImmediateUnit.cc.
References TTAMachine::RegisterFile::setNumberOfRegisters(), TTAMachine::BaseRegisterFile::setWidth(), TTAMachine::BaseRegisterFile::size(), and TTAMachine::BaseRegisterFile::width().
TTAMachine::ImmediateUnit::ImmediateUnit | ( | const ObjectState * | state | ) |
Constructor.
Loads the state of the immediate unit from the given ObjectState instance. Does not load references to other components.
state | The ObjectState instance. |
ObjectStateLoadingException | If the given ObjectState instance is invalid or if connections to other machine parts cannot be made. |
Definition at line 98 of file ImmediateUnit.cc.
References loadStateWithoutReferences().
TTAMachine::ImmediateUnit::~ImmediateUnit | ( | ) |
Destructor.
Definition at line 105 of file ImmediateUnit.cc.
References unsetMachine().
|
virtual |
Returns the extension mode of the immediate unit.
Definition at line 143 of file ImmediateUnit.cc.
References extension_.
Referenced by ITemplateBroker::assignImmediate(), IUBroker::buildResources(), POMValidator::checkLongImmediates(), ITemplateBroker::findITemplates(), MachineConnectivityCheck::findPossibleSourcePorts(), ProDeIUEditPolicy::getCommand(), and DefaultDecoderGenerator::writeInstructionTemplateProcedures().
|
virtual |
Returns the minimum number of cycles needed between the encoding of a long immediate and its earliest transport on a data bus.
Definition at line 155 of file ImmediateUnit.cc.
References latency_.
Referenced by IUBroker::buildResources(), Automagic::checkForSelectableIU(), ProGeTools::checkForSelectableIU(), CopyingDelaySlotFiller::checkImmediatesAfter(), CopyingDelaySlotFiller::collectMoves(), CopyingDelaySlotFiller::findJumpImmediate(), ControlFlowGraph::findLimmWrite(), BlockImplementationDialog::onHDBSelection(), LoopPrologAndEpilogBuilder::optimizeProlog(), setLatency(), and CopyingDelaySlotFiller::tryToAssignNodes().
|
virtual |
Loads its state from the given ObjectState instance.
state | The ObjectState instance. |
ObjectStateLoadingException | If the given ObjectState instance is invalid or if the connections to other machine parts cannot be made. |
Reimplemented from TTAMachine::RegisterFile.
Definition at line 261 of file ImmediateUnit.cc.
References TTAMachine::RegisterFile::loadState(), and loadStateWithoutReferences().
Referenced by TTAMachine::Machine::loadState().
|
private |
Loads the state of the immediate 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 275 of file ImmediateUnit.cc.
References assert, Exception::errorMessage(), ObjectState::intAttribute(), latency_, ObjectState::name(), OSKEY_EXTENSION, OSKEY_LATENCY, OSNAME_IMMEDIATE_UNIT, OSVALUE_SIGN, OSVALUE_ZERO, setExtensionMode(), setLatency(), TTAMachine::Machine::SIGN, ObjectState::stringAttribute(), and TTAMachine::Machine::ZERO.
Referenced by ImmediateUnit(), and loadState().
|
virtual |
Saves the contents to an ObjectState tree.
Reimplemented from TTAMachine::RegisterFile.
Definition at line 233 of file ImmediateUnit.cc.
References extension_, latency_, OSKEY_EXTENSION, OSKEY_LATENCY, OSNAME_IMMEDIATE_UNIT, OSVALUE_SIGN, OSVALUE_ZERO, TTAMachine::RegisterFile::saveState(), ObjectState::setAttribute(), ObjectState::setName(), and TTAMachine::Machine::SIGN.
|
virtual |
Sets the extension mode for the immediate unit.
mode | The new extension mode. |
Definition at line 185 of file ImmediateUnit.cc.
References extension_.
Referenced by loadStateWithoutReferences().
|
privatevirtual |
Sets the latency of the immediate unit.
latency | The new latency. |
OutOfRange | If the given latency is less than zero. |
Definition at line 197 of file ImmediateUnit.cc.
References LATENCY, latency(), and latency_.
Referenced by loadStateWithoutReferences().
|
virtual |
Sets the maximum number of ports that can write a register all in the same cycle.
For immediate unit the value is fixed to 1.
writes | Maximum number of ports. |
OutOfRange | If the given number of maximum writes is out of range. |
Reimplemented from TTAMachine::RegisterFile.
Definition at line 171 of file ImmediateUnit.cc.
References MAX_WRITES, TTAMachine::RegisterFile::maxWrites(), and TTAMachine::RegisterFile::setMaxWrites().
|
virtual |
Sets the name of the immediate unit.
name | Name of the immediate unit. |
ComponentAlreadyExists | If an immediate unit with the given name is already in the same machine. |
InvalidName | If the given name is not a valid name for a component. |
Reimplemented from TTAMachine::RegisterFile.
Definition at line 120 of file ImmediateUnit.cc.
References TTAMachine::Component::machine(), TTAMachine::Component::name(), and TTAMachine::Component::setName().
|
inline |
Definition at line 62 of file ImmediateUnit.hh.
References extension_, and TTAMachine::Machine::SIGN.
Referenced by ITemplateBroker::assign(), MachineConnectivityCheck::canWriteAllImmediates(), TTAProgram::ProgramWriter::createCodeSection(), POMDisassembler::createImmediateAssignment(), TTAProgram::TPEFProgramFactory::createInstruction(), and CompiledSimCodeGenerator::generateInstruction().
|
virtual |
Removes the immediate unit from machine.
Reimplemented from TTAMachine::RegisterFile.
Definition at line 209 of file ImmediateUnit.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), TTAMachine::Machine::removeImmediateUnit(), TTAMachine::InstructionTemplate::removeSlots(), and TTAMachine::Unit::unsetMachine().
Referenced by ~ImmediateUnit().
|
inline |
Definition at line 63 of file ImmediateUnit.hh.
References extension_, and TTAMachine::Machine::ZERO.
Referenced by TTAProgram::TPEFProgramFactory::findInstrTemplate().
|
private |
Extension mode applied to the long immediate when it is narrower than the immediate register.
Definition at line 93 of file ImmediateUnit.hh.
Referenced by extensionMode(), saveState(), setExtensionMode(), signExtends(), and zeroExtends().
|
private |
Minimum number of cycles needed between the encoding of a long immediate and its earliest transport on a data bus.
Definition at line 99 of file ImmediateUnit.hh.
Referenced by latency(), loadStateWithoutReferences(), saveState(), and setLatency().
|
static |
ObjectState attribute key for the extension mode.
Definition at line 77 of file ImmediateUnit.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute key for latency.
Definition at line 83 of file ImmediateUnit.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState name for ImmediateUnit.
Definition at line 75 of file ImmediateUnit.hh.
Referenced by TTAMachine::Machine::loadState(), loadStateWithoutReferences(), TTAMachine::RegisterFile::loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute value for sign extension.
Definition at line 79 of file ImmediateUnit.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute value for zero extension.
Definition at line 81 of file ImmediateUnit.hh.
Referenced by loadStateWithoutReferences(), and saveState().