Ejemplo n.º 1
0
 /// <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();
     }
 }
Ejemplo n.º 2
0
 /// <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();
     }
 }