Example #1
0
        private void Inst_Lhu(MipsInstruction inst)
        {
            try
            {
                Int64 address = ComputeAddress(inst);

                if ((address & 1) != 0)
                {
                    CauseException = ExceptionCode.AddressErrorLoad;
                    return;
                }

                if (!MipsState.Operating64BitMode)
                {
                    MipsState.WriteGPR32Unsigned(inst.Rt, DataManipulator.LoadHalfwordUnsigned(address));
                }
                else
                {
                    MipsState.WriteGPRUnsigned(inst.Rt, DataManipulator.LoadHalfwordUnsigned(address));
                }
            }
            catch (TLBException tlbe)
            {
                switch (tlbe.ExceptionType)
                {
                case TLBExceptionType.Invalid: CauseException = ExceptionCode.Invalid; break;

                case TLBExceptionType.Mod: CauseException = ExceptionCode.TlbMod; break;

                case TLBExceptionType.Refill: CauseException = ExceptionCode.TlbStore; break;

                default: break;
                }
            }
        }