OpenASIP  2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TTAMachine::BaseRegisterFile Class Reference

#include <BaseRegisterFile.hh>

Inheritance diagram for TTAMachine::BaseRegisterFile:
Inheritance graph
Collaboration diagram for TTAMachine::BaseRegisterFile:
Collaboration graph

Public Member Functions

virtual ~BaseRegisterFile ()
 
virtual int numberOfRegisters () const
 
virtual int width () const
 
virtual int size () const
 
virtual void setNumberOfRegisters (int registers)
 
virtual void setWidth (int width)
 
virtual RFPortport (const std::string &name) const
 
virtual RFPortport (int index) const
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
- 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)
 
virtual void unsetMachine ()
 
- Public Member Functions inherited from TTAMachine::Component
virtual ~Component ()
 
virtual TCEString name () const
 
virtual void setName (const std::string &name)
 
virtual Machinemachine () 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_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...
 

Protected Member Functions

 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 ()
 

Private Member Functions

void loadStateWithoutReferences (const ObjectState *state)
 

Private Attributes

int size_
 Number of registers in the register file. More...
 
int width_
 Bit width of the registers in the register file. More...
 

Detailed Description

An abstract base class for register files as ImmediateUnit and RegisterFile.

Definition at line 48 of file BaseRegisterFile.hh.

Constructor & Destructor Documentation

◆ ~BaseRegisterFile()

TTAMachine::BaseRegisterFile::~BaseRegisterFile ( )
virtual

Destructor.

Definition at line 84 of file BaseRegisterFile.cc.

84  {
85 }

◆ BaseRegisterFile() [1/2]

TTAMachine::BaseRegisterFile::BaseRegisterFile ( const std::string &  name,
int  size,
int  width 
)
protected

Constructor.

Parameters
nameName of the register file.
sizeNumber of registers in the register file.
widthBit width of the registers in the register file.
Exceptions
OutOfRangeIf the given size or width is out of range.
InvalidNameIf the given name is not a valid component name.

Definition at line 60 of file BaseRegisterFile.cc.

61  : Unit(name), size_(size), width_(width) {
63  setWidth(width);
64 }

References setNumberOfRegisters(), setWidth(), size(), and width().

Here is the call graph for this function:

◆ BaseRegisterFile() [2/2]

TTAMachine::BaseRegisterFile::BaseRegisterFile ( const ObjectState state)
protected

Constructor.

Loads the state of the object from the given ObjectState instance. Does not load references to other components.

Parameters
stateThe ObjectState instance from which the state is loaded.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 76 of file BaseRegisterFile.cc.

77  : Unit(state), size_(0), width_(0) {
79 }

References loadStateWithoutReferences().

Here is the call graph for this function:

Member Function Documentation

◆ loadState()

void TTAMachine::BaseRegisterFile::loadState ( const ObjectState state)
virtual

Loads its the from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Reimplemented from TTAMachine::Unit.

Reimplemented in TTAMachine::RegisterFile, TTAMachine::NullRegisterFile, TTAMachine::ImmediateUnit, and UnboundedRegisterFile.

Definition at line 176 of file BaseRegisterFile.cc.

176  {
178  Unit::loadState(state);
179 }

References TTAMachine::Unit::loadState(), and loadStateWithoutReferences().

Referenced by TTAMachine::RegisterFile::loadState().

Here is the call graph for this function:

◆ loadStateWithoutReferences()

void TTAMachine::BaseRegisterFile::loadStateWithoutReferences ( const ObjectState state)
private

Loads its state from the given ObjectState instance without references to other components.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 190 of file BaseRegisterFile.cc.

190  {
191  try {
194  } catch (...) {
195  string procName = "BaseRegisterFile::loadStateWithoutReferences";
196  throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
197  }
198 }

References ObjectState::intAttribute(), OSKEY_SIZE, OSKEY_WIDTH, setNumberOfRegisters(), and setWidth().

Referenced by BaseRegisterFile(), and loadState().

Here is the call graph for this function:

◆ numberOfRegisters()

virtual int TTAMachine::BaseRegisterFile::numberOfRegisters ( ) const
virtual

Reimplemented in TTAMachine::NullRegisterFile, and UnboundedRegisterFile.

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), CodeCompressorPlugin::addBitsForDstRegisterField(), ProgrammabilityValidator::addConnectionToProgram(), BEMGenerator::addLongImmDstRegisterFields(), MachineStateBuilder::buildMachineState(), IUBroker::buildResources(), BEMValidator::checkLImmDstRegisterFields(), RFFactory::createEditPart(), IUFactory::createEditPart(), llvm::LLVMTCEBuilder::emitLongjmp(), llvm::LLVMTCEBuilder::emitSetjmp(), InfoProcCommand::execute(), InfoStatsCommand::execute(), findBooleanGuard(), SimulatorFrontend::findBooleanRegister(), findBooleanRegisterFile(), ProgrammabilityValidator::findConnections(), SimulatorFrontend::finishSimulation(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), ProDeIUEditPolicy::getCommand(), ProDeRFEditPolicy::getCommand(), ComponentImplementationSelector::iuImplementations(), TTAMachine::RegisterGuard::loadState(), BEMValidator::needsSocketCodeTable(), BEMGenerator::needsSocketCodeTable(), AddWatchDialog::onRFChoice(), RFGuardDialog::onRFChoice(), ProgrammabilityValidator::printConnection(), MachineResourceManager::registerFileIndexReference(), SimulationController::registerFileValue(), CompiledSimController::registerFileValue(), TTAMachine::RegisterGuard::RegisterGuard(), BEMGenerator::requiredIndexWidth(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), DefaultDecoderGenerator::rfOpcodeWidth(), TTAProgram::TerminalRegister::setIndex(), TTAMachine::RegisterFile::setNumberOfRegisters(), and DefaultDecoderGenerator::writeInstructionTemplateProcedures().

◆ port() [1/2]

RFPort * TTAMachine::BaseRegisterFile::port ( const std::string &  name) const
virtual

Returns the requested port.

Parameters
nameName of the port.
Returns
The requested port.
Exceptions
InstanceNotFoundIf a port is not found by the given name.

Reimplemented from TTAMachine::Unit.

Definition at line 129 of file BaseRegisterFile.cc.

129  {
130  Port* port = Unit::port(name);
131  RFPort* rfPort = static_cast<RFPort*>(port);
132  return rfPort;
133 }

References TTAMachine::Component::name(), and TTAMachine::Unit::port().

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), RegisterCopyAdder::addConnectionRegisterCopies(), RegisterCopyAdder::addConnectionRegisterCopiesImmediate(), InputPSocketBroker::allAvailableResources(), OutputPSocketBroker::allAvailableResources(), IUBroker::allAvailableResources(), TDGen::analyzeMachineRegisters(), TDGen::analyzeRegisters(), IUBroker::assign(), MachineTester::canConnect(), RFPortCheck::check(), FullyConnectedCheck::check(), DefaultDecoderGenerator::completeDecoderBlock(), ProGe::RV32MicroCodeGenerator::connectRF(), RegisterCopyAdder::countAndAddConnectionRegisterCopiesToRR(), IUFactory::createEditPart(), RFFactory::createEditPart(), ADFCombiner::createPortsAndSockets(), TTAProgram::TPEFProgramFactory::createTerminal(), TTAProgram::CodeGenerator::createTerminalRegister(), llvm::LLVMTCEBuilder::createTerminalRegister(), llvm::LLVMTCEBuilder::emitSPInitialization(), VLIWConnectIC::explore(), ProgrammabilityValidator::findConnections(), MachineConnectivityCheck::findPossibleSourcePorts(), DataDependenceGraphBuilder::findStaticRegisters(), TTAMachine::RegisterFile::firstReadPort(), TTAMachine::RegisterFile::firstWritePort(), FullyConnectedCheck::fix(), MachineConnectivityCheck::fromRfConnected(), MachineConnectivityCheck::immBits(), OutputPSocketBroker::isAnyResourceAvailable(), MachineConnectivityCheck::isConnected(), MachineAnalysis::MachineAnalysis(), BlockImplementationDialog::onHDBSelection(), port(), MachineResourceManager::registerFileIndexReference(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), MachineResourceManager::rFPortOrFUIndexReference(), IUBroker::setupResourceLinks(), MachineConnectivityCheck::toRfConnected(), TTAMachine::RegisterFile::updateMaxReadsAndWrites(), DefaultDecoderGenerator::writeControlRegisterMappings(), DefaultDecoderGenerator::writeRFCntrlSignals(), DefaultDecoderGenerator::writeRFSRAMDecodingProcess(), DefaultDecoderGenerator::writeRulesForDestinationControlSignals(), and DefaultDecoderGenerator::writeRulesForSourceControlSignals().

Here is the call graph for this function:

◆ port() [2/2]

RFPort * TTAMachine::BaseRegisterFile::port ( int  index) const
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.

Parameters
indexIndex.
Returns
The port by the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Reimplemented from TTAMachine::Unit.

Definition at line 146 of file BaseRegisterFile.cc.

146  {
147  Port* port = Unit::port(index);
148  RFPort* rfPort = dynamic_cast<RFPort*>(port);
149  assert(rfPort != NULL);
150  return rfPort;
151 }

References assert, TTAMachine::Unit::port(), and port().

Here is the call graph for this function:

◆ saveState()

ObjectState * TTAMachine::BaseRegisterFile::saveState ( ) const
virtual

Saves the state of the object into an ObjectState tree.

Returns
The newly created ObjectState tree.

Reimplemented from TTAMachine::Unit.

Reimplemented in TTAMachine::RegisterFile, TTAMachine::NullRegisterFile, and TTAMachine::ImmediateUnit.

Definition at line 159 of file BaseRegisterFile.cc.

159  {
160  ObjectState* state = Unit::saveState();
162  state->setAttribute(OSKEY_SIZE, size_);
164  return state;
165 }

References OSKEY_SIZE, OSKEY_WIDTH, OSNAME_BASE_REGISTER_FILE, TTAMachine::Unit::saveState(), ObjectState::setAttribute(), ObjectState::setName(), size_, and width_.

Referenced by TTAMachine::RegisterFile::saveState().

Here is the call graph for this function:

◆ setNumberOfRegisters()

void TTAMachine::BaseRegisterFile::setNumberOfRegisters ( int  registers)
virtual

Sets the number of registers in the register file.

Parameters
registersThe new amount of registers.
Exceptions
OutOfRangeIf the given number of registers is less or equal to zero.

Reimplemented in TTAMachine::RegisterFile, TTAMachine::NullRegisterFile, and UnboundedRegisterFile.

Definition at line 96 of file BaseRegisterFile.cc.

96  {
97  if (registers <= 0) {
98  string procName = "BaseRegisterFile::setNumberOfRegisters";
99  throw OutOfRange(__FILE__, __LINE__, procName);
100  }
101 
102  size_ = registers;
103 }

References size_.

Referenced by BaseRegisterFile(), loadStateWithoutReferences(), and TTAMachine::RegisterFile::setNumberOfRegisters().

◆ setWidth()

void TTAMachine::BaseRegisterFile::setWidth ( int  width)
virtual

Sets the bit width of the registers.

Parameters
widthThe new bit width.
Exceptions
OutOfRangeIf the given width is less or equal to zero.

Reimplemented in TTAMachine::NullRegisterFile, and UnboundedRegisterFile.

Definition at line 112 of file BaseRegisterFile.cc.

112  {
113  if (width <= 0) {
114  string procName = "BaseRegisterFile::setWidth";
115  throw OutOfRange(__FILE__, __LINE__, procName);
116  }
117 
118  width_ = width;
119 }

References width(), and width_.

Referenced by BaseRegisterFile(), TTAMachine::ImmediateUnit::ImmediateUnit(), and loadStateWithoutReferences().

Here is the call graph for this function:

◆ size()

virtual int TTAMachine::BaseRegisterFile::size ( ) const
virtual

◆ width()

virtual int TTAMachine::BaseRegisterFile::width ( ) const
virtual

Reimplemented in TTAMachine::NullRegisterFile.

Referenced by ProGe::NetlistGenerator::addBaseRFToNetlist(), RegisterCopyAdder::addConnectionRegisterCopies(), RegisterCopyAdder::addConnectionRegisterCopiesImmediate(), TDGen::analyzeMachineRegisters(), ResourceConstraintAnalyzer::analyzeRegisterAntideps(), TDGen::analyzeRegisters(), BaseRegisterFile(), MachineStateBuilder::buildMachineState(), IUBroker::buildResources(), RegisterQuantityCheck::canFixIntRegs(), MachineConnectivityCheck::canWriteAllImmediates(), ProgrammabilityValidator::checkBooleanRegister(), Automagic::checkForSelectableIU(), ProGeTools::checkForSelectableIU(), ProGeTools::checkForSelectableRF(), Automagic::checkForSelectableRF(), DefaultDecoderGenerator::completeDecoderBlock(), ADFCombiner::connectRegisterFiles(), RegisterQuantityCheck::countIntRegisters(), IUFactory::createEditPart(), RFFactory::createEditPart(), VLIWConnectIC::explore(), findBooleanGuard(), SimulatorFrontend::findBooleanRegister(), findBooleanRegisterFile(), RegisterRenamer::findConnectedRFs(), RegisterRenamer::findFreeRegisters(), ProgrammabilityValidator::findGlobalConnectionRegister(), RegisterRenamer::findPartiallyUsedRegistersAfterCycle(), RegisterRenamer::findPartiallyUsedRegistersBeforeCycle(), MachineConnectivityCheck::findPossibleSourcePorts(), ProGe::RV32MicroCodeGenerator::findRF(), RegisterCopyAdder::findTempRegisters(), RegisterQuantityCheck::fixIntRegs(), MachineConnectivityCheck::fromRfConnected(), CompiledSimCodeGenerator::generateHeaderAndMainCode(), ProDeIUEditPolicy::getCommand(), ProDeRFEditPolicy::getCommand(), MachineConnectivityCheck::hasConditionalMoves(), TTAMachine::ImmediateUnit::ImmediateUnit(), TTAMachine::RegisterFile::isArchitectureEqual(), MachineConnectivityCheck::isConnectedToDifferentlyConnectedRFs(), ComponentImplementationSelector::iuImplementations(), TTAProgram::CodeGenerator::loadTerminal(), MachineInfo::numberOfRegisters(), BlockImplementationDialog::onHDBSelection(), BFScheduleBU::operator()(), MachineResourceManager::registerFileIndexReference(), llvm::LLVMTCEIRBuilder::registerFileName(), RegisterRenamer::renameDestinationRegister(), RegisterRenamer::renameSourceRegister(), HDB::RFArchitecture::RFArchitecture(), ComponentImplementationSelector::rfImplementations(), setWidth(), TTAProgram::CodeGenerator::storeTerminal(), MachineInfo::supportsBoolRegisterGuardedJumps(), MachineConnectivityCheck::toRfConnected(), PreOptimizer::tryToOptimizeAddressReg(), TTAMachine::RFPort::width(), DefaultDecoderGenerator::writeInstructionTemplateProcedures(), and DefaultDecoderGenerator::writeRFCntrlSignals().

Member Data Documentation

◆ OSKEY_SIZE

const string TTAMachine::BaseRegisterFile::OSKEY_SIZE = "size"
static

ObjectState attribute key for the number of registers.

Definition at line 68 of file BaseRegisterFile.hh.

Referenced by loadStateWithoutReferences(), and saveState().

◆ OSKEY_WIDTH

const string TTAMachine::BaseRegisterFile::OSKEY_WIDTH = "width"
static

ObjectState attribute key for bit width of the registers.

Definition at line 70 of file BaseRegisterFile.hh.

Referenced by loadStateWithoutReferences(), and saveState().

◆ OSNAME_BASE_REGISTER_FILE

const string TTAMachine::BaseRegisterFile::OSNAME_BASE_REGISTER_FILE = "baseregfile"
static

ObjectState name for BaseRegisterFile.

Definition at line 66 of file BaseRegisterFile.hh.

Referenced by saveState().

◆ size_

int TTAMachine::BaseRegisterFile::size_
private

Number of registers in the register file.

Definition at line 80 of file BaseRegisterFile.hh.

Referenced by saveState(), and setNumberOfRegisters().

◆ width_

int TTAMachine::BaseRegisterFile::width_
private

Bit width of the registers in the register file.

Definition at line 82 of file BaseRegisterFile.hh.

Referenced by saveState(), and setWidth().


The documentation for this class was generated from the following files:
TTAMachine::BaseRegisterFile::setWidth
virtual void setWidth(int width)
Definition: BaseRegisterFile.cc:112
TTAMachine::BaseRegisterFile::OSKEY_SIZE
static const std::string OSKEY_SIZE
ObjectState attribute key for the number of registers.
Definition: BaseRegisterFile.hh:68
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ObjectStateLoadingException
Definition: Exception.hh:551
OutOfRange
Definition: Exception.hh:320
TTAMachine::BaseRegisterFile::size_
int size_
Number of registers in the register file.
Definition: BaseRegisterFile.hh:80
TTAMachine::Unit::loadState
virtual void loadState(const ObjectState *state)
Definition: Unit.cc:309
ObjectState
Definition: ObjectState.hh:59
ObjectState::setName
void setName(const std::string &name)
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::Unit::saveState
virtual ObjectState * saveState() const
Definition: Unit.cc:285
TTAMachine::BaseRegisterFile::OSKEY_WIDTH
static const std::string OSKEY_WIDTH
ObjectState attribute key for bit width of the registers.
Definition: BaseRegisterFile.hh:70
TTAMachine::Unit::port
virtual Port * port(const std::string &name) const
Definition: Unit.cc:116
TTAMachine::BaseRegisterFile::loadStateWithoutReferences
void loadStateWithoutReferences(const ObjectState *state)
Definition: BaseRegisterFile.cc:190
TTAMachine::Unit::Port
friend class Port
Definition: Unit.hh:99
TTAMachine::BaseRegisterFile::setNumberOfRegisters
virtual void setNumberOfRegisters(int registers)
Definition: BaseRegisterFile.cc:96
TTAMachine::BaseRegisterFile::port
virtual RFPort * port(const std::string &name) const
Definition: BaseRegisterFile.cc:129
TTAMachine::BaseRegisterFile::OSNAME_BASE_REGISTER_FILE
static const std::string OSNAME_BASE_REGISTER_FILE
ObjectState name for BaseRegisterFile.
Definition: BaseRegisterFile.hh:66
TTAMachine::BaseRegisterFile::width_
int width_
Bit width of the registers in the register file.
Definition: BaseRegisterFile.hh:82
ObjectState::intAttribute
int intAttribute(const std::string &name) const
Definition: ObjectState.cc:276
TTAMachine::BaseRegisterFile::size
virtual int size() const
TTAMachine::Unit::Unit
Unit(const std::string &name)
Definition: Unit.cc:59
TTAMachine::BaseRegisterFile::width
virtual int width() const
ObjectState::setAttribute
void setAttribute(const std::string &name, const std::string &value)
Definition: ObjectState.cc:100