Пример #1
0
    def _createState(self):
        state = State()

        # The priorities are set in such a way as to enable floating point before loading the
        # floating point registers
        expected_sys_reg_state_data = []
        sys_reg_name = 'misa'
        (sys_reg_val, valid) = self.readRegister(sys_reg_name)
        state_transition_test_utils.assertValidRegisterValue(
            self, sys_reg_name, valid)

        sys_reg_val |= 0x0000028
        state.addRegisterStateElement(sys_reg_name, (sys_reg_val, ),
                                      aPriority=1)
        expected_sys_reg_state_data.append((sys_reg_name, sys_reg_val))
        self._mExpectedStateData[
            EStateElementType.SystemRegister] = expected_sys_reg_state_data

        self._mExpectedStateData[
            EStateElementType.
            FloatingPointRegister] = state_transition_test_utils.addRandomFloatingPointRegisterStateElements(
                self,
                state,
                RandomUtils.random32(0, 10),
                aPriorityMin=2,
                aPriorityMax=4)

        return state
Пример #2
0
 def _createState(self):
     state = State()
     self._mExpectedStateData[
         EStateElementType.
         FloatingPointRegister] = state_transition_test_utils.addRandomFloatingPointRegisterStateElements(
             self, state, RandomUtils.random32(0, 15))
     return state
Пример #3
0
    def _createState(self):
        state = State()

        self._mExpectedStateData[EStateElementType.Memory] = state_transition_test_utils.addRandomMemoryStateElements(self, state, RandomUtils.random32(0, 20))
        self._mExpectedStateData[EStateElementType.GPR] = state_transition_test_utils.addRandomGprStateElements(self, state, RandomUtils.random32(0, 20))
        self._mExpectedStateData[EStateElementType.FloatingPointRegister] = state_transition_test_utils.addRandomFloatingPointRegisterStateElements(self, state, RandomUtils.random32(0, 20))
        self._mExpectedStateData[EStateElementType.PC] = state_transition_test_utils.addRandomPcStateElement(self, state)

        return state
Пример #4
0
    def _createState(self):
        state = State()

        self._mExpectedStateData[
            EStateElementType.
            PC] = state_transition_test_utils.addRandomPcStateElement(
                self, state)
        self._mExpectedStateData[
            EStateElementType.
            FloatingPointRegister] = state_transition_test_utils.addRandomFloatingPointRegisterStateElements(
                self, state, RandomUtils.random32(0, 20))
        self._mExpectedStateData[
            EStateElementType.
            GPR] = state_transition_test_utils.addRandomGprStateElements(
                self, state, RandomUtils.random32(0, 20))
        self._mExpectedStateData[
            EStateElementType.
            Memory] = state_transition_test_utils.addRandomMemoryStateElements(
                self, state, RandomUtils.random32(0, 20))

        expected_sys_reg_state_data = []
        mscratch_val = RandomUtils.random64()
        state.addRegisterStateElement('mscratch', (mscratch_val, ))
        expected_sys_reg_state_data.append(('mscratch', mscratch_val))
        mepc_val = UtilityFunctions.getAlignedValue(RandomUtils.random64(), 4)
        state.addRegisterStateElement('mepc', (mepc_val, ))
        expected_sys_reg_state_data.append(('mepc', mepc_val))
        self._mExpectedStateData[
            EStateElementType.SystemRegister] = expected_sys_reg_state_data

        expected_vm_context_state_data = []
        mode_val = self.choice((0, 8, 9))
        state.addVmContextStateElement('satp', 'MODE', mode_val)
        expected_vm_context_state_data.append(('satp', 'MODE', mode_val))
        mpp_val = self.choice((0, 1, 3))
        state.addVmContextStateElement('mstatus', 'MPP', mpp_val)
        expected_vm_context_state_data.append(('mstatus', 'MPP', mpp_val))
        sum_val = RandomUtils.random32(0, 1)
        state.addVmContextStateElement('mstatus', 'SUM', sum_val)
        expected_vm_context_state_data.append(('mstatus', 'SUM', sum_val))
        self._mExpectedStateData[
            EStateElementType.VmContext] = expected_vm_context_state_data

        self._mExpectedStateData[
            EStateElementType.
            VectorRegister] = state_transition_test_utils.addRandomVectorRegisterStateElements(
                self, state, RandomUtils.random32(0, 20))

        return state