OpenASIP  2.0
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);
66  ra->attachSocket(*raIn);
68  pc->attachSocket(*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);
79  raIn->attachBus(*raBus);
81  pcIn->attachBus(*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 }

References TTAMachine::Machine::addBus(), TTAMachine::Machine::addSocket(), and TTAMachine::Machine::setGlobalControl().

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 }

References TTAMachine::HWOperation::bindPort().

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 }

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

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 }

References TTAMachine::HWOperation::pipeline().

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

◆ ops

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

Definition at line 77 of file BlocksGCU.hh.

Referenced by ~BlocksGCU().

◆ pc

TTAMachine::FUPort* BlocksGCU::pc

Definition at line 52 of file BlocksGCU.hh.

Referenced by ~BlocksGCU().

◆ pcIn

TTAMachine::Socket* BlocksGCU::pcIn

◆ ra

Definition at line 54 of file BlocksGCU.hh.

Referenced by ~BlocksGCU().

◆ raBus

TTAMachine::Bus* BlocksGCU::raBus

Definition at line 59 of file BlocksGCU.hh.

◆ raIn

TTAMachine::Socket* BlocksGCU::raIn

Definition at line 55 of file BlocksGCU.hh.

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

◆ raOut

TTAMachine::Socket* BlocksGCU::raOut

Definition at line 56 of file BlocksGCU.hh.

Referenced by ~BlocksGCU().

◆ sources

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

◆ val

TTAMachine::FUPort* BlocksGCU::val

Definition at line 53 of file BlocksGCU.hh.

Referenced by ~BlocksGCU().

◆ valIn

TTAMachine::Socket* BlocksGCU::valIn

Definition at line 58 of file BlocksGCU.hh.

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


The documentation for this class was generated from the following files:
BlocksGCU::gcu
TTAMachine::ControlUnit * gcu
Definition: BlocksGCU.hh:48
BlocksGCU::ops
std::vector< TTAMachine::HWOperation * > ops
Definition: BlocksGCU.hh:77
BlocksGCU::raIn
TTAMachine::Socket * raIn
Definition: BlocksGCU.hh:55
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::HWOperation::bindPort
virtual void bindPort(int operand, const FUPort &port)
Definition: HWOperation.cc:269
TTAMachine::Segment
Definition: Segment.hh:54
TTAMachine::Bus
Definition: Bus.hh:53
BlocksGCU::valIn
TTAMachine::Socket * valIn
Definition: BlocksGCU.hh:58
BlocksGCU::raOut
TTAMachine::Socket * raOut
Definition: BlocksGCU.hh:56
BlocksGCU::val
TTAMachine::FUPort * val
Definition: BlocksGCU.hh:53
BlocksGCU::ConfigurePipeline
void ConfigurePipeline(TTAMachine::ExecutionPipeline *pipeline, int numOfOperands)
Definition: BlocksGCU.cc:102
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::UnconditionalGuard
Definition: Guard.hh:180
TTAMachine::Port::attachSocket
virtual void attachSocket(Socket &socket)
Definition: Port.cc:191
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAMachine::Socket::attachBus
void attachBus(Segment &bus)
Definition: Socket.cc:166
TTAMachine::SpecialRegisterPort
Definition: SpecialRegisterPort.hh:48
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
BlocksGCU::raBus
TTAMachine::Bus * raBus
Definition: BlocksGCU.hh:59
TTAMachine::ExecutionPipeline::addPortRead
void addPortRead(int operand, int start, int duration)
Definition: ExecutionPipeline.cc:141
TTAMachine::Socket
Definition: Socket.hh:53
TTAMachine::FunctionUnit::setAddressSpace
virtual void setAddressSpace(AddressSpace *as)
Definition: FunctionUnit.cc:594
TTAMachine::Socket::setDirection
void setDirection(Direction direction)
Definition: Socket.cc:130
TTAMachine::Machine::addBus
virtual void addBus(Bus &bus)
Definition: Machine.cc:139
TTAMachine::Machine::setGlobalControl
virtual void setGlobalControl(ControlUnit &unit)
Definition: Machine.cc:317
BlocksGCU::ra
TTAMachine::SpecialRegisterPort * ra
Definition: BlocksGCU.hh:54
BlocksGCU::pcIn
TTAMachine::Socket * pcIn
Definition: BlocksGCU.hh:57
TTAMachine::ControlUnit::setReturnAddressPort
void setReturnAddressPort(const SpecialRegisterPort &port)
Definition: ControlUnit.cc:271
TTAMachine::HWOperation::pipeline
ExecutionPipeline * pipeline() const
Definition: HWOperation.cc:201
TTAMachine::Machine::Extension
Extension
Definition: Machine.hh:80
BlocksGCU::BindPorts
void BindPorts(TTAMachine::HWOperation *hwOp, int numOfOperands)
Definition: BlocksGCU.cc:127
BlocksGCU::CreateHWOp
TTAMachine::HWOperation * CreateHWOp(const std::string &name, int numOfOperands)
Definition: BlocksGCU.cc:146
TTAMachine::Machine::addSocket
virtual void addSocket(Socket &socket)
Definition: Machine.cc:157
BlocksGCU::pc
TTAMachine::FUPort * pc
Definition: BlocksGCU.hh:52