OpenASIP
2.0
|
#include <RegisterFile.hh>
Public Types | |
enum | Type { NORMAL, RESERVED, VOLATILE } |
Type of the register file indicates how the RF is used. More... | |
Public Member Functions | |
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 | setName (const std::string &name) |
virtual void | setMaxReads (int maxReads) |
virtual void | setMaxWrites (int maxWrites) |
virtual void | setType (RegisterFile::Type type) |
virtual void | setNumberOfRegisters (int registers) |
virtual int | guardLatency () const |
virtual void | setGuardLatency (int latency) |
virtual void | unsetMachine () |
virtual ObjectState * | saveState () const |
virtual void | loadState (const ObjectState *state) |
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_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 | |
bool | updateMaxReadsAndWrites () const |
RegisterFile (const RegisterFile &) | |
Copying forbidden, use the copy() method. More... | |
RegisterFile & | operator= (const RegisterFile &) |
Assingment forbidden. More... | |
void | loadStateWithoutReferences (const ObjectState *state) |
void | deleteGuards (int registers) const |
Private Attributes | |
int | maxReads_ |
Max number of ports that can read a register all in the same cycle. More... | |
int | maxWrites_ |
Max number of ports that can read a register all in the same cycle. More... | |
int | guardLatency_ |
The guard latency of the register file. More... | |
Type | type_ |
Type of the register file. More... | |
bool | zeroRegister_ |
Additional Inherited Members | |
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 () |
Represents a register-file in TTA processor.
Definition at line 47 of file RegisterFile.hh.
Type of the register file indicates how the RF is used.
Enumerator | |
---|---|
NORMAL | Used for general register allocation. |
RESERVED | Used for custom, user controlled register allocation. |
VOLATILE | Used for user-controlled I/O communication. |
Definition at line 50 of file RegisterFile.hh.
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 |
||
) |
Constructor.
name | Name of the register file. |
size | Number of registers in the register file. |
width | Bit width of the registers in the register file. |
maxReads | Maximum simultaneous reads of a register. |
maxWrites | Maximum simultaneous writes of a register. |
maxRw | Maximum simultaneous reads of a register in the same cycle the register is written. |
type | Type of the register file, see RegisterFile::Type. |
OutOfRange | If some of the given parameters has an illegal value. |
InvalidName | If the given name is not a valid component name. |
Definition at line 74 of file RegisterFile.cc.
References guardLatency(), maxReads(), maxWrites(), setGuardLatency(), setMaxReads(), and setMaxWrites().
Referenced by copy().
|
explicit |
Constructor.
Loads the state of the register file from the given ObjectState instance. Does not load references to other components.
state | The ObjectState from which the name is taken. |
ObjectStateLoadingException | If the given ObjectState tree is invalid. |
Definition at line 99 of file RegisterFile.cc.
References loadStateWithoutReferences().
|
virtual |
Destructor.
Definition at line 112 of file RegisterFile.cc.
References unsetMachine().
|
private |
Copying forbidden, use the copy() method.
|
virtual |
Creates and returns a copy of the register file.
Definition at line 601 of file RegisterFile.cc.
References RegisterFile(), and saveState().
|
private |
Deletes the guards that refer to registers would not exist if there were the given number of registers in this register file.
registers | The number of registers. |
Definition at line 492 of file RegisterFile.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::guard(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), TTAMachine::RegisterGuard::registerFile(), and TTAMachine::RegisterGuard::registerIndex().
Referenced by setNumberOfRegisters(), and unsetMachine().
Port * TTAMachine::RegisterFile::firstReadPort | ( | ) | const |
Definition at line 607 of file RegisterFile.cc.
References TTAMachine::Port::outputSocket(), TTAMachine::BaseRegisterFile::port(), and TTAMachine::Unit::portCount().
Referenced by RegisterRenamer::renameLiveRange(), BFRenameLiveRange::setTerminals(), BFRegCopyAfter::splitMove(), and BFRegCopyBefore::splitMove().
Port * TTAMachine::RegisterFile::firstWritePort | ( | ) | const |
Definition at line 618 of file RegisterFile.cc.
References TTAMachine::Port::inputSocket(), TTAMachine::BaseRegisterFile::port(), and TTAMachine::Unit::portCount().
Referenced by RegisterRenamer::renameLiveRange(), BFRenameLiveRange::setTerminals(), BFRegCopyAfter::splitMove(), and BFRegCopyBefore::splitMove().
|
virtual |
Returns the guard latency.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 333 of file RegisterFile.cc.
References guardLatency_.
Referenced by MachineStateBuilder::buildMachineState(), Automagic::checkForSelectableRF(), ProGeTools::checkForSelectableRF(), CompiledSimCodeGenerator::CompiledSimCodeGenerator(), TTAProgram::Move::guardLatency(), TTAMachine::ControlUnit::hasLocalGuardLatencyOfZero(), isArchitectureEqual(), TTAMachine::RegisterGuard::loadState(), MachineInfo::longestGuardLatency(), BlockImplementationDialog::onHDBSelection(), RegisterFile(), TTAMachine::RegisterGuard::RegisterGuard(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), SequentialScheduler::scheduleMove(), and setGuardLatency().
|
virtual |
Checks is this register file architecture equal with the given register file.
Architecture equality means that register files have same values, names and port names may differ.
rf | Register file to compare with. |
Definition at line 532 of file RegisterFile.cc.
References guardLatency(), guardLatency_, maxReads(), maxReads_, maxWrites(), maxWrites_, TTAMachine::Unit::portCount(), TTAMachine::BaseRegisterFile::size(), type(), type_, and TTAMachine::BaseRegisterFile::width().
Referenced by MachineResourceModifier::analyzeRegisters().
|
virtual |
Returns true if the type of the register file is normal, otherwise false.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 158 of file RegisterFile.cc.
Referenced by ProDeRFEditPolicy::getCommand().
|
virtual |
Returns true if the type of the register file is reserved, otherwise false.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 184 of file RegisterFile.cc.
References RESERVED, and type_.
Referenced by TDGen::analyzeRegisters(), and ProDeRFEditPolicy::getCommand().
|
virtual |
Returns true if the register file is used as a guard.
Definition at line 567 of file RegisterFile.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::guard(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), and TTAMachine::RegisterGuard::registerFile().
Referenced by Automagic::checkForSelectableIU(), ProGeTools::checkForSelectableIU(), Automagic::checkForSelectableRF(), ProGeTools::checkForSelectableRF(), AutoSelectImplementationsDialog::findRFImplementations(), BlockImplementationDialog::onHDBSelection(), and ComponentImplementationSelector::selectRFs().
|
virtual |
Returns true if the type of the register file is volatile, otherwise false.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 171 of file RegisterFile.cc.
References type_, and VOLATILE.
Referenced by ProDeRFEditPolicy::getCommand().
|
virtual |
Loads its state from the given ObjectState instance.
state | The ObjectState instance. |
ObjectStateLoadingException | If the given ObjectState instance is invalid. |
Reimplemented from TTAMachine::BaseRegisterFile.
Reimplemented in TTAMachine::NullRegisterFile, TTAMachine::ImmediateUnit, and UnboundedRegisterFile.
Definition at line 433 of file RegisterFile.cc.
References TTAMachine::BaseRegisterFile::loadState(), and loadStateWithoutReferences().
Referenced by TTAMachine::ImmediateUnit::loadState(), and TTAMachine::Machine::loadState().
|
private |
Loads the state of the register file without references to other components.
state | The ObjectState instance from which the state is loaded. |
ObjectStateLoadingException | If the given ObjectState instance is invalid. |
Definition at line 449 of file RegisterFile.cc.
References ObjectState::boolAttribute(), Exception::errorMessage(), ObjectState::hasAttribute(), ObjectState::intAttribute(), ObjectState::name(), NORMAL, OSKEY_GUARD_LATENCY, OSKEY_MAX_READS, OSKEY_MAX_WRITES, OSKEY_TYPE, OSKEY_ZERO_REGISTER, TTAMachine::ImmediateUnit::OSNAME_IMMEDIATE_UNIT, OSNAME_REGISTER_FILE, OSVALUE_NORMAL, OSVALUE_RESERVED, OSVALUE_VOLATILE, RESERVED, setGuardLatency(), setMaxReads(), setMaxWrites(), setType(), setZeroRegister(), ObjectState::stringAttribute(), type(), and VOLATILE.
Referenced by loadState(), and RegisterFile().
|
virtual |
Returns the number of ports that can read a register all in same cycle.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 123 of file RegisterFile.cc.
References maxReads_, and updateMaxReadsAndWrites().
Referenced by ResourceConstraintAnalyzer::analyzeMoveNode(), Automagic::checkForSelectableIU(), ProGeTools::checkForSelectableIU(), ADFCombiner::createPortsAndSockets(), FullyConnectedCheck::fix(), isArchitectureEqual(), BlockImplementationDialog::onHDBSelection(), RegisterFile(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), and BFOptimization::RFReadPortCountPreventsScheduling().
|
virtual |
Returns the number of ports that can write a register all in same cycle.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 135 of file RegisterFile.cc.
References maxWrites_, and updateMaxReadsAndWrites().
Referenced by ResourceConstraintAnalyzer::analyzeMoveNode(), ADFCombiner::createPortsAndSockets(), FullyConnectedCheck::fix(), isArchitectureEqual(), BlockImplementationDialog::onHDBSelection(), RegisterFile(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), TTAMachine::ImmediateUnit::setMaxWrites(), and setMaxWrites().
|
private |
Assingment forbidden.
|
virtual |
Saves the contents to an ObjectState tree.
Reimplemented from TTAMachine::BaseRegisterFile.
Reimplemented in TTAMachine::NullRegisterFile, and TTAMachine::ImmediateUnit.
Definition at line 392 of file RegisterFile.cc.
References assert, guardLatency_, maxReads_, maxWrites_, NORMAL, OSKEY_GUARD_LATENCY, OSKEY_MAX_READS, OSKEY_MAX_WRITES, OSKEY_TYPE, OSKEY_ZERO_REGISTER, OSNAME_REGISTER_FILE, OSVALUE_NORMAL, OSVALUE_RESERVED, OSVALUE_VOLATILE, RESERVED, TTAMachine::BaseRegisterFile::saveState(), ObjectState::setAttribute(), ObjectState::setName(), type_, VOLATILE, and zeroRegister_.
Referenced by copy(), and TTAMachine::ImmediateUnit::saveState().
|
virtual |
Sets the guard latency.
latency | The new guard latency. |
OutOfRange | If the given value is negative or if local + global guard latency would be zero. |
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 346 of file RegisterFile.cc.
References __func__, TTAMachine::Machine::controlUnit(), TTAMachine::ControlUnit::globalGuardLatency(), guardLatency(), guardLatency_, TTAMachine::Component::isRegistered(), TTAMachine::Component::machine(), and TTAMachine::ControlUnit::setGlobalGuardLatency().
Referenced by loadStateWithoutReferences(), and RegisterFile().
|
virtual |
Sets the maximum number of ports that can read a register all in the same cycle. Note that this function is only needed if all of the ports are unconnected, otherwise this value is computed automatically.
The given value must be at least zero.
reads | Maximum number of ports. |
OutOfRange | If the given number of maximum reads is out of range. |
Reimplemented in TTAMachine::NullRegisterFile, and UnboundedRegisterFile.
Definition at line 227 of file RegisterFile.cc.
References maxReads_.
Referenced by loadStateWithoutReferences(), and RegisterFile().
|
virtual |
Sets the maximum number of ports that can write a register all in the same cycle. Note that this function is only needed if all of the ports are unconnected, otherwise this value is computed automatically.
The given value must be at least zero.
writes | Maximum number of ports. |
OutOfRange | If the given number of maximum writes is out of range. |
Reimplemented in TTAMachine::NullRegisterFile, TTAMachine::ImmediateUnit, and UnboundedRegisterFile.
Definition at line 247 of file RegisterFile.cc.
References maxWrites(), and maxWrites_.
Referenced by loadStateWithoutReferences(), RegisterFile(), and TTAMachine::ImmediateUnit::setMaxWrites().
|
virtual |
Sets the name of the register file.
name | Name of the register file. |
ComponentAlreadyExists | If a register file with the given name is already in the same machine. |
InvalidName | If the given name is not a valid component name. |
Reimplemented from TTAMachine::Component.
Reimplemented in TTAMachine::NullRegisterFile, TTAMachine::ImmediateUnit, and UnboundedRegisterFile.
Definition at line 198 of file RegisterFile.cc.
References TTAMachine::Component::machine(), TTAMachine::Component::name(), and TTAMachine::Component::setName().
Referenced by ADFCombiner::addRegisterFiles(), MachineResourceModifier::increaseAllRFsThatDiffersByAmount(), and MachineResourceModifier::percentualRegisterIncrease().
|
virtual |
Sets the number of registers in the register file.
If the number of registers decreases, deletes the register guards that were referencing to the registers that are removed.
registers | The new amount of registers. |
OutOfRange | If the given number of registers is less or equal to zero. |
Reimplemented from TTAMachine::BaseRegisterFile.
Reimplemented in TTAMachine::NullRegisterFile, and UnboundedRegisterFile.
Definition at line 320 of file RegisterFile.cc.
References deleteGuards(), TTAMachine::BaseRegisterFile::numberOfRegisters(), and TTAMachine::BaseRegisterFile::setNumberOfRegisters().
Referenced by RegisterQuantityCheck::fixIntRegs(), and TTAMachine::ImmediateUnit::ImmediateUnit().
|
virtual |
Sets the type of the register file.
type | Type of the register file. |
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 304 of file RegisterFile.cc.
Referenced by loadStateWithoutReferences().
|
virtual |
Definition at line 634 of file RegisterFile.cc.
References zeroRegister_.
Referenced by loadStateWithoutReferences().
|
virtual |
Returns the type of the register file.
Reimplemented in TTAMachine::NullRegisterFile.
Definition at line 147 of file RegisterFile.cc.
References type_.
Referenced by isArchitectureEqual(), loadStateWithoutReferences(), and setType().
|
virtual |
Removes the register file from machine.
Reimplemented from TTAMachine::Unit.
Reimplemented in TTAMachine::ImmediateUnit, and TTAMachine::NullRegisterFile.
Definition at line 375 of file RegisterFile.cc.
References deleteGuards(), TTAMachine::Component::machine(), TTAMachine::Machine::removeRegisterFile(), and TTAMachine::Unit::unsetMachine().
Referenced by ~RegisterFile().
|
private |
Updates RFs max reads/writes according in/output ports.
Port that is not assigned to a socket is considered to be a dead port, thus not counted towards the maximum number of reads or writes.
OutOfRange | If setMaxReads/setMaxWrites throws outOfRange exception. |
Definition at line 266 of file RegisterFile.cc.
References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), maxReads_, maxWrites_, TTAMachine::BaseRegisterFile::port(), and TTAMachine::Unit::portCount().
Referenced by maxReads(), and maxWrites().
|
virtual |
Definition at line 629 of file RegisterFile.cc.
References zeroRegister_.
Referenced by TDGen::analyzeRegisters(), MachineStateBuilder::buildMachineState(), ProGeTools::checkForSelectableRF(), ProGe::RV32MicroCodeGenerator::findRF(), BlockImplementationDialog::onHDBSelection(), RegisterRenamer::registersOfRFs(), and ComponentImplementationSelector::rfImplementations().
|
private |
The guard latency of the register file.
Definition at line 133 of file RegisterFile.hh.
Referenced by guardLatency(), isArchitectureEqual(), saveState(), and setGuardLatency().
|
mutableprivate |
Max number of ports that can read a register all in the same cycle.
Definition at line 129 of file RegisterFile.hh.
Referenced by isArchitectureEqual(), maxReads(), saveState(), setMaxReads(), and updateMaxReadsAndWrites().
|
mutableprivate |
Max number of ports that can read a register all in the same cycle.
Definition at line 131 of file RegisterFile.hh.
Referenced by isArchitectureEqual(), maxWrites(), saveState(), setMaxWrites(), and updateMaxReadsAndWrites().
|
static |
ObjectState attribute key for the guard latency.
Definition at line 108 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute key for maximum simultaneous readers.
Definition at line 104 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute key for maximum simultaneous writers.
Definition at line 106 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute key for register file type.
Definition at line 96 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute key for zero register flag.
Definition at line 110 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState name for RegisterFile.
Definition at line 94 of file RegisterFile.hh.
Referenced by TTAMachine::Machine::loadState(), loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute value for normal register file type.
Definition at line 98 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute value for reserved register file type.
Definition at line 100 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
static |
ObjectState attribute value for volatile register file type.
Definition at line 102 of file RegisterFile.hh.
Referenced by loadStateWithoutReferences(), and saveState().
|
private |
Type of the register file.
Definition at line 136 of file RegisterFile.hh.
Referenced by isArchitectureEqual(), isNormal(), isReserved(), isVolatile(), saveState(), setType(), and type().
|
private |
Definition at line 138 of file RegisterFile.hh.
Referenced by saveState(), setZeroRegister(), and zeroRegister().