コード例 #1
0
ファイル: LabMarker_3.cs プロジェクト: tkern0/UoW_Work
        public override bool Mark(RexSimulator.Hardware.RexBoard mBoard)
        {
            if (SupressReset)
            {
                return(true);
            }

            mBoard.CPU.mGpRegisters[RexSimulator.Hardware.Wramp.RegisterFile.GpRegister.sp]   = 0x03b7f; //sensible value for the stack pointer
            mBoard.CPU.mGpRegisters[RexSimulator.Hardware.Wramp.RegisterFile.GpRegister.ra]   = 0x80000; //when the CPU tries to jump here, the test is over.
            mBoard.CPU.mSpRegisters[RexSimulator.Hardware.Wramp.RegisterFile.SpRegister.evec] = 0x80000; //when the CPU tries to jump here, the test is over (should jal to exit, which is syscall).
            return(true);
        }
コード例 #2
0
        public override bool Mark(RexSimulator.Hardware.RexBoard mBoard)
        {
            mBoard.Serial2.SerialDataTransmitted += new EventHandler <RexSimulator.Hardware.Rex.SerialIO.SerialEventArgs>(Serial2_SerialDataTransmitted);

            program_start = mBoard.CPU.PC;

            //Use a reasonable value for the old exception vector
            mBoard.CPU.mSpRegisters[RegisterFile.SpRegister.evec] = TEST_EVEC;

            Wag(mBoard);

            //Ensure the cctrl and evec are fine.
            if ((mBoard.CPU.mSpRegisters[RegisterFile.SpRegister.cctrl] & 0x000002E2) != (ExpectedCCTRL & 0x000002E2)) //don't care if the interrupts for SP1 or the unused stuff are on or off
            {
                mMessage += string.Format("$cctrl was not set to the correct value: was 0x{0:X8}\r\n", mBoard.CPU.mSpRegisters[RegisterFile.SpRegister.cctrl]);
                return(false);
            }

            if (mBoard.CPU.mSpRegisters[RegisterFile.SpRegister.evec] >= WRAMPMON_ADDRESS)
            {
                mMessage += "$evec still points to the original exception handler.\r\n";
                return(false);
            }

            //Perform question-specific tests
            if (!DoSubTest(mBoard))
            {
                return(false);
            }

            mBoard.CPU.InterruptStatus |= 0x1000; //raise a GPF exception
            for (int i = 0; i < CLOCK_CYCLE_LIMIT; i++)
            {
                mBoard.Tick();
                if (mBoard.CPU.PC >= WRAMPMON_ADDRESS)
                {
                    break;
                }
            }
            if (mBoard.CPU.PC != TEST_EVEC && mBoard.CPU.PC != TEST_EVEC + 1)
            {
                mMessage += "Did not jump to the default exception handler to handle a GPF exception. Are you saving $evec correctly?\r\n";
                return(false);
            }

            return(true);
        }
コード例 #3
0
ファイル: LabMarker_1.cs プロジェクト: tkern0/UoW_Work
        public override bool Mark(RexSimulator.Hardware.RexBoard mBoard)
        {
            //Allow some setup code to run
            for (int i = 0; i < 1e6; i++)
            {
                mBoard.Tick();
            }

            bool passed = true;

            for (uint i = 0; i <= 0xff; i++)
            {
                uint expected = GetExpected(i);
                passed &= Test(i, expected, mBoard);
            }
            return(passed);
        }
コード例 #4
0
ファイル: LabMarker_3_3.cs プロジェクト: tkern0/UoW_Work
        public override bool Mark(RexSimulator.Hardware.RexBoard mBoard)
        {
            // Initialise
            base.Mark(mBoard);

            uint[] testCases =
            {
                0x0000, 0xffff, 0x5a5a, 0xa5a5, 0x1f1f, 0xf4f4,
                0x000F, 0x00F0, 0x0F00, 0xF000, 0x00FF, 0xFF00,
                0x0000, 0xFFFF, 0x0F0F, 0xF0F0, 0xA5A5, 0x5A5A,
                0xdead, 0xbeef, 0xf00d, 0x1234, 0xF080, 0x80F0,
            };

            // Allow some setup code to run
            for (int i = 0; i < 1e6; i++)
            {
                mBoard.Tick();
            }

            // Functional buttons
            foreach (uint testCase in testCases)
            {
                if (!RunParallelTestCase(mBoard, testCase))
                {
                    return(false);
                }
            }

            // Exit button
            mBoard.Parallel.Buttons = 4;
            Tick(mBoard);
            if (mBoard.CPU.PC < 0x80000)
            {
                mMessage += "Program did not properly terminate when button 3 was pressed.\r\n";
                return(false);
            }

            return(true);
        }