OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
SocketBusConnCmd Class Reference

#include <SocketBusConnCmd.hh>

Inheritance diagram for SocketBusConnCmd:
Inheritance graph
Collaboration diagram for SocketBusConnCmd:
Collaboration graph

Public Member Functions

 SocketBusConnCmd (TTAMachine::Socket *socket, TTAMachine::Segment *segment)
 
virtual ~SocketBusConnCmd ()
 
virtual bool Do ()
 
- Public Member Functions inherited from ComponentCommand
 ComponentCommand ()
 
virtual ~ComponentCommand ()
 
wxWindow * parentWindow ()
 
void setParentWindow (wxWindow *window)
 

Private Attributes

TTAMachine::Socketsocket_
 Socket to connect.
 
TTAMachine::Segmentsegment_
 Bus segment to connect.
 

Detailed Description

Command for connecting/disconencting sockets to bus segments.

Definition at line 43 of file SocketBusConnCmd.hh.

Constructor & Destructor Documentation

◆ SocketBusConnCmd()

SocketBusConnCmd::SocketBusConnCmd ( TTAMachine::Socket socket,
TTAMachine::Segment segment 
)

The Constructor.

Parameters
segmentSegment to connect/disconnect.
socketSocket to connect/disconnect.

Definition at line 52 of file SocketBusConnCmd.cc.

52 :
54 socket_(socket), segment_(segment) {
55}
TTAMachine::Socket * socket_
Socket to connect.
TTAMachine::Segment * segment_
Bus segment to connect.

◆ ~SocketBusConnCmd()

SocketBusConnCmd::~SocketBusConnCmd ( )
virtual

The Destructor.

Definition at line 61 of file SocketBusConnCmd.cc.

61 {
62}

Member Function Documentation

◆ Do()

bool SocketBusConnCmd::Do ( )
virtual

Executes the command.

Returns
true, if the command was succesfully executed, false otherwise.

Implements ComponentCommand.

Definition at line 71 of file SocketBusConnCmd.cc.

71 {
72
74 try {
76 } catch (Exception& e) {
77 return false;
78 }
79 } else {
80 try {
81 // If there was no direction before for this socket, let's
82 // try to figure out a better guess for it after connected
83 // to a port.
84 bool resetDirection =
87
88 if (resetDirection && socket_->portCount() > 0) {
89 if (FUPort *port = dynamic_cast<FUPort*>(socket_->port(0))) {
91 dynamic_cast<FunctionUnit*>(port->parentUnit());
92 for (int i = 0; i < FUnit->operationCount(); ++i) {
93 HWOperation* hwOp = FUnit->operation(i);
94 if (!hwOp->isBound(*port)) continue;
95 int operandId = hwOp->io(*port);
96 OperationPool opPool;
97 Operation& osalOp = opPool.operation(hwOp->name().c_str());
98 if (osalOp.isNull()) break;
99 if (osalOp.operand(operandId).isInput())
101 else
103 break;
104 }
105 } else if (RFPort* port =
106 dynamic_cast<RFPort*>(socket_->port(0))) {
107 // RF ports have no other direction clue but the naming, which
108 // is often 'rd' or 'wr'. rd is for a port that is _used for_
109 // reading data (thus OUTPUT). This is probably a better guess
110 // than always assuming one or another.
111 if (port->name().size() > 0 && port->name()[0] == 'r')
113 else
115 }
116 }
117 // HERE.
118 } catch (Exception& e) {
119 return false;
120 }
121 }
122
123 return true;
124}
virtual bool isInput() const
Definition Operand.cc:145
Operation & operation(const char *name)
bool isNull() const
virtual Operand & operand(int id) const
Definition Operation.cc:541
virtual HWOperation * operation(const std::string &name) const
virtual int operationCount() const
int io(const FUPort &port) const
const std::string & name() const
bool isBound(const FUPort &port) const
void setDirection(Direction direction)
Definition Socket.cc:130
@ OUTPUT
Data goes from port to bus.
Definition Socket.hh:60
@ INPUT
Data goes from bus to port.
Definition Socket.hh:59
@ UNKNOWN
Unknown direction.
Definition Socket.hh:61
bool isConnectedTo(const Bus &bus) const
Definition Socket.cc:331
void detachBus(Segment &bus)
Definition Socket.cc:213
Direction direction() const
Port * port(int index) const
Definition Socket.cc:266
void attachBus(Segment &bus)
Definition Socket.cc:166
int portCount() const

References TTAMachine::Socket::attachBus(), TTAMachine::Socket::detachBus(), TTAMachine::Socket::direction(), TTAMachine::Socket::INPUT, TTAMachine::HWOperation::io(), TTAMachine::HWOperation::isBound(), TTAMachine::Socket::isConnectedTo(), Operand::isInput(), Operation::isNull(), TTAMachine::HWOperation::name(), Operation::operand(), OperationPool::operation(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::Socket::OUTPUT, TTAMachine::Socket::port(), TTAMachine::Socket::portCount(), segment_, TTAMachine::Socket::setDirection(), socket_, and TTAMachine::Socket::UNKNOWN.

Here is the call graph for this function:

Member Data Documentation

◆ segment_

TTAMachine::Segment* SocketBusConnCmd::segment_
private

Bus segment to connect.

Definition at line 55 of file SocketBusConnCmd.hh.

Referenced by Do().

◆ socket_

TTAMachine::Socket* SocketBusConnCmd::socket_
private

Socket to connect.

Definition at line 53 of file SocketBusConnCmd.hh.

Referenced by Do().


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