Go to the documentation of this file.
84 initiationInterval_(ii), schedulingWindow_(140),
85 busCount_(
machine.busNavigator().count()) {
127 int immRegIndex)
const {
130 std::cerr <<
"testing canassign, cycle: " << cycle <<
131 " node: " << node.
toString() << std::endl;
145 std::map<int,int>::const_iterator i =
moveCounts_.find(cycle);
167 int placedInCycle = -1;
169 placedInCycle = node.
cycle();
172 cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
174 bool success =
false;
178 <<
"current broker: "
214 if (placedInCycle != -1) {
245 "Negative cycles not supported by RM");
247 if (cycle == INT_MAX) {
249 "INT_MAX cycle not supported by RM");
254 "Node is already placed in a cycle different from given cycle.";
272 std::pair<const MoveNode*, OriginalResources*>(&node, oldRes));
276 node, cycle, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
278 plan_->
setRequest(cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
284 string msg =
"No resource assignment found for ";
310 std::cerr <<
"Set known min cycle to" <<
knownMinCycle_ << std::endl;
320 std::cerr <<
"Set known min cycle(2) to" <<
knownMinCycle_ << std::endl;
343 string msg =
"Node " + node.
toString();
344 msg +=
" is not placed in any cycle.";
348 int nodeCycle = node.
cycle();
350 bool minCycleImmSrc =
false;
354 minCycleImmSrc =
true;
394 int cycleCounter = nodeCycle;
416 if (cycleCounter == nodeCycle - guardSlack || minCycleImmSrc) {
424 for (
int i = 0; i < tempIns->
moveCount(); i++) {
429 std::cerr <<
"Set known min cycle(3) to" <<
knownMinCycle_ << std::endl;
463 int immRegIndex)
const {
465 0, move, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
493 int immRegIndex)
const {
503 cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
505 if (minCycle == -1) {
507 debugLogRM(
"No assignment possible from executionPipelineBroker");
511 minCycle = std::max(minCycle, cycle);
519 while (!
canAssign(minCycle, node, bus, srcFU, dstFU, immWriteCycle, immu,
521 if (minCycle > lastCycleToTest + 1) {
524 "A problem with ADF, cannot schedule even on "
525 "an empty instruction.");
531 minCycle + 1, node, bus, srcFU, dstFU, immWriteCycle, immu,
533 if (minCycle == -1) {
534 debugLogRM(
"No assignment possible due to executionPipelineBroker.");
566 int immRegIndex)
const {
568 INT_MAX, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
597 int immRegIndex)
const {
600 std::cerr <<
"\t\t\t\tLatest cycle called with cycle: " << cycle << std::endl;
603 cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
605 std::cerr <<
"\t\t\t\t\tmaxCycle from exec pipeline: " << maxCycle << std::endl;
607 if (maxCycle == -1) {
611 if (maxCycle == INT_MAX || maxCycle == INT_MAX - 1) {
612 if (cycle == INT_MAX) {
618 if (maxCycle > cycle) {
621 int lastCycleToTest = -1;
625 if (lastCycleToTest == 0) {
626 lastCycleToTest = cycle;
629 std::cerr <<
"\t\t\t\t\tLast cycle to test: " << lastCycleToTest << std::endl;
636 int earliestCycleLimit =
641 std::cerr <<
"\tknown min cycle: " << knownMinCycle << std::endl;
642 std::cerr <<
"\t\t\t\t\tEarlist limit: " << earliestCycleLimit << std::endl;
645 if (maxCycle <= lastCycleToTest) {
646 for (
int i = maxCycle; i >= earliestCycleLimit; i--) {
647 if (
canAssign(i, node, bus, srcFU, dstFU, immWriteCycle, immu,
653 if (maxCycle > lastCycleToTest) {
654 if (
canAssign(maxCycle, node, bus, srcFU, dstFU, immWriteCycle,
655 immu, immRegIndex)) {
659 for (
int i = lastCycleToTest; i >= earliestCycleLimit; i--) {
660 if (
canAssign(i, node, bus, srcFU, dstFU, immWriteCycle, immu,
703 return dynamic_cast<IUBroker&
>(*broker);
706 string msg =
"Immediate unit broker not found.";
726 string msg =
"Instruction template broker not found.";
742 return dynamic_cast<BusBroker&
>(*broker);
745 string msg =
"Bus broker not found.";
765 string msg =
"Execution Pipeline broker not found.";
882 std::shared_ptr<TTAProgram::TerminalImmediate>
901 std::shared_ptr<TTAProgram::Immediate> immediate)
const {
904 defCycle, immediate);
virtual bool isTemplateAvailable(int, std::shared_ptr< TTAProgram::Immediate >) const
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 override
bool tryCachedAssignment(MoveNode &node, int cycle, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex)
BusBroker & busBroker() const
virtual int latestCycle(MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
std::string toString() const
SimpleBrokerDirector(const TTAMachine::Machine &machine, AssignmentPlan &plan, unsigned int initiationInterval_)
TTAMachine::Machine * machine
the architecture definition of the estimated processor
virtual void unassign(MoveNode &node) override
virtual int smallestCycle() const override
virtual bool isTemplateAvailable(int, std::shared_ptr< TTAProgram::Immediate >) const
virtual bool hasGuard(const MoveNode &node) const
unsigned int initiationInterval_
bool isUnconditional() const
virtual bool canAssign(int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
Terminal & destination() const
AssignmentPlan * plan_
Assignment plan.
virtual void assign(int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) override
const TTAMachine::Bus & bus() const
void setGuard(MoveGuard *guard)
virtual bool canTransportImmediate(const MoveNode &node, const TTAMachine::Bus *preAssignedBus) const
virtual void loseInstructionOwnership(int cycle)
static std::ostream & logStream()
void setRequest(int cycle, MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex)
int schedulingWindow_
the number of instructions to look back in the schedule for a free slot
static std::string toString(const T &source)
virtual bool hasGuard(const MoveNode &node) const
ITemplateBroker & instructionTemplateBroker() const
virtual ~SimpleBrokerDirector()
ResourceBroker & lastBroker()
bool isSourceImmediateRegister() const
#define assert(condition)
virtual void setMaxCycle(unsigned int maxCycle) override
virtual void loseInstructionOwnership(int cycle)
OriginalResources(TTAProgram::Terminal *, TTAProgram::Terminal *, const TTAMachine::Bus *, TTAProgram::MoveGuard *, bool)
void setDestination(Terminal *dst)
bool isTestedAssignmentPossible()
ResourceBroker & firstBroker()
#define abortWithError(message)
std::map< int, int > moveCounts_
virtual int longestLatency() const
TTAProgram::Terminal * dst_
virtual int earliestCycle(MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const override
void setBBN(const BasicBlockNode *bbn)
void setBBN(const BasicBlockNode *bbn)
virtual int largestCycle() const override
ExecutionPipelineBroker & executionPipelineBroker() const
MoveGuard & guard() const
static CmdLineOptions * cmdLineOptions()
ResourceBroker & currentBroker()
virtual bool isGPR() const
TTAProgram::MoveGuard * guard_
void setCFG(const ControlFlowGraph *cfg)
const TTAMachine::Bus * bus_
void setDDG(const DataDependenceGraph *ddg)
virtual bool isITemplateBroker() const
virtual std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &)
unsigned int instructionIndex(unsigned int maxCycle) const
ResourceBroker & broker(int index) const
TTAProgram::Terminal * src_
std::string errorMessage() const
virtual int immediateWriteCycle(const MoveNode &) const
virtual bool isExecutionPipelineBroker() const
IUBroker & immediateUnitBroker() const
static MachInfoCmdLineOptions options
virtual bool isIUBroker() const
TTAProgram::Move & move()
void setCycle(const int newcycle)
static std::string disassemble(const TTAProgram::Move &move)
virtual TTAProgram::Instruction * instruction(int cycle)
virtual TTAProgram::Instruction * instruction(int cycle) const override
virtual bool canTransportImmediate(const MoveNode &node, const TTAMachine::Bus *preAssigndBus) const
int immediateCount() const
virtual Terminal * copy() const =0
virtual std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &node) const
virtual bool supportsExternalAssignments() const override
void setCFG(const ControlFlowGraph *cfg)
Terminal & source() const
void setDDG(const DataDependenceGraph *ddg)
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 override
std::map< const MoveNode *, OriginalResources *, MoveNode::Comparator > origResMap_
void setBus(const TTAMachine::Bus &bus)
virtual int immediateWriteCycle(const MoveNode &node) const
virtual bool isBusBroker() const
void setSource(Terminal *src)
void setMaxCycle(unsigned int cycle)