void CGRA_PE::Execute() { int ins_opcode=ins->getOpCode(); /* if(Len != Prolog) { if(PE_Count == ((CGRA_XDim * CGRA_YDim)-1)) { PE_Count = 0; if(II_Count == (II-1)) II_Count = 0; else II_Count = II_Count + 1; } else PE_Count = PE_Count + 1; if((II_Count == (II-1)) & (PE_Count == ((CGRA_XDim*CGRA_YDim)-1))) KernelCount--; } */ // if(ins_opcode != 7) // //printf("\n******** IN CGRA PE. Opcode: %d************\n",ins_opcode); switch (ins_opcode) { case Add: Output=Input1+Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** SUM IN THIS PE %d************\n",Output); break; case Sub: Output=Input1-Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** SUBTRACTION IN THIS PE %d************\n",Output); break; case Mult: Output=Input1*Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** PRODUCT IN THIS PE %d************\n",Output); break; case AND: Output=Input1&Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** AND IN THIS PE %d************\n",Output); break; case OR: Output=Input1|Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** OR IN THIS PE %d************\n",Output); break; case XOR: Output=Input1^Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** XOR IN THIS PE %d************\n",Output); break; case cgraASR: Output=Input1>>Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** ASR IN THIS PE %d************\n",Output); break; case cgraASL: Output=Input1<<Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** ASL IN THIS PE %d************\n",Output); break; case GT: Output=Input1>Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** Greater Than IN THIS PE %d************\n",Output); break; case LT: Output=Input1<Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** Less Than IN THIS PE %d************\n",Output); break; case EQ: Output=Input1==Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** EQUALS IN THIS PE %d************\n",Output); break; case NEQ: Output=Input1!=Input2; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** NOT EQUALS IN THIS PE %d************\n",Output); break; case LDi: case LDMi: case LDUi: Output=Input1; printf("\nInput1 = %d\tInput2 = %d\n",Input1, Input2); printf("\n******** LDI IN THIS PE %d************\n",Output); break; case NOOP: printf("CGRA: NOOP.Execute()\n"); break; default: throw new CGRAException("Unknown CGRA Opcode"); } if (ins->getSelectDataMemoryAddressBus()) { printf("\n*********Setting Address %x ******\n",(unsigned int)Output); MemoryPort->setAddress(Output); MemoryPort->Read(); } if (ins->getSelectDataMemoryDataBus()) { printf("\n******** DB Output %d************\n",Output); MemoryPort->setData(Output); } if (ins->getWriteRegisterEnable()) { // printf("\n************** WE *****************\n"); int writeRegisterNumber = ins->getWriteRegAddress(); if(ins_opcode==LDi) { writeRegisterNumber = writeRegisterNumber + REGFILESIZE; RegFile->Write(writeRegisterNumber,Output); } else if(ins_opcode==LDMi) { writeRegisterNumber = writeRegisterNumber + REGFILESIZE; Output=(Output<<12) | ( RegFile->Read(writeRegisterNumber)); RegFile->Write(writeRegisterNumber,Output); } else if(ins_opcode==LDUi) { writeRegisterNumber = writeRegisterNumber + REGFILESIZE; Output=(Output<<24) | ( RegFile->Read(writeRegisterNumber)); RegFile->Write(writeRegisterNumber,Output); } else RegFile->Write(writeRegisterNumber,Output); } advanceTime(); if(ins_opcode==EQ || ins_opcode==NEQ || ins_opcode==GT || ins_opcode==LT) { //write the result to the controller bus printf("\nCOMPARE INSTRUCTION OUTPUT = %d\n",Output); if(ins_opcode == EQ || ins_opcode == NEQ) *(this->Controller_Reg) = ~Output; else *(this->Controller_Reg) = Output; } // cout << "Kernelcount " << KernelCount << endl; // if(KernelCount < 1) //If it is 1, then this is last run //Actually We Don't Rely On This. // *(this->Controller_Reg)=0; // KernelCount--; }
void DBCCArmatureNode::update(float dt) { DBASSERT(!_clock, "can not has clock when update!"); advanceTime(dt); }