OpenASIP 2.2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
TTAMachine::RegisterFile Class Reference

#include <RegisterFile.hh>

Inheritance diagram for TTAMachine::RegisterFile:
Inheritance graph
Collaboration diagram for TTAMachine::RegisterFile:
Collaboration graph

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 RegisterFilecopy () 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 ObjectStatesaveState () 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)
 
PortfirstReadPort () const
 
PortfirstWritePort () 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 RFPortport (const std::string &name) const
 
virtual RFPortport (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 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_REGISTER_FILE = "reg_file"
 ObjectState name for RegisterFile.
 
static const std::string OSKEY_TYPE = "type"
 ObjectState attribute key for register file type.
 
static const std::string OSVALUE_NORMAL = "normal"
 ObjectState attribute value for normal register file type.
 
static const std::string OSVALUE_RESERVED = "reserved"
 ObjectState attribute value for reserved register file type.
 
static const std::string OSVALUE_VOLATILE = "volatile"
 ObjectState attribute value for volatile register file type.
 
static const std::string OSKEY_MAX_READS = "max_r"
 ObjectState attribute key for maximum simultaneous readers.
 
static const std::string OSKEY_MAX_WRITES = "max_w"
 ObjectState attribute key for maximum simultaneous writers.
 
static const std::string OSKEY_GUARD_LATENCY = "g_latency"
 ObjectState attribute key for the guard latency.
 
static const std::string OSKEY_ZERO_REGISTER = "zero_register"
 ObjectState attribute key for zero register flag.
 
- Static Public Attributes inherited from TTAMachine::BaseRegisterFile
static const std::string OSNAME_BASE_REGISTER_FILE = "baseregfile"
 ObjectState name for BaseRegisterFile.
 
static const std::string OSKEY_SIZE = "size"
 ObjectState attribute key for the number of registers.
 
static const std::string OSKEY_WIDTH = "width"
 ObjectState attribute key for bit width of the registers.
 
- Static Public Attributes inherited from TTAMachine::Unit
static const std::string OSNAME_UNIT = "unit"
 ObjectState name for Unit.
 
- Static Public Attributes inherited from TTAMachine::Component
static const std::string OSNAME_COMPONENT = "component"
 ObjectState name for component.
 
static const std::string OSKEY_NAME = "name"
 ObjectState attribute key for the name of the component.
 

Private Member Functions

bool updateMaxReadsAndWrites () const
 
 RegisterFile (const RegisterFile &)
 Copying forbidden, use the copy() method.
 
RegisterFileoperator= (const RegisterFile &)
 Assingment forbidden.
 
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.
 
int maxWrites_
 Max number of ports that can read a register all in the same cycle.
 
int guardLatency_
 The guard latency of the register file.
 
Type type_
 Type of the register file.
 
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 ()
 

Detailed Description

Represents a register-file in TTA processor.

Definition at line 47 of file RegisterFile.hh.

Member Enumeration Documentation

◆ Type

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.

50 {
51 NORMAL, ///< Used for general register allocation.
52 RESERVED, ///< Used for custom, user controlled register allocation.
53 VOLATILE ///< Used for user-controlled I/O communication.
54 };
@ VOLATILE
Used for user-controlled I/O communication.
@ NORMAL
Used for general register allocation.
@ RESERVED
Used for custom, user controlled register allocation.

Constructor & Destructor Documentation

◆ RegisterFile() [1/3]

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.

Parameters
nameName of the register file.
sizeNumber of registers in the register file.
widthBit width of the registers in the register file.
maxReadsMaximum simultaneous reads of a register.
maxWritesMaximum simultaneous writes of a register.
maxRwMaximum simultaneous reads of a register in the same cycle the register is written.
typeType of the register file, see RegisterFile::Type.
Exceptions
OutOfRangeIf some of the given parameters has an illegal value.
InvalidNameIf the given name is not a valid component name.

Definition at line 74 of file RegisterFile.cc.

79 maxReads_(0),
80 maxWrites_(0),
82 type_(type),
87}
virtual int size() const
virtual int width() const
BaseRegisterFile(const std::string &name, int size, int width)
virtual TCEString name() const
virtual int maxReads() const
int maxWrites_
Max number of ports that can read a register all in the same cycle.
Type type_
Type of the register file.
virtual void setMaxWrites(int maxWrites)
int maxReads_
Max number of ports that can read a register all in the same cycle.
virtual bool zeroRegister() const
virtual void setMaxReads(int maxReads)
virtual void setGuardLatency(int latency)
virtual int guardLatency() const
virtual RegisterFile::Type type() const
virtual int maxWrites() const
int guardLatency_
The guard latency of the register file.

References guardLatency(), maxReads(), maxWrites(), setGuardLatency(), setMaxReads(), and setMaxWrites().

Here is the call graph for this function:

◆ RegisterFile() [2/3]

TTAMachine::RegisterFile::RegisterFile ( const ObjectState state)
explicit

Constructor.

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

Parameters
stateThe ObjectState from which the name is taken.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState tree is invalid.

Definition at line 99 of file RegisterFile.cc.

100 : BaseRegisterFile(state),
101 maxReads_(0),
102 maxWrites_(0),
103 guardLatency_(0),
104 type_(NORMAL),
105 zeroRegister_(false) {
107}
void loadStateWithoutReferences(const ObjectState *state)

References loadStateWithoutReferences().

Here is the call graph for this function:

◆ ~RegisterFile()

TTAMachine::RegisterFile::~RegisterFile ( )
virtual

Destructor.

Definition at line 112 of file RegisterFile.cc.

112 {
113 unsetMachine();
114}
virtual void unsetMachine()

References unsetMachine().

Here is the call graph for this function:

◆ RegisterFile() [3/3]

TTAMachine::RegisterFile::RegisterFile ( const RegisterFile )
private

Copying forbidden, use the copy() method.

Member Function Documentation

◆ copy()

RegisterFile * TTAMachine::RegisterFile::copy ( ) const
virtual

Creates and returns a copy of the register file.

Returns
Copy of register file.

Definition at line 601 of file RegisterFile.cc.

601 {
602
603 return new RegisterFile(saveState());
604}
virtual ObjectState * saveState() const
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)

References saveState().

Here is the call graph for this function:

◆ deleteGuards()

void TTAMachine::RegisterFile::deleteGuards ( int  registers) const
private

Deletes the guards that refer to registers would not exist if there were the given number of registers in this register file.

Parameters
registersThe number of registers.

Definition at line 492 of file RegisterFile.cc.

492 {
493
494 Machine* mach = machine();
495 if (mach == NULL) {
496 return;
497 }
498
499 // for each bus
500 Machine::BusNavigator navi = mach->busNavigator();
501 for (int busIndex = 0; busIndex < navi.count(); busIndex++) {
502 Bus* bus = navi.item(busIndex);
503 int guardIndex = 0;
504
505 // delete register guards that refer to non-existing registers
506 while (guardIndex < bus->guardCount()) {
507 Guard* guard = bus->guard(guardIndex);
508 RegisterGuard* regGuard =
509 dynamic_cast<RegisterGuard*>(guard);
510 if (regGuard != NULL && regGuard->registerFile() == this &&
511 regGuard->registerIndex() >= registers) {
512
513 // guard is removed from bus automatically
514 delete regGuard;
515 } else {
516 guardIndex++;
517 }
518 }
519 }
520}
virtual Machine * machine() const
Navigator< Bus > BusNavigator
Navigator type for BusNavigator.
Definition Machine.hh:213

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

Here is the call graph for this function:

◆ firstReadPort()

Port * TTAMachine::RegisterFile::firstReadPort ( ) const

Definition at line 607 of file RegisterFile.cc.

607 {
608 for (int i = 0; i < portCount(); i++) {
609 Port* p = port(i);
610 if (p->outputSocket() != NULL) {
611 return p;
612 }
613 }
614 return NULL;
615}
virtual RFPort * port(const std::string &name) const
virtual int portCount() const
Definition Unit.cc:135

References TTAMachine::Port::outputSocket(), TTAMachine::BaseRegisterFile::port(), and TTAMachine::Unit::portCount().

Referenced by RegisterRenamer::renameLiveRange(), BFRenameLiveRange::setTerminals(), BFRegCopyAfter::splitMove(), and BFRegCopyBefore::splitMove().

Here is the call graph for this function:

◆ firstWritePort()

Port * TTAMachine::RegisterFile::firstWritePort ( ) const

Definition at line 618 of file RegisterFile.cc.

618 {
619 for (int i = 0; i < portCount(); i++) {
620 Port* p = port(i);
621 if (p->inputSocket() != NULL) {
622 return p;
623 }
624 }
625 return NULL;
626}

References TTAMachine::Port::inputSocket(), TTAMachine::BaseRegisterFile::port(), and TTAMachine::Unit::portCount().

Referenced by RegisterRenamer::renameLiveRange(), BFRenameLiveRange::setTerminals(), BFRegCopyAfter::splitMove(), and BFRegCopyBefore::splitMove().

Here is the call graph for this function:

◆ guardLatency()

int TTAMachine::RegisterFile::guardLatency ( ) const
virtual

◆ isArchitectureEqual()

bool TTAMachine::RegisterFile::isArchitectureEqual ( const RegisterFile rf) const
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.

Parameters
rfRegister file to compare with.
Returns
True if the register files are architecture equal.

Definition at line 532 of file RegisterFile.cc.

532 {
533
534 if (size() != rf.size()) {
535 return false;
536 }
537 if (width() != rf.width()) {
538 return false;
539 }
540 if (maxReads_ != rf.maxReads()) {
541 return false;
542 }
543 if (maxWrites_ != rf.maxWrites()) {
544 return false;
545 }
546 if (type_ != rf.type()) {
547 return false;
548 }
549 if (guardLatency_ != rf.guardLatency()) {
550 return false;
551 }
552 if (portCount() != rf.portCount()) {
553 return false;
554 }
555 // ports have same width that the register file, so port widths are not
556 // needed to check
557
558 return true;
559}

References guardLatency(), guardLatency_, maxReads(), maxReads_, maxWrites(), maxWrites_, TTAMachine::Unit::portCount(), TTAMachine::BaseRegisterFile::size(), type(), type_, and TTAMachine::BaseRegisterFile::width().

Referenced by MachineResourceModifier::analyzeRegisters().

Here is the call graph for this function:

◆ isNormal()

bool TTAMachine::RegisterFile::isNormal ( ) const
virtual

Returns true if the type of the register file is normal, otherwise false.

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.

158 {
159 return (type_ == NORMAL);
160}

References NORMAL, and type_.

Referenced by ProDeRFEditPolicy::getCommand().

◆ isReserved()

bool TTAMachine::RegisterFile::isReserved ( ) const
virtual

Returns true if the type of the register file is reserved, otherwise false.

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.

184 {
185 return (type_ == RESERVED);
186}

References RESERVED, and type_.

Referenced by TDGen::analyzeRegisters(), and ProDeRFEditPolicy::getCommand().

◆ isUsedAsGuard()

bool TTAMachine::RegisterFile::isUsedAsGuard ( ) const
virtual

Returns true if the register file is used as a guard.

Returns
True if the register file is used as a guard.

Definition at line 567 of file RegisterFile.cc.

567 {
568
569 Machine* mach = machine();
570 if (mach == NULL) {
571 return false;
572 }
573
574 // for each bus
575 Machine::BusNavigator navi = mach->busNavigator();
576 for (int busIndex = 0; busIndex < navi.count(); busIndex++) {
577 Bus* bus = navi.item(busIndex);
578 int guardIndex = 0;
579
580 // check if there are register guards that refer to this register file
581 while (guardIndex < bus->guardCount()) {
582 Guard* guard = bus->guard(guardIndex);
583 RegisterGuard* regGuard =
584 dynamic_cast<RegisterGuard*>(guard);
585 if (regGuard != NULL && regGuard->registerFile() == this) {
586 return true;
587 } else {
588 guardIndex++;
589 }
590 }
591 }
592 return false;
593}

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 ProGeTools::checkForSelectableIU(), Automagic::checkForSelectableIU(), ProGeTools::checkForSelectableRF(), Automagic::checkForSelectableRF(), AutoSelectImplementationsDialog::findRFImplementations(), BlockImplementationDialog::onHDBSelection(), and ComponentImplementationSelector::selectRFs().

Here is the call graph for this function:

◆ isVolatile()

bool TTAMachine::RegisterFile::isVolatile ( ) const
virtual

Returns true if the type of the register file is volatile, otherwise false.

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.

171 {
172 return (type_ == VOLATILE);
173}

References type_, and VOLATILE.

Referenced by ProDeRFEditPolicy::getCommand().

◆ loadState()

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

Loads its state from the given ObjectState instance.

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

Reimplemented from TTAMachine::BaseRegisterFile.

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

Definition at line 433 of file RegisterFile.cc.

433 {
434 const string procName = "RegisterFile::loadState";
437 MOMTextGenerator textGenerator;
438}
virtual void loadState(const ObjectState *state)

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

Referenced by TTAMachine::ImmediateUnit::loadState(), and TTAMachine::Machine::loadState().

Here is the call graph for this function:

◆ loadStateWithoutReferences()

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

Loads the state of the register file without 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 449 of file RegisterFile.cc.

449 {
450 const string procName = "RegisterFile::loadStateWithoutReferences";
451
452 if (! (state->name() == OSNAME_REGISTER_FILE ||
454 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
455 }
456
457 try {
458 string type = state->stringAttribute(OSKEY_TYPE);
459 if (type == OSVALUE_NORMAL) {
461 } else if (type == OSVALUE_RESERVED) {
463 } else if (type == OSVALUE_VOLATILE) {
465 } else {
466 const string errorMsg = "Unknown register file type in "
467 "ObjectState instance.";
469 __FILE__, __LINE__, procName, errorMsg);
470 }
471
475 if (state->hasAttribute(OSKEY_ZERO_REGISTER)) {
477 }
478
479 } catch (const Exception& e) {
481 __FILE__, __LINE__, procName, e.errorMessage());
482 }
483}
std::string errorMessage() const
Definition Exception.cc:123
bool hasAttribute(const std::string &name) const
std::string stringAttribute(const std::string &name) const
bool boolAttribute(const std::string &name) const
int intAttribute(const std::string &name) const
std::string name() const
static const std::string OSNAME_IMMEDIATE_UNIT
ObjectState name for ImmediateUnit.
static const std::string OSKEY_MAX_WRITES
ObjectState attribute key for maximum simultaneous writers.
virtual void setType(RegisterFile::Type type)
virtual void setZeroRegister(const bool &value)
static const std::string OSKEY_MAX_READS
ObjectState attribute key for maximum simultaneous readers.
static const std::string OSKEY_ZERO_REGISTER
ObjectState attribute key for zero register flag.
static const std::string OSKEY_GUARD_LATENCY
ObjectState attribute key for the guard latency.
static const std::string OSVALUE_RESERVED
ObjectState attribute value for reserved register file type.
static const std::string OSVALUE_VOLATILE
ObjectState attribute value for volatile register file type.
static const std::string OSKEY_TYPE
ObjectState attribute key for register file type.
static const std::string OSNAME_REGISTER_FILE
ObjectState name for RegisterFile.
static const std::string OSVALUE_NORMAL
ObjectState attribute value for normal register file type.

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

Here is the call graph for this function:

◆ maxReads()

int TTAMachine::RegisterFile::maxReads ( ) const
virtual

◆ maxWrites()

int TTAMachine::RegisterFile::maxWrites ( ) const
virtual

◆ operator=()

RegisterFile & TTAMachine::RegisterFile::operator= ( const RegisterFile )
private

Assingment forbidden.

◆ saveState()

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

Saves the contents to an ObjectState tree.

Returns
The newly created ObjectState tree.

Reimplemented from TTAMachine::BaseRegisterFile.

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

Definition at line 392 of file RegisterFile.cc.

392 {
393
396
397 // set type
398 switch(type_) {
399 case NORMAL: regFile->setAttribute(OSKEY_TYPE, OSVALUE_NORMAL); break;
401 break;
403 break;
404 default: assert(false);
405 }
406
407 // set max reads
409
410 // set max writes
412
413 // set guard latency
415
416 // set zero register
417 if (zeroRegister_) {
419 }
420
421 return regFile;
422}
#define assert(condition)
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
virtual ObjectState * saveState() const

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

Here is the call graph for this function:

◆ setGuardLatency()

void TTAMachine::RegisterFile::setGuardLatency ( int  latency)
virtual

Sets the guard latency.

Parameters
latencyThe new guard latency.
Exceptions
OutOfRangeIf 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.

346 {
347 if (latency < 0) {
348 throw OutOfRange(__FILE__, __LINE__, __func__);
349 }
350
351 // check that local guard latency + global guard latency > 0
352 if (latency == 0 && isRegistered()) {
353 ControlUnit* gcu = machine()->controlUnit();
354 if (gcu != NULL) {
355 int oldLatency = guardLatency();
356 guardLatency_ = latency;
357 try {
358 // this throws OutOfRange if the local guard latency cannot
359 // be zero
360 gcu->setGlobalGuardLatency(gcu->globalGuardLatency());
361 } catch (const OutOfRange& exception) {
362 guardLatency_ = oldLatency;
363 throw exception;
364 }
365 }
366 }
367
368 guardLatency_ = latency;
369}
#define __func__
virtual bool isRegistered() const
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345

References __func__, TTAMachine::Machine::controlUnit(), TTAMachine::ControlUnit::globalGuardLatency(), guardLatency(), guardLatency_, TTAMachine::Component::isRegistered(), TTAMachine::Component::machine(), and TTAMachine::ControlUnit::setGlobalGuardLatency().

Referenced by loadStateWithoutReferences(), RFDialog::onOK(), and RegisterFile().

Here is the call graph for this function:

◆ setMaxReads()

void TTAMachine::RegisterFile::setMaxReads ( int  reads)
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.

Parameters
readsMaximum number of ports.
Exceptions
OutOfRangeIf the given number of maximum reads is out of range.

Reimplemented in TTAMachine::NullRegisterFile, and UnboundedRegisterFile.

Definition at line 227 of file RegisterFile.cc.

227 {
228 if (reads < 0) {
229 std::string procName = "RegisterFile::setMaxReads";
230 throw OutOfRange(__FILE__, __LINE__, procName);
231 }
232 maxReads_ = reads;
233}

References maxReads_.

Referenced by loadStateWithoutReferences(), and RegisterFile().

◆ setMaxWrites()

void TTAMachine::RegisterFile::setMaxWrites ( int  maxWrites)
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.

Parameters
writesMaximum number of ports.
Exceptions
OutOfRangeIf the given number of maximum writes is out of range.

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

Definition at line 247 of file RegisterFile.cc.

247 {
248 if (maxWrites < 0) {
249 std::string procName = "RegisterFile::setMaxWrites";
250 throw OutOfRange(__FILE__, __LINE__, procName);
251 }
253}

References maxWrites(), and maxWrites_.

Referenced by loadStateWithoutReferences(), RegisterFile(), and TTAMachine::ImmediateUnit::setMaxWrites().

Here is the call graph for this function:

◆ setName()

void TTAMachine::RegisterFile::setName ( const std::string &  name)
virtual

Sets the name of the register file.

Parameters
nameName of the register file.
Exceptions
ComponentAlreadyExistsIf a register file with the given name is already in the same machine.
InvalidNameIf the given name is not a valid component name.

Reimplemented from TTAMachine::Component.

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

Definition at line 198 of file RegisterFile.cc.

198 {
199 if (name == this->name()) {
200 return;
201 }
202
203 if (machine() != NULL) {
204 if (machine()->registerFileNavigator().hasItem(name)) {
205 string procName = "RegisterFile::setName";
206 throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
207 } else {
209 }
210 } else {
212 }
213}
virtual void setName(const std::string &name)

References TTAMachine::Component::machine(), TTAMachine::Component::name(), and TTAMachine::Component::setName().

Referenced by ADFCombiner::addRegisterFiles(), MachineResourceModifier::increaseAllRFsThatDiffersByAmount(), RFDialog::onOK(), and MachineResourceModifier::percentualRegisterIncrease().

Here is the call graph for this function:

◆ setNumberOfRegisters()

void TTAMachine::RegisterFile::setNumberOfRegisters ( int  registers)
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.

Parameters
registersThe new amount of registers.
Exceptions
OutOfRangeIf 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.

320 {
321 if (registers < numberOfRegisters()) {
322 deleteGuards(registers);
323 }
325}
virtual void setNumberOfRegisters(int registers)
virtual int numberOfRegisters() const
void deleteGuards(int registers) const

References deleteGuards(), TTAMachine::BaseRegisterFile::numberOfRegisters(), and TTAMachine::BaseRegisterFile::setNumberOfRegisters().

Referenced by RegisterQuantityCheck::fixIntRegs(), TTAMachine::ImmediateUnit::ImmediateUnit(), IUDialog::onOK(), and RFDialog::onOK().

Here is the call graph for this function:

◆ setType()

void TTAMachine::RegisterFile::setType ( RegisterFile::Type  type)
virtual

Sets the type of the register file.

Parameters
typeType of the register file.

Reimplemented in TTAMachine::NullRegisterFile.

Definition at line 304 of file RegisterFile.cc.

304 {
305 type_ = type;
306}

References type(), and type_.

Referenced by loadStateWithoutReferences(), and RFDialog::onOK().

Here is the call graph for this function:

◆ setZeroRegister()

void TTAMachine::RegisterFile::setZeroRegister ( const bool &  value)
virtual

Definition at line 634 of file RegisterFile.cc.

634 {
635 zeroRegister_ = value;
636}

References zeroRegister_.

Referenced by loadStateWithoutReferences(), and RFDialog::onOK().

◆ type()

RegisterFile::Type TTAMachine::RegisterFile::type ( ) const
virtual

Returns the type of the register file.

Returns
Type of the register file.

Reimplemented in TTAMachine::NullRegisterFile.

Definition at line 147 of file RegisterFile.cc.

147 {
148 return type_;
149}

References type_.

Referenced by isArchitectureEqual(), loadStateWithoutReferences(), setType(), and RFDialog::updateWidgets().

◆ unsetMachine()

void TTAMachine::RegisterFile::unsetMachine ( )
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.

375 {
376 Machine* mach = machine();
377 if (mach == NULL) {
378 return;
379 }
380 deleteGuards(0);
382 mach->removeRegisterFile(*this);
383}
virtual void unsetMachine()=0

References deleteGuards(), TTAMachine::Component::machine(), TTAMachine::Machine::removeRegisterFile(), and TTAMachine::Component::unsetMachine().

Referenced by ~RegisterFile().

Here is the call graph for this function:

◆ updateMaxReadsAndWrites()

bool TTAMachine::RegisterFile::updateMaxReadsAndWrites ( ) const
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.

Returns
True if max reads/writes changed
Exceptions
OutOfRangeIf setMaxReads/setMaxWrites throws outOfRange exception.

Definition at line 266 of file RegisterFile.cc.

266 {
267 int reads = 0;
268 int writes = 0;
269 bool changed = false;
270
271 for (int p = 0; p < portCount(); ++p) {
272 if (!port(p)->isOutput() && !port(p)->isInput()) {
273
274 // do not count unconnected ports
275 //++reads;
276 //++writes;
277
278 } else {
279 if (port(p)->isOutput()) {
280 changed = true;
281 ++reads;
282 }
283 if (port(p)->isInput()) {
284 changed = true;
285 ++writes;
286 }
287 }
288 }
289
290 if (changed)
291 {
292 maxReads_ = reads;
293 maxWrites_ = writes;
294 }
295 return changed;
296}
virtual bool isInput() const
Definition Port.cc:298
virtual bool isOutput() const
Definition Port.cc:308

References TTAMachine::Port::isInput(), TTAMachine::Port::isOutput(), maxReads_, maxWrites_, TTAMachine::BaseRegisterFile::port(), and TTAMachine::Unit::portCount().

Referenced by maxReads(), and maxWrites().

Here is the call graph for this function:

◆ zeroRegister()

bool TTAMachine::RegisterFile::zeroRegister ( ) const
virtual

Member Data Documentation

◆ guardLatency_

int TTAMachine::RegisterFile::guardLatency_
private

The guard latency of the register file.

Definition at line 133 of file RegisterFile.hh.

Referenced by guardLatency(), isArchitectureEqual(), saveState(), and setGuardLatency().

◆ maxReads_

int TTAMachine::RegisterFile::maxReads_
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().

◆ maxWrites_

int TTAMachine::RegisterFile::maxWrites_
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().

◆ OSKEY_GUARD_LATENCY

const string TTAMachine::RegisterFile::OSKEY_GUARD_LATENCY = "g_latency"
static

ObjectState attribute key for the guard latency.

Definition at line 108 of file RegisterFile.hh.

Referenced by loadStateWithoutReferences(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), and saveState().

◆ OSKEY_MAX_READS

const string TTAMachine::RegisterFile::OSKEY_MAX_READS = "max_r"
static

◆ OSKEY_MAX_WRITES

const string TTAMachine::RegisterFile::OSKEY_MAX_WRITES = "max_w"
static

◆ OSKEY_TYPE

const string TTAMachine::RegisterFile::OSKEY_TYPE = "type"
static

◆ OSKEY_ZERO_REGISTER

const string TTAMachine::RegisterFile::OSKEY_ZERO_REGISTER = "zero_register"
static

ObjectState attribute key for zero register flag.

Definition at line 110 of file RegisterFile.hh.

Referenced by loadStateWithoutReferences(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), and saveState().

◆ OSNAME_REGISTER_FILE

const string TTAMachine::RegisterFile::OSNAME_REGISTER_FILE = "reg_file"
static

◆ OSVALUE_NORMAL

const string TTAMachine::RegisterFile::OSVALUE_NORMAL = "normal"
static

ObjectState attribute value for normal register file type.

Definition at line 98 of file RegisterFile.hh.

Referenced by loadStateWithoutReferences(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), and saveState().

◆ OSVALUE_RESERVED

const string TTAMachine::RegisterFile::OSVALUE_RESERVED = "reserved"
static

ObjectState attribute value for reserved register file type.

Definition at line 100 of file RegisterFile.hh.

Referenced by loadStateWithoutReferences(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), and saveState().

◆ OSVALUE_VOLATILE

const string TTAMachine::RegisterFile::OSVALUE_VOLATILE = "volatile"
static

ObjectState attribute value for volatile register file type.

Definition at line 102 of file RegisterFile.hh.

Referenced by loadStateWithoutReferences(), ADFSerializer::registerFileToMachine(), ADFSerializer::registerFileToMDF(), and saveState().

◆ type_

Type TTAMachine::RegisterFile::type_
private

Type of the register file.

Definition at line 136 of file RegisterFile.hh.

Referenced by isArchitectureEqual(), isNormal(), isReserved(), isVolatile(), saveState(), setType(), and type().

◆ zeroRegister_

bool TTAMachine::RegisterFile::zeroRegister_
private

Definition at line 138 of file RegisterFile.hh.

Referenced by saveState(), setZeroRegister(), and zeroRegister().


The documentation for this class was generated from the following files: