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) {}