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

#include <BlocksALU.hh>

Inheritance diagram for BlocksALU:
Inheritance graph
Collaboration diagram for BlocksALU:
Collaboration graph

Public Member Functions

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

Public Attributes

TTAMachine::FunctionUnitalu
 
- 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 BlocksALU.hh.

Constructor & Destructor Documentation

◆ BlocksALU()

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

Create BlocksALU with default instructions

Parameters
machThe TTA machine where the ALU needs to be added.
nameThe name of the ALU.
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 BlocksALU.cc.

52 // Function unit and ports
53 alu = this->fu;
54
55 // HW ops
56 ops.push_back(CreateHWOp("add", 3));
57 ops.push_back(CreateHWOp("and", 3));
58 ops.push_back(CreateHWOp("eq", 3));
59 ops.push_back(CreateHWOp("ge", 3));
60 ops.push_back(CreateHWOp("geu", 3));
61 ops.push_back(CreateHWOp("gt", 3));
62 ops.push_back(CreateHWOp("gtu", 3));
63 ops.push_back(CreateHWOp("ior", 3));
64 ops.push_back(CreateHWOp("lt", 3));
65 ops.push_back(CreateHWOp("ltu", 3));
66 ops.push_back(CreateHWOp("ne", 3));
67 ops.push_back(CreateHWOp("not", 2));
68 ops.push_back(CreateHWOp("shl1_32", 2));
69 ops.push_back(CreateHWOp("shl4_32", 2));
70 ops.push_back(CreateHWOp("shr1_32", 2));
71 ops.push_back(CreateHWOp("shr4_32", 2));
72 ops.push_back(CreateHWOp("shru1_32", 2));
73 ops.push_back(CreateHWOp("shru4_32", 2));
74 ops.push_back(CreateHWOp("sub", 3));
75 ops.push_back(CreateHWOp("xor", 3));
76 ops.push_back(CreateHWOp("copy", 2));
77}
TTAMachine::FunctionUnit * alu
Definition BlocksALU.hh:41
TTAMachine::HWOperation * CreateHWOp(const std::string &name, int numOfOperands)
Definition BlocksALU.cc:115
std::shared_ptr< TTAMachine::Socket > in2sock
Definition BlocksFU.hh:65
std::shared_ptr< TTAMachine::Socket > in1sock
Definition BlocksFU.hh:64
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
TTAMachine::FunctionUnit * fu
Definition BlocksFU.hh:60
std::string name
Definition BlocksFU.hh:68
std::vector< TTAMachine::HWOperation * > ops
Definition BlocksFU.hh:59
std::list< std::string > sources
Definition BlocksFU.hh:67

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

Here is the call graph for this function:

◆ ~BlocksALU()

BlocksALU::~BlocksALU ( )
inline

Definition at line 47 of file BlocksALU.hh.

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

References BlocksFU::ops.

Member Function Documentation

◆ BindPorts()

void BlocksALU::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 130 of file BlocksALU.cc.

130 {
131 if (numOfOperands == 2) {
132 hwOp->bindPort(1, *in1);
133 hwOp->bindPort(2, *out);
134 } else if (numOfOperands == 3) {
135 hwOp->bindPort(1, *in1);
136 hwOp->bindPort(2, *in2);
137 hwOp->bindPort(3, *out);
138 } else {
139 // Currently no operation known that uses a different numbers of
140 // operands.
141 assert(
142 false &&
143 "Trying to add an ALU operation with a different number of "
144 "operands than 2 or 3.");
145 }
146}
#define assert(condition)
TTAMachine::FUPort * out
Definition BlocksFU.hh:63
TTAMachine::FUPort * in1
Definition BlocksFU.hh:61
TTAMachine::FUPort * in2
Definition BlocksFU.hh:62
virtual void bindPort(int operand, const FUPort &port)

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 BlocksALU::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 156 of file BlocksALU.cc.

156 {
157 if (numOfOperands < 3) {
158 pipeline->addPortRead(1, 0, 1);
159 pipeline->addPortWrite(2, 0, 1);
160 } else {
161 pipeline->addPortRead(1, 0, 1);
162 pipeline->addPortRead(2, 0, 1);
163 pipeline->addPortWrite(3, 0, 1);
164 }
165}
void addPortRead(int operand, int start, int duration)
void addPortWrite(int operand, int start, int duration)

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

Referenced by CreateHWOp().

Here is the call graph for this function:

◆ CreateHWOp()

HWOperation * BlocksALU::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 115 of file BlocksALU.cc.

115 {
116 HWOperation* op = new HWOperation(name, *alu);
117 BindPorts(op, numOfOperands);
118 ConfigurePipeline(op->pipeline(), numOfOperands);
119 return op;
120}
void ConfigurePipeline(TTAMachine::ExecutionPipeline *pipeline, int numOfOperands)
Definition BlocksALU.cc:156
void BindPorts(TTAMachine::HWOperation *hwOp, int numOfOperands)
Definition BlocksALU.cc:130
ExecutionPipeline * pipeline() const

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

Referenced by BlocksALU().

Here is the call graph for this function:

Member Data Documentation

◆ alu

TTAMachine::FunctionUnit* BlocksALU::alu

Definition at line 41 of file BlocksALU.hh.

Referenced by BlocksALU(), and CreateHWOp().


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