// since this operation is carried out writing sa value as unsigned value, it is necessary // the overriding of ID method public void ID() throws RAWException, IrregularWriteOperationException { // if the source register is valid passing his own value into a temporary register Register rt = cpu.getRegister(params.get(RT_FIELD)); if (rt.getWriteSemaphore() > 0) throw new RAWException(); TR[RT_FIELD] = rt; // writing on a temporary register the sa field as unsigned value TR[SA_FIELD].writeDoubleWord(params.get(SA_FIELD)); // increment the semaphore of the destination register Register rd = cpu.getRegister(params.get(RD_FIELD)); rd.incrWriteSemaphore(); }
public void ID() throws RAWException, IrregularWriteOperationException, IrregularStringOfBitsException { // if source registers are valid passing their own values into temporary registers Register rs = cpu.getRegister(params.get(RS_FIELD)); Register rt = cpu.getRegister(params.get(RT_FIELD)); if (rs.getWriteSemaphore() > 0 || rt.getWriteSemaphore() > 0) throw new RAWException(); TR[RS_FIELD] = rs; TR[RT_FIELD] = rt; // locking the destination register cpu.getLO().incrWriteSemaphore(); cpu.getHI().incrWriteSemaphore(); }
public void doWB() throws IrregularStringOfBitsException { // passing results from temporary registers to destination registers and unlocking them Register lo = cpu.getLO(); Register hi = cpu.getHI(); lo.setBits(this.lo, 0); hi.setBits(this.hi, 0); lo.decrWriteSemaphore(); hi.decrWriteSemaphore(); }