OpenASIP  2.0
Public Member Functions | Protected Member Functions | List of all members
FUBroker Class Reference

#include <FUBroker.hh>

Inheritance diagram for FUBroker:
Inheritance graph
Collaboration diagram for FUBroker:
Collaboration graph

Public Member Functions

 FUBroker (std::string name, unsigned int initiationInterval=0)
 
virtual ~FUBroker ()
 
- Public Member Functions inherited from ResourceBroker
 ResourceBroker (std::string, unsigned int initiationInterval=0)
 
virtual ~ResourceBroker ()
 
virtual bool isAnyResourceAvailable (int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const
 
virtual SchedulingResourceavailableResource (int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const
 
virtual SchedulingResourceSet allAvailableResources (int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const
 
virtual bool isAvailable (SchedulingResource &des, const MoveNode &node, int cycle, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const
 
virtual int earliestCycle (int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const =0
 
virtual int latestCycle (int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const =0
 
virtual bool isAlreadyAssigned (int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const =0
 
virtual bool isApplicable (const MoveNode &node, const TTAMachine::Bus *preassignedBus) const =0
 
virtual void assign (int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex)=0
 
virtual void unassign (MoveNode &node)=0
 
virtual void buildResources (const TTAMachine::Machine &target)=0
 
virtual void setupResourceLinks (const ResourceMapper &mapper)=0
 
SchedulingResourceresourceOf (const TTAMachine::MachinePart &mp) const
 
virtual const TTAMachine::MachinePartmachinePartOf (const SchedulingResource &r) const
 
bool hasResourceOf (const TTAMachine::MachinePart &mp) const
 
bool hasResource (const SchedulingResource &r) const
 
int resourceCount () const
 
virtual bool isBusBroker () const
 
virtual bool isITemplateBroker () const
 
virtual bool isIUBroker () const
 
virtual bool isExecutionPipelineBroker () const
 
void validateResources () const
 
virtual std::string brokerName () const
 
void resources (ResourceSet &contents)
 
virtual void setInitiationInterval (unsigned int cycles)
 
virtual void clear ()
 
virtual void setMaxCycle (unsigned int)
 

Protected Member Functions

std::pair< bool, const TTAMachine::FunctionUnit * > findDstFUOfMove (const MoveNode &node, const TTAMachine::FunctionUnit *resFU, DataDependenceGraph::NodeSet &processedInputNodes) const
 
std::pair< bool, const TTAMachine::FunctionUnit * > findFUOfPO (ProgramOperation &po, const TTAMachine::FunctionUnit *resFU) const
 
- Protected Member Functions inherited from ResourceBroker
void setResourceMapper (const ResourceMapper &mapper)
 
const ResourceMapperresourceMapper () const
 
unsigned int instructionIndex (unsigned int) const
 
void addResource (const TTAMachine::MachinePart &mp, SchedulingResource *res)
 

Additional Inherited Members

- Public Types inherited from ResourceBroker
typedef std::set< SchedulingResource * > ResourceSet
 
- Protected Types inherited from ResourceBroker
typedef std::map< const TTAMachine::MachinePart *, SchedulingResource *, TTAMachine::MachinePart::ComparatorResourceMap
 
typedef std::map< const MoveNode *, SchedulingResource *, MoveNode::ComparatorMoveResMap
 
- Protected Attributes inherited from ResourceBroker
unsigned int initiationInterval_
 
ResourceMap resMap_
 
const ResourceMapperresourceMapper_
 
MoveResMap assignedResources_
 
std::string brokerName_
 

Detailed Description

Input function unit broker.

Definition at line 49 of file FUBroker.hh.

Constructor & Destructor Documentation

◆ FUBroker()

FUBroker::FUBroker ( std::string  name,
unsigned int  initiationInterval = 0 
)
inline

Definition at line 51 of file FUBroker.hh.

51  :
52  ResourceBroker(name, initiationInterval) {}

◆ ~FUBroker()

virtual FUBroker::~FUBroker ( )
inlinevirtual

Definition at line 53 of file FUBroker.hh.

53 {}

Member Function Documentation

◆ findDstFUOfMove()

std::pair< bool, const TTAMachine::FunctionUnit * > FUBroker::findDstFUOfMove ( const MoveNode node,
const TTAMachine::FunctionUnit resFU,
DataDependenceGraph::NodeSet processedInputNodes 
) const
protected

Definition at line 37 of file FUBroker.cc.

39  {
40  // already processed this once. do not do it twice
41  if (processedInputNodes.count(const_cast<MoveNode*>(&node))) {
42  return std::make_pair(true, resFU);
43  }
44  processedInputNodes.insert(const_cast<MoveNode*>(&node));
45  const TTAProgram::Move& move = node.move();
46  const TTAProgram::Terminal& dst = move.destination();
47  if (!dst.isFUPort()) {
48  throw InvalidData(
49  __FILE__, __LINE__, __func__,
50  "Output move does not have FU source!");
51  }
52  const TTAMachine::FunctionUnit& fu = dst.functionUnit();
53  if (hasResourceOf(fu)) {
54  if (resFU == NULL) {
55  resFU = &fu;
56  } else {
57  if (resFU != &fu) {
58  return std::make_pair(false, resFU);
59  // illegal/empty
60  }
61  }
62  }
63  for (unsigned int i = 0; i < node.destinationOperationCount(); i++) {
65  auto a = findFUOfPO(po, resFU);
66  if (a.first) {
67  resFU = a.second;
68  } else {
69  return a;
70  }
71  }
72  return std::make_pair(true, resFU);
73 }

References __func__, TTAProgram::Move::destination(), MoveNode::destinationOperation(), MoveNode::destinationOperationCount(), findFUOfPO(), TTAProgram::Terminal::functionUnit(), ResourceBroker::hasResourceOf(), TTAProgram::Terminal::isFUPort(), and MoveNode::move().

Referenced by InputFUBroker::allAvailableResources().

Here is the call graph for this function:

◆ findFUOfPO()

std::pair< bool, const TTAMachine::FunctionUnit * > FUBroker::findFUOfPO ( ProgramOperation po,
const TTAMachine::FunctionUnit resFU 
) const
protected

Definition at line 77 of file FUBroker.cc.

78  {
79 
80  const TTAMachine::FunctionUnit* fu = po.scheduledFU();
81 
82  // did not find anything. use default or return not found.
83  if (fu == nullptr) {
84  if (resFU && !po.isLegalFU(*resFU)) {
85  return std::make_pair(false, resFU);
86  }
87  return std::make_pair(true, resFU);
88  }
89 
90  // illegal annotations?
91  if (!po.isLegalFU(*fu)) {
92  return std::make_pair(false, resFU);
93  }
94 
95  assert(hasResourceOf(*fu));
96  // did find something, but it's different than default
97  if (fu != resFU) {
98  if (resFU == nullptr) {
99  // default was null, use then one found
100  return std::make_pair(true, fu);
101  } else {
102  // default not null. conflict! return not found.
103  return std::make_pair(false, resFU);
104  }
105  }
106  // fu and resfu are the same? ok!
107  return std::make_pair(true,fu);
108 
109 }

References assert, ResourceBroker::hasResourceOf(), ProgramOperation::isLegalFU(), and ProgramOperation::scheduledFU().

Referenced by OutputFUBroker::allAvailableResources(), and findDstFUOfMove().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TTAProgram::Terminal::isFUPort
virtual bool isFUPort() const
Definition: Terminal.cc:118
TTAProgram::Move::destination
Terminal & destination() const
Definition: Move.cc:323
ProgramOperation
Definition: ProgramOperation.hh:70
MoveNode
Definition: MoveNode.hh:65
ResourceBroker::hasResourceOf
bool hasResourceOf(const TTAMachine::MachinePart &mp) const
Definition: ResourceBroker.cc:203
ProgramOperation::isLegalFU
bool isLegalFU(const TTAMachine::FunctionUnit &fu) const
Definition: ProgramOperation.cc:915
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
FUBroker::findFUOfPO
std::pair< bool, const TTAMachine::FunctionUnit * > findFUOfPO(ProgramOperation &po, const TTAMachine::FunctionUnit *resFU) const
Definition: FUBroker.cc:77
InvalidData
Definition: Exception.hh:149
__func__
#define __func__
Definition: Application.hh:67
TTAProgram::Move
Definition: Move.hh:55
MoveNode::destinationOperationCount
unsigned int destinationOperationCount() const
ProgramOperation::scheduledFU
const TTAMachine::FunctionUnit * scheduledFU() const
Definition: ProgramOperation.cc:866
TTAProgram::Terminal::functionUnit
virtual const TTAMachine::FunctionUnit & functionUnit() const
Definition: Terminal.cc:251
MoveNode::destinationOperation
ProgramOperation & destinationOperation(unsigned int index=0) const
MoveNode::move
TTAProgram::Move & move()
ResourceBroker::ResourceBroker
ResourceBroker(std::string, unsigned int initiationInterval=0)
Definition: ResourceBroker.cc:49
TTAProgram::Terminal
Definition: Terminal.hh:60