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

#include <BlocksGCU.hh>

Collaboration diagram for BlocksGCU:
Collaboration graph

Public Member Functions

 BlocksGCU (TTAMachine::Machine &mach, const std::string &name, TTAMachine::AddressSpace &asInstr)
 
 ~BlocksGCU ()
 

Public Attributes

TTAMachine::ControlUnitgcu
 
TTAMachine::FUPortpc
 
TTAMachine::FUPortval
 
TTAMachine::SpecialRegisterPortra
 
TTAMachine::SocketraIn
 
TTAMachine::SocketraOut
 
TTAMachine::SocketpcIn
 
TTAMachine::SocketvalIn
 
TTAMachine::BusraBus
 
std::list< std::string > sources
 

Private Member Functions

void ConfigurePipeline (TTAMachine::ExecutionPipeline *pipeline, int numOfOperands)
 
void BindPorts (TTAMachine::HWOperation *hwOp, int numOfOperands)
 
TTAMachine::HWOperationCreateHWOp (const std::string &name, int numOfOperands)
 

Private Attributes

std::vector< TTAMachine::HWOperation * > ops
 

Detailed Description

Definition at line 46 of file BlocksGCU.hh.

Constructor & Destructor Documentation

◆ BlocksGCU()

BlocksGCU::BlocksGCU ( TTAMachine::Machine mach,
const std::string &  name,
TTAMachine::AddressSpace asInstr 
)

BlocksGCU with default instructions

Parameters
machThe TTA machine where the GCU(ABU) needs to be added.
nameThe name of the GCU.
asInstrThe address space containing the program instructions.

Definition at line 44 of file BlocksGCU.cc.

45 {
46 int delaySlots = 2;
47 int globalGuardLatency = 1;
48 gcu = new ControlUnit(name, delaySlots, globalGuardLatency);
49 mach.setGlobalControl(*gcu);
50 gcu->setAddressSpace(&asInstr);
51
52 // TODO(mm): add check if there is not already a GCU present
53 pc = new FUPort("pc", 32, *gcu, true, true, true);
54 val = new FUPort("value", 32, *gcu, false, false, true);
55 ra = new SpecialRegisterPort("ra", 32, *gcu);
56
57 // Create in and ouput sockets for 'special RA port'
58 raIn = new Socket("raIn");
59 raOut = new Socket("abu_out0");
60 valIn = new Socket("value");
61 pcIn = new Socket("pc");
62 mach.addSocket(*raIn);
63 mach.addSocket(*raOut);
64 mach.addSocket(*valIn);
65 mach.addSocket(*pcIn);
70
71 // Connect in and out socket to bus
72 const int busWidth = 32;
73 const int immWidth = 0;
74 Machine::Extension busExt = Machine::Extension::ZERO;
75 Bus* raBus = new Bus("ra_out_to_ra_in", busWidth, immWidth, busExt);
76 mach.addBus(*raBus);
77 new UnconditionalGuard(false, *raBus);
78 new Segment("seg1", *raBus);
82 raOut->setDirection(Socket::Direction::OUTPUT);
83
84 // set RA port
86
87 // Add HWops
88 ops.push_back(CreateHWOp("bnz", 2));
89 ops.push_back(CreateHWOp("bz", 2));
90 ops.push_back(CreateHWOp("call", 1));
91 ops.push_back(CreateHWOp("jump", 1));
92}
TTAMachine::Socket * raOut
Definition BlocksGCU.hh:56
TTAMachine::Bus * raBus
Definition BlocksGCU.hh:59
TTAMachine::FUPort * pc
Definition BlocksGCU.hh:52
TTAMachine::SpecialRegisterPort * ra
Definition BlocksGCU.hh:54
TTAMachine::Socket * pcIn
Definition BlocksGCU.hh:57
TTAMachine::FUPort * val
Definition BlocksGCU.hh:53
TTAMachine::HWOperation * CreateHWOp(const std::string &name, int numOfOperands)
Definition BlocksGCU.cc:146
TTAMachine::Socket * raIn
Definition BlocksGCU.hh:55
TTAMachine::Socket * valIn
Definition BlocksGCU.hh:58
std::vector< TTAMachine::HWOperation * > ops
Definition BlocksGCU.hh:77
TTAMachine::ControlUnit * gcu
Definition BlocksGCU.hh:48
void setReturnAddressPort(const SpecialRegisterPort &port)
virtual void setAddressSpace(AddressSpace *as)
virtual void addBus(Bus &bus)
Definition Machine.cc:139
virtual void setGlobalControl(ControlUnit &unit)
Definition Machine.cc:317
virtual void addSocket(Socket &socket)
Definition Machine.cc:157
virtual void attachSocket(Socket &socket)
Definition Port.cc:191
void setDirection(Direction direction)
Definition Socket.cc:130
void attachBus(Segment &bus)
Definition Socket.cc:166

References TTAMachine::Machine::addBus(), TTAMachine::Machine::addSocket(), TTAMachine::Socket::attachBus(), TTAMachine::Port::attachSocket(), CreateHWOp(), gcu, ops, pc, pcIn, ra, raBus, raIn, raOut, TTAMachine::FunctionUnit::setAddressSpace(), TTAMachine::Socket::setDirection(), TTAMachine::Machine::setGlobalControl(), TTAMachine::ControlUnit::setReturnAddressPort(), val, and valIn.

Here is the call graph for this function:

◆ ~BlocksGCU()

BlocksGCU::~BlocksGCU ( )
inline

Definition at line 61 of file BlocksGCU.hh.

61 {
62 delete pc;
63 delete val;
64 delete ra;
65 while (!ops.empty()) {
66 delete ops.back();
67 ops.pop_back();
68 }
69 delete raIn;
70 delete raOut;
71 delete valIn;
72 delete pcIn;
73 delete gcu;
74 }

References gcu, ops, pc, pcIn, ra, raIn, raOut, val, and valIn.

Member Function Documentation

◆ BindPorts()

void BlocksGCU::BindPorts ( TTAMachine::HWOperation hwOp,
int  numOfOperands 
)
private

Bind the operation's operands to GCU ports.

Parameters
hwOpA pointer to the hardware operation of which the operands need to be binded to GCU ports.
numOfOperandsThe number of operands of the given hwOp.

Definition at line 127 of file BlocksGCU.cc.

127 {
128 if (numOfOperands < 2) {
129 hwOp->bindPort(1, *pc);
130 } else {
131 hwOp->bindPort(2, *pc); // Program counter is operand 2, therfore
132 // port binding is switched.
133 hwOp->bindPort(1, *val);
134 }
135}
virtual void bindPort(int operand, const FUPort &port)

References TTAMachine::HWOperation::bindPort(), pc, and val.

Referenced by CreateHWOp().

Here is the call graph for this function:

◆ ConfigurePipeline()

void BlocksGCU::ConfigurePipeline ( TTAMachine::ExecutionPipeline pipeline,
int  numOfOperands 
)
private

Configure the operation pipeline.

Parameters
pipelineA pointer to the execution pipeline of the operation of which the pipeline needs to be configured.
numOfOperandsThe number of operands of the given hwOp.

Definition at line 102 of file BlocksGCU.cc.

103 {
104 if (numOfOperands == 1) {
105 pipeline->addPortRead(1, 0, 1);
106 } else if (numOfOperands == 2) {
107 pipeline->addPortRead(1, 0, 1);
108 pipeline->addPortRead(2, 0, 1);
109 } else {
110 // Currently no operation known that uses a different numbers of
111 // operands.
112 assert(
113 false &&
114 "Trying to add a GCU operation with a different number of "
115 "operands than 1 or 2.");
116 }
117}
#define assert(condition)
void addPortRead(int operand, int start, int duration)

References TTAMachine::ExecutionPipeline::addPortRead(), and assert.

Referenced by CreateHWOp().

Here is the call graph for this function:

◆ CreateHWOp()

HWOperation * BlocksGCU::CreateHWOp ( const std::string &  name,
int  numOfOperands 
)
private

Creates a hardware operation.

Parameters
nameThe name of the hardware operation. This needs to exactly match the name in OSEd.
numOfOperandsThe number of operands that this hardware operation requires.

Definition at line 146 of file BlocksGCU.cc.

146 {
147 HWOperation* op = new HWOperation(name, *gcu);
148 BindPorts(op, numOfOperands);
149 ConfigurePipeline(op->pipeline(), numOfOperands);
150 return op;
151}
void ConfigurePipeline(TTAMachine::ExecutionPipeline *pipeline, int numOfOperands)
Definition BlocksGCU.cc:102
void BindPorts(TTAMachine::HWOperation *hwOp, int numOfOperands)
Definition BlocksGCU.cc:127
ExecutionPipeline * pipeline() const

References BindPorts(), ConfigurePipeline(), gcu, and TTAMachine::HWOperation::pipeline().

Referenced by BlocksGCU().

Here is the call graph for this function:

Member Data Documentation

◆ gcu

TTAMachine::ControlUnit* BlocksGCU::gcu

Definition at line 48 of file BlocksGCU.hh.

Referenced by BlocksGCU(), CreateHWOp(), and ~BlocksGCU().

◆ ops

std::vector<TTAMachine::HWOperation*> BlocksGCU::ops
private

Definition at line 77 of file BlocksGCU.hh.

Referenced by BlocksGCU(), and ~BlocksGCU().

◆ pc

TTAMachine::FUPort* BlocksGCU::pc

Definition at line 52 of file BlocksGCU.hh.

Referenced by BindPorts(), BlocksGCU(), and ~BlocksGCU().

◆ pcIn

TTAMachine::Socket* BlocksGCU::pcIn

◆ ra

Definition at line 54 of file BlocksGCU.hh.

Referenced by BlocksGCU(), and ~BlocksGCU().

◆ raBus

TTAMachine::Bus* BlocksGCU::raBus

Definition at line 59 of file BlocksGCU.hh.

Referenced by BlocksGCU().

◆ raIn

TTAMachine::Socket* BlocksGCU::raIn

Definition at line 55 of file BlocksGCU.hh.

Referenced by BlocksGCU(), BlocksTranslator::CreateConnection(), and ~BlocksGCU().

◆ raOut

TTAMachine::Socket* BlocksGCU::raOut

Definition at line 56 of file BlocksGCU.hh.

Referenced by BlocksGCU(), and ~BlocksGCU().

◆ sources

std::list<std::string> BlocksGCU::sources

◆ val

TTAMachine::FUPort* BlocksGCU::val

Definition at line 53 of file BlocksGCU.hh.

Referenced by BindPorts(), BlocksGCU(), and ~BlocksGCU().

◆ valIn

TTAMachine::Socket* BlocksGCU::valIn

Definition at line 58 of file BlocksGCU.hh.

Referenced by BlocksGCU(), BlocksTranslator::ConnectInputs(), and ~BlocksGCU().


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