OpenASIP  2.0
Public Member Functions | Public Attributes | Private Member Functions | List of all members
BlocksMUL Class Reference

#include <BlocksMUL.hh>

Inheritance diagram for BlocksMUL:
Inheritance graph
Collaboration diagram for BlocksMUL:
Collaboration graph

Public Member Functions

 BlocksMUL (TTAMachine::Machine &mach, const std::string &name, std::list< std::string > sources, std::shared_ptr< TTAMachine::Socket > in1sock, std::shared_ptr< TTAMachine::Socket > in2sock)
 
 ~BlocksMUL ()
 

Public Attributes

TTAMachine::FunctionUnitmul
 
- Public Attributes inherited from BlocksFU
std::vector< TTAMachine::HWOperation * > ops
 
TTAMachine::FunctionUnitfu
 
TTAMachine::FUPortin1
 
TTAMachine::FUPortin2
 
TTAMachine::FUPortout
 
std::shared_ptr< TTAMachine::Socketin1sock
 
std::shared_ptr< TTAMachine::Socketin2sock
 
TTAMachine::Socketoutsock
 
std::list< std::string > sources
 
std::string name
 

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)
 

Additional Inherited Members

- Protected Member Functions inherited from BlocksFU
 BlocksFU (TTAMachine::Machine &mach, const std::string &name, std::list< std::string > sources, std::shared_ptr< TTAMachine::Socket > in1sock, std::shared_ptr< TTAMachine::Socket > in2sock)
 
 ~BlocksFU ()
 

Detailed Description

Definition at line 39 of file BlocksMUL.hh.

Constructor & Destructor Documentation

◆ BlocksMUL()

BlocksMUL::BlocksMUL ( TTAMachine::Machine mach,
const std::string &  name,
std::list< std::string >  sources,
std::shared_ptr< TTAMachine::Socket in1sock,
std::shared_ptr< TTAMachine::Socket in2sock 
)

Constructor BlocksMUL

Parameters
machThe TTA machine where the MUL needs to be added.
nameThe name of the MUL.
sourcesA list of sources that are attached to this unit's input.
in1sock(shared) pointer to the TTA socket for in1 input port.
in2sock(shared) pointer to the TTA socket for in2 input port.

Definition at line 47 of file BlocksMUL.cc.

52  // Function unit and ports
53  mul = this->fu;
54 
55  // HW ops
56  HWOperation* mulOp = CreateHWOp("mul", 3);
57  ops.push_back(mulOp);
58  HWOperation* copyOp = CreateHWOp("copy", 2);
59  ops.push_back(copyOp);
60 }

References CreateHWOp(), BlocksFU::fu, mul, and BlocksFU::ops.

Here is the call graph for this function:

◆ ~BlocksMUL()

BlocksMUL::~BlocksMUL ( )
inline

Definition at line 47 of file BlocksMUL.hh.

47  {
48  while (!ops.empty()) {
49  delete ops.back();
50  ops.pop_back();
51  }
52  }

References BlocksFU::ops.

Member Function Documentation

◆ BindPorts()

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

Bind the operation's operands to FU ports.

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

Definition at line 113 of file BlocksMUL.cc.

113  {
114  if (numOfOperands == 2) {
115  hwOp->bindPort(1, *in1);
116  hwOp->bindPort(2, *out);
117  } else if (numOfOperands == 3) {
118  hwOp->bindPort(1, *in1);
119  hwOp->bindPort(2, *in2);
120  hwOp->bindPort(3, *out);
121  } else {
122  // Currently no operation known that uses a different numbers of
123  // operands.
124  assert(
125  false &&
126  "Trying to add an MUL operation with a different number of "
127  "operands than 2 or 3.");
128  }
129 }

References assert, TTAMachine::HWOperation::bindPort(), BlocksFU::in1, BlocksFU::in2, and BlocksFU::out.

Referenced by CreateHWOp().

Here is the call graph for this function:

◆ ConfigurePipeline()

void BlocksMUL::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 139 of file BlocksMUL.cc.

139  {
140  if (numOfOperands < 3) {
141  pipeline->addPortRead(1, 0, 1);
142  pipeline->addPortWrite(2, 0, 1);
143  } else {
144  pipeline->addPortRead(1, 0, 1);
145  pipeline->addPortRead(2, 0, 1);
146  pipeline->addPortWrite(3, 0, 1);
147  }
148 }

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

Referenced by CreateHWOp().

Here is the call graph for this function:

◆ CreateHWOp()

HWOperation * BlocksMUL::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 98 of file BlocksMUL.cc.

98  {
99  HWOperation* op = new HWOperation(name, *mul);
100  BindPorts(op, numOfOperands);
101  ConfigurePipeline(op->pipeline(), numOfOperands);
102  return op;
103 }

References BindPorts(), ConfigurePipeline(), mul, BlocksFU::name, and TTAMachine::HWOperation::pipeline().

Referenced by BlocksMUL().

Here is the call graph for this function:

Member Data Documentation

◆ mul

TTAMachine::FunctionUnit* BlocksMUL::mul

Definition at line 41 of file BlocksMUL.hh.

Referenced by BlocksMUL(), and CreateHWOp().


The documentation for this class was generated from the following files:
BlocksFU::ops
std::vector< TTAMachine::HWOperation * > ops
Definition: BlocksFU.hh:59
BlocksFU::in1
TTAMachine::FUPort * in1
Definition: BlocksFU.hh:61
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::HWOperation::bindPort
virtual void bindPort(int operand, const FUPort &port)
Definition: HWOperation.cc:269
BlocksFU::fu
TTAMachine::FunctionUnit * fu
Definition: BlocksFU.hh:60
BlocksMUL::BindPorts
void BindPorts(TTAMachine::HWOperation *hwOp, int numOfOperands)
Definition: BlocksMUL.cc:113
BlocksMUL::CreateHWOp
TTAMachine::HWOperation * CreateHWOp(const std::string &name, int numOfOperands)
Definition: BlocksMUL.cc:98
assert
#define assert(condition)
Definition: Application.hh:86
BlocksMUL::mul
TTAMachine::FunctionUnit * mul
Definition: BlocksMUL.hh:41
BlocksFU::in2sock
std::shared_ptr< TTAMachine::Socket > in2sock
Definition: BlocksFU.hh:65
BlocksMUL::ConfigurePipeline
void ConfigurePipeline(TTAMachine::ExecutionPipeline *pipeline, int numOfOperands)
Definition: BlocksMUL.cc:139
BlocksFU::out
TTAMachine::FUPort * out
Definition: BlocksFU.hh:63
TTAMachine::ExecutionPipeline::addPortRead
void addPortRead(int operand, int start, int duration)
Definition: ExecutionPipeline.cc:141
BlocksFU::sources
std::list< std::string > sources
Definition: BlocksFU.hh:67
BlocksFU::BlocksFU
BlocksFU(TTAMachine::Machine &mach, const std::string &name, std::list< std::string > sources, std::shared_ptr< TTAMachine::Socket > in1sock, std::shared_ptr< TTAMachine::Socket > in2sock)
Definition: BlocksFU.cc:43
BlocksFU::name
std::string name
Definition: BlocksFU.hh:68
TTAMachine::HWOperation::pipeline
ExecutionPipeline * pipeline() const
Definition: HWOperation.cc:201
TTAMachine::ExecutionPipeline::addPortWrite
void addPortWrite(int operand, int start, int duration)
Definition: ExecutionPipeline.cc:167
BlocksFU::in2
TTAMachine::FUPort * in2
Definition: BlocksFU.hh:62
BlocksFU::in1sock
std::shared_ptr< TTAMachine::Socket > in1sock
Definition: BlocksFU.hh:64