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

#include <Bus.hh>

Inheritance diagram for TTAMachine::Bus:
Inheritance graph
Collaboration diagram for TTAMachine::Bus:
Collaboration graph

Public Member Functions

 Bus (const std::string &name, int width, int immWidth, Machine::Extension extensionMode)
 
 Bus (const ObjectState *state)
 
virtual ~Bus ()
 
virtual Buscopy () const
 
virtual void copyGuardsTo (Bus &other) const
 
 operator Segment & ()
 
virtual int position () const
 
int width () const
 
int immediateWidth () const
 
bool signExtends () const
 
bool zeroExtends () const
 
virtual void setName (const std::string &name)
 
virtual void setWidth (int width)
 
virtual void setImmediateWidth (int width)
 
virtual void setZeroExtends ()
 
virtual void setSignExtends ()
 
virtual void setExtensionMode (const Machine::Extension extension)
 
virtual void addSegment (Segment &segment)
 
virtual void removeSegment (Segment &segment)
 
virtual bool hasSegment (const std::string &name) const
 
virtual Segmentsegment (int index) const
 
virtual Segmentsegment (const std::string &name) const
 
virtual int segmentCount () const
 
virtual bool isConnectedTo (const Socket &socket) const
 
bool hasGuard (const Guard &guard) const
 
void addGuard (Guard &guard)
 
virtual void removeGuard (Guard &guard)
 
int guardCount () const
 
Guardguard (int index) const
 
virtual bool hasNextBus () const
 
virtual bool hasPreviousBus () const
 
virtual BusnextBus () const
 
virtual BuspreviousBus () const
 
virtual bool canRead (const Bus &bus) const
 
virtual bool canWrite (const Bus &bus) const
 
virtual bool canReadWrite (const Bus &bus) const
 
virtual void setSourceBridge (Bridge &bridge)
 
virtual void setDestinationBridge (Bridge &bridge)
 
virtual void clearSourceBridge (Bridge &bridge)
 
virtual void clearDestinationBridge (Bridge &bridge)
 
virtual void setMachine (Machine &mach)
 
virtual void unsetMachine ()
 
virtual ObjectStatesaveState () const
 
virtual void loadState (const ObjectState *state)
 
virtual bool isArchitectureEqual (const Bus &bus) const
 
- 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_BUS = "bus"
 ObjectState name for Bus ObjectState.
 
static const std::string OSKEY_WIDTH = "width"
 ObjectState attribute key for bus width.
 
static const std::string OSKEY_IMMWIDTH = "immwidth"
 ObjectState attribute key for immediate width.
 
static const std::string OSKEY_EXTENSION = "extension"
 ObjectState attribute key for extension mode.
 
static const std::string OSVALUE_SIGN = "sign"
 ObjectState attribute value for sign extension.
 
static const std::string OSVALUE_ZERO = "zero"
 ObjectState attribute key for zero extension.
 
- 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 Types

typedef std::vector< Guard * > GuardTable
 Vector of Guard pointers.
 
typedef std::vector< Segment * > SegmentTable
 Vector of Segment pointers.
 
typedef std::vector< Bridge * > BridgeTable
 

Private Member Functions

Busoperator= (const Bus &)
 Assingment forbidden.
 
void loadStateWithoutReferences (const ObjectState *state)
 
void deleteAllSegments ()
 
void deleteAllGuards ()
 
BridgepreviousBridge () const
 
BridgenextBridge () const
 
BridgepreviousBridge (const BridgeTable &bridges) const
 
BridgenextBridge (const BridgeTable &bridges) const
 
void adjustSegmentChain (const ObjectState *busState)
 

Private Attributes

int width_
 Bit width of the bus.
 
int immWidth_
 Bit width of the inline immediate word.
 
Machine::Extension extensionMode_
 Extension mode applied to the inline immediate word.
 
GuardTable guards_
 Contains all guards of the bus.
 
SegmentTable segments_
 Contains all the segments of the bus.
 
BridgeTable sourceBridges_
 Contains the source bridges (max 2).
 
BridgeTable destinationBridges_
 Contains the destination bridges (max 2).
 

Additional Inherited Members

- 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 bus in TTA-processor.

Definition at line 53 of file Bus.hh.

Member Typedef Documentation

◆ BridgeTable

typedef std::vector<Bridge*> TTAMachine::Bus::BridgeTable
private

Definition at line 134 of file Bus.hh.

◆ GuardTable

typedef std::vector<Guard*> TTAMachine::Bus::GuardTable
private

Vector of Guard pointers.

Definition at line 130 of file Bus.hh.

◆ SegmentTable

typedef std::vector<Segment*> TTAMachine::Bus::SegmentTable
private

Vector of Segment pointers.

Definition at line 132 of file Bus.hh.

Constructor & Destructor Documentation

◆ Bus() [1/2]

TTAMachine::Bus::Bus ( const std::string &  name,
int  width,
int  immWidth,
Machine::Extension  extensionMode 
)

Constructor.

Parameters
nameName of the bus.
widthBit width of the bus.
immWidthBit width of the inline immediate word.
extensionModeExtension mode applied to the inline immediate word when it is narrower than the bus on which it is transported.
Exceptions
OutOfRangeIf the given width or immediate width is invalid.
InvalidNameIf the given name is not a valid component name.

Definition at line 74 of file Bus.cc.

77 : Component(name),
79 immWidth_(immWidth),
80 extensionMode_(extensionMode) {
81 if (width <= 0 || immWidth < 0 || immWidth > width) {
82 string procName = "Bus::Bus";
83 throw OutOfRange(__FILE__, __LINE__, procName);
84 }
85}
Machine::Extension extensionMode_
Extension mode applied to the inline immediate word.
Definition Bus.hh:152
int width_
Bit width of the bus.
Definition Bus.hh:148
int width() const
Definition Bus.cc:149
int immWidth_
Bit width of the inline immediate word.
Definition Bus.hh:150
Component(const std::string &name)
virtual TCEString name() const

References width().

Here is the call graph for this function:

◆ Bus() [2/2]

TTAMachine::Bus::Bus ( const ObjectState state)

Constructor.

Loads the state of the bus from the given ObjectState instance. Does not load connections to sockets.

Parameters
stateRoot node of the ObjectState tree from which the state is loaded.
Exceptions
ObjectStateLoadingExceptionIf the given ObjectState instance is invalid.

Definition at line 98 of file Bus.cc.

98 : Component(state) {
99 try {
101 } catch (Exception&) {
104 throw;
105 }
106}
void deleteAllGuards()
Definition Bus.cc:930
void loadStateWithoutReferences(const ObjectState *state)
Definition Bus.cc:863
void deleteAllSegments()
Definition Bus.cc:918

References deleteAllGuards(), deleteAllSegments(), and loadStateWithoutReferences().

Here is the call graph for this function:

◆ ~Bus()

TTAMachine::Bus::~Bus ( )
virtual

Destructor.

Before destruction detaches all sockets from the bus.

Definition at line 113 of file Bus.cc.

113 {
114 unsetMachine();
117}
virtual void unsetMachine()
Definition Bus.cc:683

References deleteAllGuards(), deleteAllSegments(), and unsetMachine().

Here is the call graph for this function:

Member Function Documentation

◆ addGuard()

void TTAMachine::Bus::addGuard ( Guard guard)

Adds guard to the bus.

Parameters
guardPointer to the Guard object to be added.
Exceptions
ComponentAlreadyExistsIf there is an equal guard already.

Definition at line 410 of file Bus.cc.

410 {
411 if (hasGuard(guard)) {
412 string procName = "Bus::addGuard";
413 throw ComponentAlreadyExists(__FILE__, __LINE__, __func__,
414 "Bus already has the given guard!");
415 }
416
417 guards_.push_back(&guard);
418}
#define __func__
GuardTable guards_
Contains all guards of the bus.
Definition Bus.hh:155
bool hasGuard(const Guard &guard) const
Definition Bus.cc:393
Guard * guard(int index) const
Definition Bus.cc:456

References __func__, guard(), guards_, and hasGuard().

Referenced by TTAMachine::PortGuard::PortGuard(), TTAMachine::PortGuard::PortGuard(), TTAMachine::RegisterGuard::RegisterGuard(), TTAMachine::RegisterGuard::RegisterGuard(), TTAMachine::UnconditionalGuard::UnconditionalGuard(), and TTAMachine::UnconditionalGuard::UnconditionalGuard().

Here is the call graph for this function:

◆ addSegment()

void TTAMachine::Bus::addSegment ( Segment segment)
virtual

Adds the given segment to this bus.

This method should be called by Segment constructor only.

Parameters
segmentSegment to be added.
Exceptions
ComponentAlreadyExistsIf a segment with the same name as the given segment is already existing in this bus.

Definition at line 737 of file Bus.cc.

737 {
738 // run time check: can be called from Segment constructor only
739 assert(segment.parentBus() == NULL);
740
741 if (hasSegment(segment.name())) {
742 string procname = "Bus::addSegment";
743 throw ComponentAlreadyExists(__FILE__, __LINE__, procname);
744 } else {
745 segments_.push_back(&segment);
746 }
747}
#define assert(condition)
virtual bool hasSegment(const std::string &name) const
Definition Bus.cc:284
virtual Segment * segment(int index) const
Definition Bus.cc:329
SegmentTable segments_
Contains all the segments of the bus.
Definition Bus.hh:157
std::string name() const
Bus * parentBus() const

References assert, hasSegment(), TTAMachine::Segment::name(), TTAMachine::Segment::parentBus(), segment(), and segments_.

Referenced by TTAMachine::Segment::Segment(), and TTAMachine::Segment::Segment().

Here is the call graph for this function:

◆ adjustSegmentChain()

void TTAMachine::Bus::adjustSegmentChain ( const ObjectState busState)
private

Adjusts the order of segments according to the order represented by the given ObjectState tree.

Parameters
busStateObjectState tree representing the state of this bus.
Exceptions
ObjectStateLoadingExceptionIf the segment chain is erroneus in the given ObjectState tree.

Definition at line 1027 of file Bus.cc.

1027 {
1028 const string procName = "Bus::adjustSegmentChain";
1029
1030 if (segmentCount() == 0) {
1032 return;
1033 }
1034
1035 MOMTextGenerator textGenerator;
1036
1037 try {
1038 // find the last segment, the segment that has no destination
1039 Segment* lastSegment = NULL;
1040 for (int i = 0; i < busState->childCount(); i++) {
1041 ObjectState* childState = busState->child(i);
1042 if (childState->name() == Segment::OSNAME_SEGMENT &&
1044 string lastSegmentName =
1046 lastSegment = segment(lastSegmentName);
1047 break;
1048 }
1049 }
1050
1051 // if last segment was not found, throw
1052 if (lastSegment == NULL) {
1053 format errorMsg = textGenerator.text(
1055 errorMsg % name();
1057 __FILE__, __LINE__, procName, errorMsg.str());
1058 }
1059
1060 Segment* destSegment = lastSegment;
1061 int modifications = 0;
1062
1063 // in the following loop, find a segment whose destination should be
1064 // lastSegment and set it in front of that segment
1065 while (modifications < segmentCount() - 1) {
1066 bool chainModified = false;
1067 for (int i = 0; i < busState->childCount(); i++) {
1068 ObjectState* childState = busState->child(i);
1069 if (childState->name() == Segment::OSNAME_SEGMENT &&
1071 string destName = childState->stringAttribute(
1073 if (destName == destSegment->name()) {
1074 string thisName = childState->
1075 stringAttribute(Segment::OSKEY_NAME);
1076 Segment* thisSegment = segment(thisName);
1077 thisSegment->moveBefore(*destSegment);
1078 destSegment = thisSegment;
1079 modifications++;
1080 chainModified = true;
1081 }
1082 }
1083 }
1084
1085 // if the source segment was not found and the segment chain is not
1086 // set completely yet, throw
1087 if (!chainModified && modifications < segmentCount() - 1) {
1088 format errorMsg = textGenerator.text(
1090 errorMsg % name() % destSegment->name();
1092 __FILE__, __LINE__, procName, errorMsg.str());
1093 }
1094 }
1095 } catch (Exception& exception) {
1097 __FILE__, __LINE__, procName, exception.errorMessage());
1098 }
1099}
std::string errorMessage() const
Definition Exception.cc:123
bool hasAttribute(const std::string &name) const
bool hasChild(const std::string &name) const
ObjectState * child(int index) const
std::string stringAttribute(const std::string &name) const
std::string name() const
int childCount() const
virtual int segmentCount() const
Definition Bus.cc:385
static const std::string OSKEY_DESTINATION
ObjectState attribute key for destination segment name.
Definition Segment.hh:91
static const std::string OSNAME_SEGMENT
ObjectState name for Segment.
Definition Segment.hh:87
static const std::string OSKEY_NAME
ObjectState attribute key for segment name.
Definition Segment.hh:89
virtual boost::format text(int textId)

References assert, ObjectState::child(), ObjectState::childCount(), Exception::errorMessage(), ObjectState::hasAttribute(), ObjectState::hasChild(), TTAMachine::Segment::moveBefore(), TTAMachine::Component::name(), TTAMachine::Segment::name(), ObjectState::name(), TTAMachine::Segment::OSKEY_DESTINATION, TTAMachine::Segment::OSKEY_NAME, TTAMachine::Segment::OSNAME_SEGMENT, segment(), segmentCount(), ObjectState::stringAttribute(), Texts::TextGenerator::text(), MOMTextGenerator::TXT_NO_LAST_SEGMENT, and MOMTextGenerator::TXT_NO_SOURCE_SEGMENT.

Referenced by loadStateWithoutReferences().

Here is the call graph for this function:

◆ canRead()

bool TTAMachine::Bus::canRead ( const Bus bus) const
virtual

Checks if the bus can read from the given bus.

That is, checks if the given bus is source bus of this bus.

Parameters
busThe bus.
Returns
True if this bus can read from the given bus.

Definition at line 537 of file Bus.cc.

537 {
538 BridgeTable::const_iterator iter = sourceBridges_.begin();
539 while (iter != sourceBridges_.end()) {
540 if ((*iter)->sourceBus() == &bus) {
541 return true;
542 }
543 iter++;
544 }
545 return false;
546}
BridgeTable sourceBridges_
Contains the source bridges (max 2).
Definition Bus.hh:160

References sourceBridges_.

Referenced by canReadWrite(), BEMValidator::needsSourceField(), and TTAMachine::Bridge::setSourceAndDestination().

◆ canReadWrite()

bool TTAMachine::Bus::canReadWrite ( const Bus bus) const
virtual

Check if the bus can both read from and write to the given bus.

That is, checks if the given bus is joined by a bidirectional bridge to this bus.

Parameters
busThe bus.
Returns
True if this bus can both read from and write to the given bus.

Definition at line 580 of file Bus.cc.

580 {
581 return canWrite(bus) && canRead(bus);
582}
virtual bool canWrite(const Bus &bus) const
Definition Bus.cc:558
virtual bool canRead(const Bus &bus) const
Definition Bus.cc:537

References canRead(), and canWrite().

Here is the call graph for this function:

◆ canWrite()

bool TTAMachine::Bus::canWrite ( const Bus bus) const
virtual

Checks if the bus can write to the given bus.

That is, checks if the given bus is destination bus of this bus.

Parameters
busThe bus.
Returns
True if this bus can write to the given bus.

Definition at line 558 of file Bus.cc.

558 {
559 BridgeTable::const_iterator iter = destinationBridges_.begin();
560 while (iter != destinationBridges_.end()) {
561 if ((*iter)->destinationBus() == &bus) {
562 return true;
563 }
564 iter++;
565 }
566 return false;
567}
BridgeTable destinationBridges_
Contains the destination bridges (max 2).
Definition Bus.hh:162

References destinationBridges_.

Referenced by MachineTester::canBridge(), canReadWrite(), and TTAMachine::Bridge::setSourceAndDestination().

◆ clearDestinationBridge()

void TTAMachine::Bus::clearDestinationBridge ( Bridge bridge)
virtual

Removes a destination bridge from the bus.

This method can be called from Bridge destructor only. Do not call this method.

Parameters
bridgeThe destination bridge to remove.

Definition at line 652 of file Bus.cc.

652 {
653
654 // run time check: can be called from Bridge destructor only
655 assert(bridge.sourceBus() == NULL);
656
658 destinationBridges_, &bridge);
659 assert(removed);
660}
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)

References assert, destinationBridges_, ContainerTools::removeValueIfExists(), and TTAMachine::Bridge::sourceBus().

Referenced by TTAMachine::Bridge::unsetMachine().

Here is the call graph for this function:

◆ clearSourceBridge()

void TTAMachine::Bus::clearSourceBridge ( Bridge bridge)
virtual

Removes a source bridge from the bus.

This method can be called from Bridge destructor only. Do not call this method.

Parameters
bridgeThe source bridge to remove.

Definition at line 632 of file Bus.cc.

632 {
633
634 // run time check: can be called from Bridge destructor only
635 assert(bridge.destinationBus() == NULL);
636
638 sourceBridges_, &bridge);
639 assert(removed);
640}

References assert, TTAMachine::Bridge::destinationBus(), ContainerTools::removeValueIfExists(), and sourceBridges_.

Referenced by TTAMachine::Bridge::unsetMachine().

Here is the call graph for this function:

◆ copy()

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

Copies the bus.

Returns
Copy of the Bus.

Definition at line 1145 of file Bus.cc.

1145 {
1146 ObjectState* newBusState = saveState();
1147 Bus* newBus = new Bus(newBusState);
1148
1149 delete newBusState;
1150 newBusState = NULL;
1151 return newBus;
1152}
virtual ObjectState * saveState() const
Definition Bus.cc:773
Bus(const std::string &name, int width, int immWidth, Machine::Extension extensionMode)
Definition Bus.cc:74

References saveState().

Referenced by MachineResourceModifier::addBusesByAmount().

Here is the call graph for this function:

◆ copyGuardsTo()

void TTAMachine::Bus::copyGuardsTo ( Bus other) const
virtual

Definition at line 1155 of file Bus.cc.

1155 {
1156 for (int i = 0; i < guardCount(); ++i) {
1157 if (!other.hasGuard(*guard(i)))
1158 guard(i)->copyTo(other);
1159 }
1160}
int guardCount() const
Definition Bus.cc:441
virtual void copyTo(Bus &parentBus) const =0

References TTAMachine::Guard::copyTo(), guard(), guardCount(), and hasGuard().

Referenced by ADFCombiner::addAllGuardsToConnectionBuses(), and MachineResourceModifier::addBusesByAmount().

Here is the call graph for this function:

◆ deleteAllGuards()

void TTAMachine::Bus::deleteAllGuards ( )
private

Deletes all the guards.

Definition at line 930 of file Bus.cc.

930 {
931 // guard destructor removes the pointer from the table
932 while (guards_.size() > 0) {
933 delete guards_[0];
934 }
935}

References guards_.

Referenced by Bus(), loadState(), and ~Bus().

◆ deleteAllSegments()

void TTAMachine::Bus::deleteAllSegments ( )
private

Deletes all the segments.

Definition at line 918 of file Bus.cc.

918 {
919 // segment destructor removes the pointer from the table
920 while (segments_.size() > 0) {
921 delete segments_[0];
922 }
923}

References segments_.

Referenced by Bus(), loadState(), and ~Bus().

◆ guard()

Guard * TTAMachine::Bus::guard ( int  index) const

Returns the guard by the given index.

The index must be between 0 and the return value of numberOfGuards() - 1.

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

Definition at line 456 of file Bus.cc.

456 {
457 if (index < 0 || static_cast<size_t>(index) >= guards_.size()) {
458 string procName = "Bus::guard";
459 throw OutOfRange(__FILE__, __LINE__, procName);
460 }
461 return guards_[index];
462}

References guards_.

Referenced by BEMGenerator::addEncodings(), BEMGenerator::addEncodings(), BEMGenerator::addEncodings(), addGuard(), BusBroker::allAvailableResources(), TDGen::analyzeRegisters(), BusBroker::assign(), MachineStateBuilder::buildMachineState(), BusBroker::canTransportImmediate(), ProgrammabilityValidator::checkBooleanRegister(), BEMValidator::checkGuardField(), TTAMachine::FunctionUnit::cleanupGuards(), TTAMachine::FUPort::cleanupGuards(), CompiledSimCodeGenerator::CompiledSimCodeGenerator(), DefaultDecoderGenerator::completeDecoderBlock(), ADFCombiner::copyGuards(), copyGuardsTo(), llvm::LLVMTCEBuilder::createGuard(), TTAProgram::CodeGenerator::createInverseGuard(), ProgramDependenceGraph::createJump(), TTAMachine::RegisterFile::deleteGuards(), PasteComponentCmd::Do(), findBooleanGuard(), DefaultDecoderGenerator::findGuard(), DefaultDecoderGenerator::findGuard(), TTAProgram::TPEFProgramFactory::findGuard(), RegisterRenamer::findGuardRegisters(), RegisterQuantityCheck::findGuardRegisters(), ProgrammabilityValidator::findRegisterGuard(), RegisterCopyAdder::findTempRegisters(), MachineConnectivityCheck::hasBothGuards(), MachineConnectivityCheck::hasConditionalMoves(), hasGuard(), BusBroker::hasGuard(), TTAMachine::ControlUnit::hasLocalGuardLatencyOfZero(), BEMGenerator::hasUnconditionalGuard(), isArchitectureEqual(), BusBroker::isAvailable(), TTAMachine::RegisterFile::isUsedAsGuard(), MachineInfo::longestGuardLatency(), RFGuardDialog::onOK(), BusDialog::onUnconditionalGuard(), BFLateBypassGuard::operator()(), MachineResourceManager::registerFileIndexReference(), removeGuard(), RegisterRenamer::renameLiveRange(), HDB::RFArchitecture::RFArchitecture(), HDB::RFArchitecture::RFArchitecture(), MachineResourceManager::rFPortOrFUIndexReference(), saveState(), BFRenameLiveRange::setGuard(), BusDialog::updateGuardLists(), and DefaultDecoderGenerator::writeSquashSignalGenerationProcess().

◆ guardCount()

int TTAMachine::Bus::guardCount ( ) const

Returns the number of guards in the bus.

Returns
The number of guards in the bus.

Definition at line 441 of file Bus.cc.

441 {
442 return guards_.size();
443}

References guards_.

Referenced by BEMGenerator::addEncodings(), BEMGenerator::addEncodings(), BEMGenerator::addEncodings(), BEMGenerator::addSubfields(), BusBroker::allAvailableResources(), TDGen::analyzeRegisters(), BusBroker::assign(), MachineStateBuilder::buildMachineState(), BusBroker::buildResources(), BusBroker::canTransportImmediate(), ProgrammabilityValidator::checkBooleanRegister(), BEMValidator::checkGuardField(), CompiledSimCodeGenerator::CompiledSimCodeGenerator(), DefaultDecoderGenerator::completeDecoderBlock(), ADFCombiner::copyGuards(), copyGuardsTo(), llvm::LLVMTCEBuilder::createGuard(), TTAProgram::CodeGenerator::createInverseGuard(), ProgramDependenceGraph::createJump(), PasteComponentCmd::Do(), findBooleanGuard(), DefaultDecoderGenerator::findGuard(), DefaultDecoderGenerator::findGuard(), TTAProgram::TPEFProgramFactory::findGuard(), RegisterRenamer::findGuardRegisters(), RegisterQuantityCheck::findGuardRegisters(), ProgrammabilityValidator::findRegisterGuard(), RegisterCopyAdder::findTempRegisters(), MachineConnectivityCheck::hasBothGuards(), MachineConnectivityCheck::hasConditionalMoves(), BusBroker::hasGuard(), TTAMachine::ControlUnit::hasLocalGuardLatencyOfZero(), BEMGenerator::hasUnconditionalGuard(), isArchitectureEqual(), BusBroker::isAvailable(), MachineInfo::longestGuardLatency(), MachineAnalysis::MachineAnalysis(), RFGuardDialog::onOK(), BusDialog::onUnconditionalGuard(), BFLateBypassGuard::operator()(), MachineResourceManager::registerFileIndexReference(), RegisterRenamer::renameLiveRange(), HDB::RFArchitecture::RFArchitecture(), HDB::RFArchitecture::RFArchitecture(), MachineResourceManager::rFPortOrFUIndexReference(), saveState(), BFRenameLiveRange::setGuard(), BusDialog::updateGuardLists(), and DefaultDecoderGenerator::writeSquashSignalGenerationProcess().

◆ hasGuard()

bool TTAMachine::Bus::hasGuard ( const Guard guard) const

Checks whether the bus has the given guard.

Definition at line 393 of file Bus.cc.

393 {
394 for (GuardTable::const_iterator iter = guards_.begin();
395 iter != guards_.end(); iter++) {
396 if ((*iter)->isEqual(guard)) {
397 return true;
398 }
399 }
400 return false;
401}

References guard(), and guards_.

Referenced by addGuard(), MachineConnectivityCheck::canTransportImmediate(), ADFCombiner::connectRegisterFiles(), and copyGuardsTo().

Here is the call graph for this function:

◆ hasNextBus()

bool TTAMachine::Bus::hasNextBus ( ) const
virtual

Checks if the bus has next bus.

Next does not mean destination bus in that case but the next bus from location point of view.

Returns
True if the bus has next bus, otherwise false.

Definition at line 488 of file Bus.cc.

488 {
489 Bridge* nextBridge = this->nextBridge();
490 return nextBridge != NULL;
491}
Bridge * nextBridge() const
Definition Bus.cc:965

References nextBridge().

Referenced by TTAMachine::Bridge::adjustChainDirection(), MachineTester::areInSameChain(), MachineTester::canBridge(), MachineEditPartFactory::getBusChains(), BEMValidator::needsSourceField(), and TTAMachine::Bridge::setFirstOfChain().

Here is the call graph for this function:

◆ hasPreviousBus()

bool TTAMachine::Bus::hasPreviousBus ( ) const
virtual

Checks if the bus has previous bus.

Previous does not mean source in that case but the previous bus from location point of view.

Returns
True if the bus has previous bus, otherwise false.

Definition at line 473 of file Bus.cc.

473 {
474 Bridge* prevBridge = previousBridge();
475 return prevBridge != NULL;
476}
Bridge * previousBridge() const
Definition Bus.cc:947

References previousBridge().

Referenced by MachineTester::areInSameChain(), MachineTester::canBridge(), MachineEditPartFactory::getBusChains(), BEMValidator::needsSourceField(), and TTAMachine::Bridge::setFirstOfChain().

Here is the call graph for this function:

◆ hasSegment()

bool TTAMachine::Bus::hasSegment ( const std::string &  name) const
virtual

Returns true if the bus has a segment with the given name.

Parameters
nameName of the segment.
Returns
True if the bus has a segment with the given name, otherwise false.

Definition at line 284 of file Bus.cc.

284 {
285 SegmentTable::const_iterator iter = segments_.begin();
286 while (iter != segments_.end()) {
287 if ((*iter)->name() == name) {
288 return true;
289 }
290 iter++;
291 }
292 return false;
293}

References TTAMachine::Component::name(), and segments_.

Referenced by addSegment(), ADFCombiner::createBus(), TTAMachine::Segment::loadStateWithoutReferences(), and BusDialog::onAddSegment().

Here is the call graph for this function:

◆ immediateWidth()

int TTAMachine::Bus::immediateWidth ( ) const

◆ isArchitectureEqual()

bool TTAMachine::Bus::isArchitectureEqual ( const Bus bus) const
virtual

Checks is this bus architecture equal with the given bus.

Architecture equality means that buses have same widths, immediate widths, extension modes, number of segments and same guards. Bridges are not checked.

Parameters
busBus to compare with.
Returns
True if the buses are architecture equal.

Definition at line 1111 of file Bus.cc.

1111 {
1112
1113 if (width() != bus.width() ||
1114 immediateWidth() != bus.immediateWidth() ||
1115 signExtends() != bus.signExtends() ||
1116 segmentCount() != bus.segmentCount()) {
1117 return false;
1118 }
1119 for (int i = 0; i < guardCount(); i++) {
1120 bool match = false;
1121
1122 // check if there is matching guard in another bus
1123 for (int j = 0; j < bus.guardCount(); j++) {
1124 if (guard(i)->isEqual(*bus.guard(j))) {
1125 match = true;
1126 break;
1127 }
1128 }
1129
1130 // if no matching guard was not found buses are not equal
1131 if (match == false) {
1132 return false;
1133 }
1134 // otherwise continue to next guard
1135 }
1136 return true;
1137}
int immediateWidth() const
Definition Bus.cc:160
bool signExtends() const
Definition Bus.cc:171
virtual bool isEqual(const Guard &guard) const =0

References guard(), guardCount(), immediateWidth(), TTAMachine::Guard::isEqual(), segmentCount(), signExtends(), and width().

Referenced by MachineResourceModifier::analyzeBuses().

Here is the call graph for this function:

◆ isConnectedTo()

bool TTAMachine::Bus::isConnectedTo ( const Socket socket) const
virtual

Returns true if the bus is connected to the given socket, otherwise false.

Parameters
socketSocket.
Returns
True if the bus is connected to the given socket, otherwise false.

Definition at line 303 of file Bus.cc.

303 {
304
305 SegmentTable::const_iterator iter = segments_.begin();
306 while (iter != segments_.end()) {
307 if ((*iter)->isConnectedTo(socket)) {
308 return true;
309 }
310 iter++;
311 }
312 return false;
313}

References segments_.

Referenced by DefaultICDecoderEstimator::busParameters().

◆ loadState()

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

Loads the state of the object from the given ObjectState instance.

Parameters
stateThe ObjectState instance.
Exceptions
ObjectStateLoadingExceptionIf the name of this bus becomes the same as an existing bus in the same machine or if generating references to other components did not succeed.

Reimplemented from TTAMachine::Component.

Definition at line 816 of file Bus.cc.

816 {
819
820 // load state without references to other machine parts
821 try {
823
824 // create guards and load states of segments
825 for (int i = 0; i < state->childCount(); i++) {
826 ObjectState* childState = state->child(i);
827 if (childState->name() == PortGuard::OSNAME_PORT_GUARD) {
828 // guard is registered automatically
829 new PortGuard(childState, *this);
830 } else if (childState->name() ==
832 // guard is registered automatically
833 new RegisterGuard(childState, *this);
834 } else if (childState->name() ==
836 // guard is registered automatically.
837 new UnconditionalGuard(childState, *this);
838 } else if (childState->name() == Segment::OSNAME_SEGMENT) {
839 string segmentName =
841 Segment* segment = this->segment(segmentName);
842 segment->loadState(childState);
843 }
844 }
845 } catch (Exception& exception) {
846 const string procName = "Bus::loadState";
848 __FILE__, __LINE__, procName, exception.errorMessage());
849 }
850}
static const std::string OSNAME_PORT_GUARD
ObjectState name for PortGuard ObjectState.
Definition Guard.hh:117
static const std::string OSNAME_REGISTER_GUARD
ObjectState name for RegisterGuard.
Definition Guard.hh:159
virtual void loadState(const ObjectState *state)
Definition Segment.cc:448
static const std::string OSNAME_UNCONDITIONAL_GUARD
ObjectState name for UnconditionalGuard.
Definition Guard.hh:195

References ObjectState::child(), ObjectState::childCount(), deleteAllGuards(), deleteAllSegments(), Exception::errorMessage(), TTAMachine::Segment::loadState(), loadStateWithoutReferences(), ObjectState::name(), TTAMachine::Segment::OSKEY_NAME, TTAMachine::PortGuard::OSNAME_PORT_GUARD, TTAMachine::RegisterGuard::OSNAME_REGISTER_GUARD, TTAMachine::Segment::OSNAME_SEGMENT, TTAMachine::UnconditionalGuard::OSNAME_UNCONDITIONAL_GUARD, segment(), and ObjectState::stringAttribute().

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

Here is the call graph for this function:

◆ loadStateWithoutReferences()

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

Loads the state of the object from the given ObjectState tree without references to other components/subcomponents.

Parameters
stateRoot node of the ObjectState tree.
Exceptions
ObjectStateLoadingExceptionIf a bus by the same name is already registered to the same machine or if the given ObjectState tree is invalid.

Definition at line 863 of file Bus.cc.

863 {
864 const string procName = "Bus::loadStateWithoutReferences";
865
866 if (state->name() != OSNAME_BUS) {
868 __FILE__, __LINE__, procName,
869 "Invalid XML object state for a bus, name: " + state->name());
870 }
871
873
874 // read attributes
875 try {
878 string extensionMode = state->stringAttribute(OSKEY_EXTENSION);
879 if (extensionMode == OSVALUE_SIGN) {
881 } else if (extensionMode == OSVALUE_ZERO) {
883 } else {
884 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
885 }
886 } catch (Exception& e) {
887 throw ObjectStateLoadingException(__FILE__, __LINE__, procName,
888 e.errorMessage());
889 }
890
891 // create all segments, guards are not created because they are
892 // completely useless without references
893 for (int i = 0; i < state->childCount(); i++) {
894 ObjectState* child = state->child(i);
895 if (child->name() == Segment::OSNAME_SEGMENT) {
896 try {
897 // segment is attached automatically
898 new Segment(child, *this);
899 } catch (const ComponentAlreadyExists&) {
900 MOMTextGenerator textGen;
901 format errorMsg = textGen.text(
903 errorMsg % child->stringAttribute(Segment::OSKEY_NAME) %
904 name();
906 __FILE__, __LINE__, procName, errorMsg.str());
907 }
908 }
909 }
910
911 adjustSegmentChain(state);
912}
int intAttribute(const std::string &name) const
void adjustSegmentChain(const ObjectState *busState)
Definition Bus.cc:1027
virtual void setImmediateWidth(int width)
Definition Bus.cc:241
virtual void setSignExtends()
Definition Bus.cc:262
static const std::string OSKEY_EXTENSION
ObjectState attribute key for extension mode.
Definition Bus.hh:122
static const std::string OSKEY_WIDTH
ObjectState attribute key for bus width.
Definition Bus.hh:118
virtual void setZeroExtends()
Definition Bus.cc:253
static const std::string OSNAME_BUS
ObjectState name for Bus ObjectState.
Definition Bus.hh:116
static const std::string OSVALUE_ZERO
ObjectState attribute key for zero extension.
Definition Bus.hh:126
static const std::string OSVALUE_SIGN
ObjectState attribute value for sign extension.
Definition Bus.hh:124
static const std::string OSKEY_IMMWIDTH
ObjectState attribute key for immediate width.
Definition Bus.hh:120
virtual void setWidth(int width)
Definition Bus.cc:223
virtual void loadState(const ObjectState *state)

References adjustSegmentChain(), ObjectState::child(), ObjectState::childCount(), Exception::errorMessage(), ObjectState::intAttribute(), TTAMachine::Component::loadState(), TTAMachine::Component::name(), ObjectState::name(), OSKEY_EXTENSION, OSKEY_IMMWIDTH, TTAMachine::Segment::OSKEY_NAME, OSKEY_WIDTH, OSNAME_BUS, TTAMachine::Segment::OSNAME_SEGMENT, OSVALUE_SIGN, OSVALUE_ZERO, setImmediateWidth(), setSignExtends(), setWidth(), setZeroExtends(), ObjectState::stringAttribute(), Texts::TextGenerator::text(), and MOMTextGenerator::TXT_SEGMENT_WITH_SAME_NAME.

Referenced by Bus(), and loadState().

Here is the call graph for this function:

◆ nextBridge() [1/2]

Bridge * TTAMachine::Bus::nextBridge ( ) const
private

Returns a bridge that joins this bus and the next bus of this bus.

If there is two such bridges, returns one of them. If there is no such a bridge, returns NULL.

Returns
Next bridge or NULL.

Definition at line 965 of file Bus.cc.

965 {
966 Bridge* nextBridge = this->nextBridge(sourceBridges_);
967 if (nextBridge == NULL) {
969 }
970 return nextBridge;
971}

References destinationBridges_, nextBridge(), and sourceBridges_.

Referenced by hasNextBus(), nextBridge(), and nextBus().

Here is the call graph for this function:

◆ nextBridge() [2/2]

Bridge * TTAMachine::Bus::nextBridge ( const BridgeTable bridges) const
private

Returns a bridge that joins this bus and the next bus of this bus.

Returns NULL if such a bridge does not exist.

Parameters
bridgeThe bridge table to look for the bridge.
Returns
The next bridge.

Definition at line 1005 of file Bus.cc.

1005 {
1006 BridgeTable::const_iterator iter = bridges.begin();
1007 while (iter != bridges.end()) {
1008 Bridge* bridge = *iter;
1009 if (bridge->previousBus() == this) {
1010 return bridge;
1011 }
1012 iter++;
1013 }
1014 return NULL;
1015}

References TTAMachine::Bridge::previousBus().

Here is the call graph for this function:

◆ nextBus()

Bus * TTAMachine::Bus::nextBus ( ) const
virtual

Returns the next bus from the location point of view.

Returns
The next bus.
Exceptions
InstanceNotFoundIf the bus is the last in the chain.

Definition at line 501 of file Bus.cc.

501 {
502 Bridge* nextBridge = this->nextBridge();
503 if (nextBridge != NULL) {
504 return nextBridge->nextBus();
505 } else {
506 string procName = "Bus::nextBus";
507 throw InstanceNotFound(__FILE__, __LINE__, procName);
508 }
509}
Bus * nextBus() const
Definition Bridge.cc:179

References nextBridge(), and TTAMachine::Bridge::nextBus().

Referenced by TTAMachine::Bridge::adjustChainDirection(), MachineTester::areInSameChain(), MachineTester::canBridge(), MachineEditPartFactory::findConnectedBridges(), MachineEditPartFactory::getBusChains(), and BEMValidator::needsSourceField().

Here is the call graph for this function:

◆ operator Segment &()

TTAMachine::Bus::operator Segment & ( )
inline

Definition at line 62 of file Bus.hh.

62{ return *this->segment(0); }

References segment().

Here is the call graph for this function:

◆ operator=()

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

Assingment forbidden.

◆ position()

int TTAMachine::Bus::position ( ) const
virtual

Returns the position of the bus in move slot order.

Returns
The position (0 is the first position).
Exceptions
NotAvailableIf the bus is not registered to a machine.

Definition at line 127 of file Bus.cc.

127 {
128 if (!isRegistered()) {
129 throw NotAvailable(__FILE__, __LINE__, __func__);
130 }
131
133 for (int i = 0; i < busNav.count(); i++) {
134 if (busNav.item(i) == this) {
135 return i;
136 }
137 }
138
139 assert(false);
140 return 0;
141}
virtual Machine * machine() const
virtual bool isRegistered() const
Navigator< Bus > BusNavigator
Navigator type for BusNavigator.
Definition Machine.hh:213
virtual BusNavigator busNavigator() const
Definition Machine.cc:356

References __func__, assert, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Component::isRegistered(), TTAMachine::Machine::Navigator< ComponentType >::item(), and TTAMachine::Component::machine().

Referenced by BusFactory::createEditPart().

Here is the call graph for this function:

◆ previousBridge() [1/2]

Bridge * TTAMachine::Bus::previousBridge ( ) const
private

Returns a bridge that joins this bus and the previous bus of this bus.

If there is two such bridges, returns one of them. If there is no such a bridge, returns NULL.

Returns
Previous bridge or NULL.

Definition at line 947 of file Bus.cc.

947 {
948 Bridge* prevBridge = previousBridge(sourceBridges_);
949 if (prevBridge == NULL) {
951 }
952 return prevBridge;
953}

References destinationBridges_, previousBridge(), and sourceBridges_.

Referenced by hasPreviousBus(), previousBridge(), and previousBus().

Here is the call graph for this function:

◆ previousBridge() [2/2]

Bridge * TTAMachine::Bus::previousBridge ( const BridgeTable bridges) const
private

Returns a bridge that joins this bus and the previous bus of this bus.

Returns NULL if such a bridge does not exist.

Parameters
bridgeThe bridge table to look for the bridge.
Returns
The previous bridge.

Definition at line 983 of file Bus.cc.

983 {
984 BridgeTable::const_iterator iter = bridges.begin();
985 while (iter != bridges.end()) {
986 Bridge* bridge = *iter;
987 if (bridge->nextBus() == this) {
988 return bridge;
989 }
990 iter++;
991 }
992 return NULL;
993}

References TTAMachine::Bridge::nextBus().

Here is the call graph for this function:

◆ previousBus()

Bus * TTAMachine::Bus::previousBus ( ) const
virtual

Returns the previous bus from the location point of view.

Returns
The previous bus.
Exceptions
InstanceNotFoundIf the bus is the first in the chain.

Definition at line 518 of file Bus.cc.

518 {
519 Bridge* prevBridge = previousBridge();
520 if (prevBridge != NULL) {
521 return prevBridge->previousBus();
522 } else {
523 string procName = "Bus::previousBus";
524 throw InstanceNotFound(__FILE__, __LINE__, procName);
525 }
526}

References previousBridge(), and TTAMachine::Bridge::previousBus().

Referenced by MachineTester::areInSameChain(), MachineTester::canBridge(), MachineEditPartFactory::getBusChains(), BEMValidator::needsSourceField(), and TTAMachine::Bridge::setFirstOfChain().

Here is the call graph for this function:

◆ removeGuard()

void TTAMachine::Bus::removeGuard ( Guard guard)
virtual

Removes the given guard from the bus.

This method should be called by Guard destructor only.

Parameters
guardGuard to be removed.

Definition at line 428 of file Bus.cc.

428 {
429 // run time check: can be called from Guard destructor only
430 assert(guard.parentBus() == NULL);
432}
virtual Bus * parentBus() const

References assert, guard(), guards_, TTAMachine::Guard::parentBus(), and ContainerTools::removeValueIfExists().

Referenced by TTAMachine::Guard::~Guard().

Here is the call graph for this function:

◆ removeSegment()

void TTAMachine::Bus::removeSegment ( Segment segment)
virtual

Removes the given segment from the bus.

This method should be called by Segment destructor only.

Parameters
segmentSegment to be removed.

Definition at line 757 of file Bus.cc.

757 {
758
759 // run time check: can be called from Segment destructor only
760 assert(segment.parentBus() == NULL);
761
763 assert(removed);
764}

References assert, TTAMachine::Segment::parentBus(), ContainerTools::removeValueIfExists(), segment(), and segments_.

Referenced by TTAMachine::Segment::~Segment().

Here is the call graph for this function:

◆ saveState()

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

Saves the contents to an ObjectState tree.

Returns
Root of the created tree.

Reimplemented from TTAMachine::Component.

Definition at line 773 of file Bus.cc.

773 {
774
775 ObjectState* busState = Component::saveState();
776
777 // change the name of the ObjectState
778 busState->setName(OSNAME_BUS);
779
780 // set attributes
781 busState->setAttribute(OSKEY_WIDTH, width_);
785 } else if (extensionMode_ == Machine::ZERO) {
787 }
788
789 // add segments
790 for (int i = 0; i < segmentCount(); i++) {
791 Segment* seg = segment(i);
792 busState->addChild(seg->saveState());
793 }
794
795 // save guards
796 for (int i = 0; i < guardCount(); i++) {
797 Guard* currentGuard = guard(i);
798 busState->addChild(currentGuard->saveState());
799 }
800
801 return busState;
802}
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
void addChild(ObjectState *child)
virtual ObjectState * saveState() const
@ SIGN
Sign extension.
Definition Machine.hh:82
@ ZERO
Zero extension.
Definition Machine.hh:81

References ObjectState::addChild(), extensionMode_, guard(), guardCount(), immWidth_, OSKEY_EXTENSION, OSKEY_IMMWIDTH, OSKEY_WIDTH, OSNAME_BUS, OSVALUE_SIGN, OSVALUE_ZERO, TTAMachine::Guard::saveState(), TTAMachine::Component::saveState(), TTAMachine::Segment::saveState(), segment(), segmentCount(), ObjectState::setAttribute(), ObjectState::setName(), TTAMachine::Machine::SIGN, width_, and TTAMachine::Machine::ZERO.

Referenced by copy().

Here is the call graph for this function:

◆ segment() [1/2]

Segment * TTAMachine::Bus::segment ( const std::string &  name) const
virtual

Returns the segment which has the given name.

Parameters
nameName of the segment.
Returns
Segment which has the given name.
Exceptions
InstanceNotFoundIf the bus does not contain a segment by the given name.

Definition at line 365 of file Bus.cc.

365 {
366 SegmentTable::const_iterator iter = segments_.begin();
367 while (iter != segments_.end()) {
368 if ((*iter)->name() == name) {
369 return *iter;
370 }
371 iter++;
372 }
373
374 // requested segment not found
375 string procName = "Bus::segment";
376 throw InstanceNotFound(__FILE__, __LINE__, procName);
377}

References TTAMachine::Component::name(), and segments_.

Here is the call graph for this function:

◆ segment() [2/2]

Segment * TTAMachine::Bus::segment ( int  index) const
virtual

Returns the bus segment at a given index.

The index must be greater or equal to 0 and less than the number of segments. The segments are returned in the correct order. Thus, index 0 returns the first segment in the segment chain, index 1 returns its destination segment and so on.

Parameters
indexIndex.
Returns
The segment found on the given index.
Exceptions
OutOfRangeIf the given index is out of range.

Definition at line 329 of file Bus.cc.

329 {
330 if (index < 0 || index >= segmentCount()) {
331 string procName = "Bus::segment";
332 throw OutOfRange(__FILE__, __LINE__, procName);
333 }
334
335 // find the first segment of the chain
336 Segment* firstSegment = NULL;
337 SegmentTable::const_iterator iter = segments_.begin();
338 while (iter != segments_.end()) {
339 Segment* segment = *iter;
340 if (!segment->hasSourceSegment()) {
341 firstSegment = segment;
342 break;
343 }
344 iter++;
345 }
346
347 // follow the segment chain until the requested segment is reached
348 Segment* nextSegment = firstSegment;
349 for (int i = 0; i < index; i++) {
350 nextSegment = nextSegment->destinationSegment();
351 }
352
353 return nextSegment;
354}
Segment * destinationSegment() const
bool hasSourceSegment() const
Definition Segment.cc:388

References TTAMachine::Segment::destinationSegment(), TTAMachine::Segment::hasSourceSegment(), segment(), segmentCount(), and segments_.

Referenced by ADFCombiner::addBuses(), SimpleICOptimizer::addConnections(), addSegment(), adjustSegmentChain(), FullyConnectedCheck::attachSocketToAllBusses(), BusBroker::buildResources(), DefaultDecoderGenerator::busCntrlSignalPinOfSocket(), BEMValidator::checkDestinationField(), BEMValidator::checkSourceField(), BusFactory::createEditPart(), ADFCombiner::createPortsAndSockets(), BlocksTranslator::Deinitialize(), TTAMachine::Socket::detachBus(), InfoBussesCommand::execute(), VLIWConnectIC::explore(), CostEstimator::Estimator::findAllICPaths(), DefaultICGenerator::inputSockets(), DefaultICGenerator::isBusConnected(), TTAMachine::Socket::isConnectedTo(), ProgrammabilityValidator::listConnections(), loadState(), TTAMachine::Socket::loadState(), CostEstimator::Estimator::longestPath(), BEMValidator::needsSourceField(), operator Segment &(), DefaultICGenerator::outputSockets(), removeSegment(), saveState(), TTAMachine::Segment::Segment(), segment(), BusDialog::selectedSegment(), TTAMachine::Segment::setName(), BusBroker::setupResourceLinks(), BEMGenerator::socket(), FullyConnectedCheck::socketAttachedToAllBusses(), BEMGenerator::socketCount(), ConnectionSweeper::sweepBypasses(), ConnectionSweeper::sweepRFs(), SocketDialog::updateConnected(), BusDialog::updateSegmentList(), DefaultDecoderGenerator::writeControlRulesOfFUInputPort(), and DefaultDecoderGenerator::writeControlRulesOfRFWritePort().

Here is the call graph for this function:

◆ segmentCount()

int TTAMachine::Bus::segmentCount ( ) const
virtual

◆ setDestinationBridge()

void TTAMachine::Bus::setDestinationBridge ( Bridge bridge)
virtual

Adds a destination bridge for the bus.

This method can be called from methods of Bridge only. Do not call this method.

Parameters
bridgeThe destination bridge to add.

Definition at line 613 of file Bus.cc.

613 {
614
615 // run time check: can be called from Bridge methods only
616 assert(bridge.sourceBus() == NULL);
617
618 assert(destinationBridges_.size() < 2);
619 destinationBridges_.push_back(&bridge);
620}

References assert, destinationBridges_, and TTAMachine::Bridge::sourceBus().

Referenced by TTAMachine::Bridge::setSourceAndDestination().

Here is the call graph for this function:

◆ setExtensionMode()

void TTAMachine::Bus::setExtensionMode ( const Machine::Extension  extension)
virtual

Sets the extension mode.

Definition at line 271 of file Bus.cc.

271 {
272 extensionMode_ = extension;
273}

References extensionMode_.

◆ setImmediateWidth()

void TTAMachine::Bus::setImmediateWidth ( int  width)
virtual

Sets the number of bits of inline immediates.

Parameters
widthThe bit width of inline immediates.
Exceptions
OutOfRangeIf the given width is negative or greater than the bit width of the bus.

Definition at line 241 of file Bus.cc.

241 {
242 if (width < 0 || width > this->width()) {
243 string procName = "Bus::setImmediateWidth";
244 throw OutOfRange(__FILE__, __LINE__, procName);
245 }
247}

References immWidth_, and width().

Referenced by VLIWConnectIC::explore(), loadStateWithoutReferences(), and BusDialog::onOK().

Here is the call graph for this function:

◆ setMachine()

void TTAMachine::Bus::setMachine ( Machine mach)
virtual

Registers the bus to a machine.

Parameters
machMachine to which the bus is going to be registered.
Exceptions
ComponentAlreadyExistsIf the given machine already has another bus by the same name.

Implements TTAMachine::Component.

Definition at line 671 of file Bus.cc.

671 {
672 internalSetMachine(mach);
673 mach.addBus(*this);
674}
void internalSetMachine(Machine &machine)

References TTAMachine::Machine::addBus(), and TTAMachine::Component::internalSetMachine().

Referenced by AddBusCmd::Do().

Here is the call graph for this function:

◆ setName()

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

Sets the name of the bus.

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

Reimplemented from TTAMachine::Component.

Definition at line 196 of file Bus.cc.

196 {
197 if (name == this->name()) {
198 return;
199 }
200
201 if (machine() != NULL) {
202 if (machine()->busNavigator().hasItem(name) ||
203 machine()->immediateSlotNavigator().hasItem(name)) {
204 string procName = "Bus::setName";
205 throw ComponentAlreadyExists(__FILE__, __LINE__, procName);
206 } else {
208 }
209 } else {
211 }
212}
virtual void setName(const std::string &name)

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

Referenced by ADFCombiner::addBuses(), MachineResourceModifier::addBusesByAmount(), and BusDialog::onOK().

Here is the call graph for this function:

◆ setSignExtends()

void TTAMachine::Bus::setSignExtends ( )
virtual

Sets the sign extension mode.

Definition at line 262 of file Bus.cc.

262 {
264}

References extensionMode_, and TTAMachine::Machine::SIGN.

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

◆ setSourceBridge()

void TTAMachine::Bus::setSourceBridge ( Bridge bridge)
virtual

Adds a source bridge for the bus.

This method can be called from methods of Bridge only. Do not call this method.

Parameters
bridgeThe source bridge to add.

Definition at line 594 of file Bus.cc.

594 {
595
596 // run time check: can be called from Bridge methods only
597 assert(bridge.destinationBus() == NULL);
598
599 assert(sourceBridges_.size() < 2);
600 sourceBridges_.push_back(&bridge);
601}

References assert, TTAMachine::Bridge::destinationBus(), and sourceBridges_.

Referenced by TTAMachine::Bridge::setSourceAndDestination().

Here is the call graph for this function:

◆ setWidth()

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

Sets the bit width of the bus.

Parameters
widthThe new bit width of the bus.
Exceptions
OutOfRangeIf the given width is less or equal to zero or if there is an instruction template that has greater bit width for this slot.

Definition at line 223 of file Bus.cc.

223 {
224 const string procName = "Bus::setWidth";
225
226 if (width <= 0) {
227 throw OutOfRange(__FILE__, __LINE__, procName);
228 }
229
230 width_ = width;
231}

References width(), and width_.

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

Here is the call graph for this function:

◆ setZeroExtends()

void TTAMachine::Bus::setZeroExtends ( )
virtual

Sets the zero extension mode.

Definition at line 253 of file Bus.cc.

253 {
255}

References extensionMode_, and TTAMachine::Machine::ZERO.

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

◆ signExtends()

bool TTAMachine::Bus::signExtends ( ) const

◆ unsetMachine()

void TTAMachine::Bus::unsetMachine ( )
virtual

Removes registration of the bus from its current machine.

Detaches all the sockets attached to the bus and deletes all the guards and modifies instruction templates to not use this bus.

Implements TTAMachine::Component.

Definition at line 683 of file Bus.cc.

683 {
684
685 Machine* mach = machine();
686
687 if (mach == NULL) {
688 return;
689 }
690
692
693 // detach all sockets
694 SegmentTable::iterator iter = segments_.begin();
695 while (iter != segments_.end()) {
696 (*iter)->detachAllSockets();
697 iter++;
698 }
699
700 // delete bridges
701 Machine::BridgeNavigator bNavigator = mach->bridgeNavigator();
702 for (int i = 0; i < bNavigator.count();) {
703 if (bNavigator.item(i)->sourceBus() == this ||
704 bNavigator.item(i)->destinationBus() == this) {
705 // deleting bridge removes it automatically from the container,
706 // no iterator increment needed
707 delete bNavigator.item(i);
708 } else {
709 i++;
710 }
711 }
712
713 // delete the template slot that uses the bus
715 mach->instructionTemplateNavigator();
716 for (int i = 0; i < itNav.count(); i++) {
717 InstructionTemplate* it = itNav.item(i);
718 it->removeSlot(name());
719 }
720
721 mach->removeBus(*this);
722}
Navigator< Bridge > BridgeNavigator
Navigator type for BridgeNavigator.
Definition Machine.hh:221
Navigator< InstructionTemplate > InstructionTemplateNavigator
Navigator type for InstructionTemplateNavigator.
Definition Machine.hh:225

References TTAMachine::Machine::bridgeNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Component::internalUnsetMachine(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), TTAMachine::Component::name(), TTAMachine::Machine::removeBus(), TTAMachine::InstructionTemplate::removeSlot(), and segments_.

Referenced by ~Bus().

Here is the call graph for this function:

◆ width()

int TTAMachine::Bus::width ( ) const

◆ zeroExtends()

bool TTAMachine::Bus::zeroExtends ( ) const

Returns true if the bus uses zero extension.

Returns
True if the bus uses zero extension.

Definition at line 182 of file Bus.cc.

182 {
184}

References extensionMode_, and TTAMachine::Machine::ZERO.

Referenced by CompiledSimSymbolGenerator::moveOperandSymbol(), DefaultDecoderGenerator::simmPortWidth(), DefaultICGenerator::simmPortWidth(), and DefaultICGenerator::writeInterconnectionNetwork().

Member Data Documentation

◆ destinationBridges_

BridgeTable TTAMachine::Bus::destinationBridges_
private

Contains the destination bridges (max 2).

Definition at line 162 of file Bus.hh.

Referenced by canWrite(), clearDestinationBridge(), nextBridge(), previousBridge(), and setDestinationBridge().

◆ extensionMode_

Machine::Extension TTAMachine::Bus::extensionMode_
private

Extension mode applied to the inline immediate word.

Definition at line 152 of file Bus.hh.

Referenced by saveState(), setExtensionMode(), setSignExtends(), setZeroExtends(), signExtends(), and zeroExtends().

◆ guards_

GuardTable TTAMachine::Bus::guards_
private

Contains all guards of the bus.

Definition at line 155 of file Bus.hh.

Referenced by addGuard(), deleteAllGuards(), guard(), guardCount(), hasGuard(), and removeGuard().

◆ immWidth_

int TTAMachine::Bus::immWidth_
private

Bit width of the inline immediate word.

Definition at line 150 of file Bus.hh.

Referenced by immediateWidth(), saveState(), and setImmediateWidth().

◆ OSKEY_EXTENSION

const string TTAMachine::Bus::OSKEY_EXTENSION = "extension"
static

ObjectState attribute key for extension mode.

Definition at line 122 of file Bus.hh.

Referenced by ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), loadStateWithoutReferences(), and saveState().

◆ OSKEY_IMMWIDTH

const string TTAMachine::Bus::OSKEY_IMMWIDTH = "immwidth"
static

ObjectState attribute key for immediate width.

Definition at line 120 of file Bus.hh.

Referenced by ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), loadStateWithoutReferences(), and saveState().

◆ OSKEY_WIDTH

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

ObjectState attribute key for bus width.

Definition at line 118 of file Bus.hh.

Referenced by ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), loadStateWithoutReferences(), and saveState().

◆ OSNAME_BUS

const string TTAMachine::Bus::OSNAME_BUS = "bus"
static

◆ OSVALUE_SIGN

const string TTAMachine::Bus::OSVALUE_SIGN = "sign"
static

ObjectState attribute value for sign extension.

Definition at line 124 of file Bus.hh.

Referenced by ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), loadStateWithoutReferences(), and saveState().

◆ OSVALUE_ZERO

const string TTAMachine::Bus::OSVALUE_ZERO = "zero"
static

ObjectState attribute key for zero extension.

Definition at line 126 of file Bus.hh.

Referenced by ADFSerializer::busToMachine(), ADFSerializer::busToMDF(), loadStateWithoutReferences(), and saveState().

◆ segments_

SegmentTable TTAMachine::Bus::segments_
private

Contains all the segments of the bus.

Definition at line 157 of file Bus.hh.

Referenced by addSegment(), deleteAllSegments(), hasSegment(), isConnectedTo(), removeSegment(), segment(), segment(), segmentCount(), and unsetMachine().

◆ sourceBridges_

BridgeTable TTAMachine::Bus::sourceBridges_
private

Contains the source bridges (max 2).

Definition at line 160 of file Bus.hh.

Referenced by canRead(), clearSourceBridge(), nextBridge(), previousBridge(), and setSourceBridge().

◆ width_

int TTAMachine::Bus::width_
private

Bit width of the bus.

Definition at line 148 of file Bus.hh.

Referenced by saveState(), setWidth(), and width().


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