示例#1
0
        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));
        }
示例#2
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();
     }
 }
示例#3
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();
     }
 }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
 /// <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);
 }
示例#7
0
 public void undoOp(MIPSChip_Instance chip)
 {
     chip.setRegister(rd, last);
 }
示例#8
0
 /// <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)));
 }
示例#9
0
 /// <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));
 }