Exemple #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));
        }
Exemple #2
0
 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)));
 }
Exemple #3
0
        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);
        }
Exemple #4
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();
     }
 }
Exemple #5
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();
     }
 }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #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)));
 }
Exemple #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));
 }