Go to the documentation of this file.
56 const std::string& name,
60 const bool signExtension,
61 unsigned int initiationInterval)
63 registerCount_(registers), width_(width),
64 latency_(latency) , signExtension_(signExtension), machine_(mach) {
98 if (modOtherUse >= modOtherDef) {
100 if (modCycle >= modOtherDef && modCycle < modOtherUse) {
105 if (modCycle >= modOtherDef || modCycle <= modOtherUse) {
134 if (immRegIndex != -1 && i != immRegIndex)
continue;
145 if (modOtherUse >= modOtherDef) {
147 if (modCycle > modOtherDef && modCycle < modOtherUse) {
153 if (modCycle >= modOtherDef || modCycle <= modOtherUse) {
161 if (marker ==
false) {
185 std::string msg =
"IUResource: called assign with \'cycle\'";
186 msg +=
" and \'node\'. Use assign with \'defCycle\',";
187 msg +=
" \'useCycle\', \'node\' and \'index\' reference!";
202 const int defCycle,
const int useCycle,
MoveNode& node,
int& index) {
204 if (defCycle > useCycle) {
206 "Long immediate definition cycle later than use cycle: ";
213 if ((useCycle - defCycle) <
latency_) {
214 std::string msg =
"Definition and use too close(";
229 std::string msg =
"Assignment for immediate impossible!";
243 std::string msg =
"Trying to unassign move that is not immediate\
250 std::string msg =
"The register is not assigned!";
253 std::vector<ResourceRecordType*>::iterator itr =
258 if (node.
cycle() == (*itr)->use_) {
259 std::shared_ptr<TTAProgram::TerminalImmediate> originalTerminal =
260 ((*itr)->immediateValue_);
261 if (originalTerminal) {
272 std::string msg =
"Register is not assigned for given cycle!";
286 std::string msg =
"IUResource: called canAssign with \'cycle\'";
287 msg +=
" and \'node\'. Use canAssign with \'defCycle\',";
288 msg +=
" \'useCycle\' and \'node\'!";
325 int immRegIndex)
const {
327 if (defCycle > useCycle) {
330 if ((useCycle - defCycle) <
latency_) {
381 "Can not decrease number of registers in IMM unit!");
406 std::shared_ptr<TTAProgram::TerminalImmediate>
410 std::string msg =
"Immediate register was not assigned!";
423 std::string msg =
"Immediate register was not recorded in resource!";
492 const int defCycle,
const int useCycle,
int immRegIndex)
const {
496 if (immRegIndex != -1 && i != immRegIndex)
continue;
499 int size = resVec.size();
500 for (
int j = 0; j < size; j++) {
501 int otherDef = resVec[j]->definition_;
503 int otherUse = resVec[j]->use_;
507 if (modOtherUse >= modOtherDef) {
509 if (modUse >= modOtherDef && modUse <= modOtherUse) {
514 if (modDef >= modOtherDef && modDef <= modOtherUse) {
521 if (modUse >= modOtherDef || modUse <= modOtherUse) {
526 if (modDef >= modOtherDef || modDef <= modOtherUse) {
537 if (modDef <= modUse) {
539 if (modOtherDef >= modDef && modOtherDef <= modUse) {
546 if (modOtherDef >= modDef || modOtherDef <= modUse) {
552 if (marker ==
false) {
596 definition_(definition), use_(use), immediateValue_(val) {}
static int requiredImmediateWidth(bool signExtension, const TTAProgram::TerminalImmediate &source, const TTAMachine::Machine &mach)
virtual bool validateDependentGroups() override
virtual int index() const
IUResource(const TTAMachine::Machine &mach, const std::string &name, const int registers, const int width, const int latency, const bool signExtension, unsigned int initiationInterval=0)
bool canAssignUse(int useCycle) const
virtual bool isITemplateResource() const
virtual bool isInputPSocketResource() const
static std::string toString(const T &source)
void setRegisterCount(const int registers)
#define assert(condition)
virtual bool isImmediateRegister() const
virtual SchedulingResource & relatedResource(const int group, const int index) const
std::vector< ResourceRecordVectorType > resourceRecord_
#define abortWithError(message)
std::vector< ResourceRecordType * > ResourceRecordVectorType
virtual void assign(const int cycle, MoveNode &node) override
int findAvailable(const int defCycle, const int useCycle, int immRegIndex) const
virtual bool isOutputPSocketResource() const
virtual bool canAssign(const int, const MoveNode &) const override
int instructionIndex(int cycle) const
virtual bool isInUse(const int cycle) const =0
virtual bool validateRelatedGroups() override
int immediateWriteCycle(const MoveNode &node) const
int relatedResourceCount(const int group) const
virtual bool isIUResource() const override
TTAProgram::Move & move()
virtual void unassign(const int cycle, MoveNode &node) override
const TTAMachine::Machine & machine_
std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &node) const
virtual bool isInUse(const int cycle) const override
std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue_
virtual Terminal * copy() const =0
Terminal & source() const
virtual const std::string & name() const
virtual int relatedResourceGroupCount() const
int registerCount() const
virtual bool isImmediate() const
virtual bool isAvailable(const int cycle, int immRegIndex) const
void setSource(Terminal *src)
ResourceRecordType(int definition, int use, TTAProgram::TerminalImmediate *val)