示例#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