public void doOp(MIPSChip_Instance chip) { last = chip.getRegister(rd); Int64 result = unchecked ((Int64)chip.getRegister(rs) * (Int64)chip.getRegister(rd)); chip.setRegister(rd, (UInt32)(result & 0x0000ffff)); }
public void doOp(MIPSChip_Instance chip) { lastHi = chip.HI; lastLo = chip.LO; chip.HI = (UInt32)((Int32) unchecked (chip.getRegister(rs) % chip.getRegister(rt))); chip.LO = (UInt32)((Int32) unchecked (chip.getRegister(rs) / chip.getRegister(rt))); }
public void doOp(MIPSChip_Instance chip) { lastHi = chip.HI; lastLo = chip.LO; UInt64 result = unchecked ((UInt64)chip.getRegister(rs) * (UInt64)chip.getRegister(rt)); chip.HI = (UInt32)(result >> 32); chip.LO = (UInt32)(result & 0x0000FFFF); }
/// <summary> /// Adds contents of rs to signed 16bit value and store in rt. Trap if overflow is detected. /// Also saves the state of rt before changing it so it may be undone. /// </summary> /// <param name="chip"></param> public void doOp(MIPSChip_Instance chip) { lastRt = chip.getRegister(rt); try { UInt32 temp = (UInt32) checked ((Int32)chip.getRegister(rs) + (Int32)immediate); chip.setRegister(rt, temp); } catch (OverflowException) { chip.interrupt(); } }
/// <summary> /// Adds contents of rs to contents of rt and store in rd. Trap if overflow is detected. /// Also saves the state of rd before changing it so it may be undone. /// </summary> /// <param name="chip"></param> public void doOp(MIPSChip_Instance chip) { this.lastRd = chip.getRegister(this.rd); try { UInt32 temp = (UInt32) checked ((Int32)chip.getRegister(rs) + (Int32)chip.getRegister(rt)); chip.setRegister(rd, temp); } catch (OverflowException) { chip.interrupt(); } }
public void doOp(MIPSChip_Instance chip) { last = chip.getRegister(rd); UInt32 temp = chip.getRegister(rt) | 0xffffff00; if (temp < 0xffffff80) { temp &= 0x000000ff; } chip.setRegister(rd, temp); }
public void doOp(MIPSChip_Instance chip) { this.last = chip.getRegister(rd); int count = 32; UInt32 value = chip.getRegister(rs); for (int i = 31; i >= 0; i--) { if (value >> i == 1) { count = 31 - i; break; } } chip.setRegister(rd, (UInt32)count); }
/// <summary> /// Reverts changes made by setting the contents of rt to the saved value. /// For this to work properly, doOp must have been called only once with the same chip specified here. /// Cannot account for any changes made to registers done by any trap handlers resulting from an overflow. /// </summary> /// <param name="chip"></param> public void undoOp(MIPSChip_Instance chip) { chip.setRegister(this.rt, this.lastRt); }
public void undoOp(MIPSChip_Instance chip) { chip.setRegister(rd, last); }
public void undoOp(MIPSChip_Instance chip) { chip.HI = lastHi; chip.LO = lastLo; }
/// <summary> /// Adds contents of rs to contents of rt and store in rd. /// Also saves the state of rd before changing it so it may be undone. /// </summary> /// <param name="chip"></param> public void doOp(MIPSChip_Instance chip) { this.lastRd = chip.getRegister(this.rd); chip.setRegister(rd, unchecked (chip.getRegister(rs) + chip.getRegister(rt))); }
/// <summary> /// Adds contents of rs to 16bit value and store in rt. Does not do anything upon overflow. /// Also saves the state of rt before changing it so it may be undone. /// </summary> /// <param name="chip"></param> public void doOp(MIPSChip_Instance chip) { lastRt = chip.getRegister(rt); chip.setRegister(rt, unchecked (chip.getRegister(rs) + (UInt32)immediate)); }