예제 #1
0
 def ldrOneReg(
     state: programState.ProgramState
 ) -> Tuple[programState.ProgramState, Union[
         programState.RunError, None]]:
     adr, loadErr = state.getReg(src1.contents)
     err: Union[None,
                programState.RunError] = state.loadRegister(
                    adr, bitSize, sign_extend, dest.contents)
     return state, loadErr if err is None else err
예제 #2
0
    def pop(state: programState.ProgramState) -> Tuple[programState.ProgramState, Union[programState.RunError, None]]:
        if len(regs) == 0:
            return state, None
        # head, *tail = registers

        address = state.getReg("SP")
        # check address is in 0...stacksize
        if address > (state.getLabelAddress("__STACKSIZE")) or address < 0:
            return state, programState.RunError("All stack entries have been pop'ed already", programState.RunError.ErrorType.Error)
        for reg in regs:
            err = state.loadRegister(address, 32, False, reg)
            address += 4
            if err is not None:
                return state, err
        state.setReg("SP", address)
        return state, None
예제 #3
0
 def ldrRegImmed(state: programState.ProgramState) -> Tuple[programState.ProgramState, Union[programState.RunError, None]]:
     adr = state.getReg(src1.contents)
     err: Union[None, programState.RunError] = state.loadRegister(adr + value, bitSize, sign_extend, dest.contents)
     return state, err
예제 #4
0
 def ldrDualReg(state: programState.ProgramState) -> Tuple[programState.ProgramState, Union[programState.RunError, None]]:
     adr1 = state.getReg(src1.contents)
     adr2 = state.getReg(src2.contents)
     err: Union[None, programState.RunError] = state.loadRegister(adr1 + adr2, bitSize, sign_extend, dest.contents)
     return state, err