def op_er(binary, N, instr, sub_op, setFlags): rdKey = utilFunc.getRegKeyByStringKey(binary[27:32]) rnKey = utilFunc.getRegKeyByStringKey(binary[22:27]) rmkey = utilFunc.getRegKeyByStringKey(binary[11:16]) option = binary[16:19] imm3 = binary[19:22] shift = int(imm3, 2) rnVal = utilFunc.getRegValueByStringkey(binary[22:27], '1') rmVal = utilFunc.getRegValueByStringkey(binary[11:16], '0') if (N == 32): rnVal = rnVal[32:64] rmVal = rmVal[32:64] r = 'w' elif (N == 64): r = 'x' if (option[1:3] == '11'): rmToPrint = 'x' else: rmToPrint = 'w' instr += " " + r + str(rdKey) + ", " + r + str( rnKey) + ", " + rmToPrint + str(rmkey) + ", " op2, instr = utilFunc.extendReg(rmVal, shift, option, instr, N) instr += " #" + str(shift) to_store, isSp = utilFunc.addSub(rdKey, rnVal, op2, sub_op, N, setFlags) utilFunc.finalize(rdKey, to_store.zfill(const.REG_SIZE), instr, isSp)
def op_er(binary, N, instr, sub_op, setFlags): rdKey = utilFunc.getRegKeyByStringKey(binary[27:32]) rnKey = utilFunc.getRegKeyByStringKey(binary[22:27]) rmkey = utilFunc.getRegKeyByStringKey(binary[11:16]) option = binary[16:19] imm3 = binary[19:22] shift = int(imm3, 2) rnVal = utilFunc.getRegValueByStringkey(binary[22:27], '1') rmVal = utilFunc.getRegValueByStringkey(binary[11:16], '0') if(N == 32): rnVal = rnVal[32:64] rmVal = rmVal[32:64] r = 'w' elif(N == 64): r = 'x' if(option[1:3] == '11'): rmToPrint = 'x' else: rmToPrint = 'w' instr += " " + r + str(rdKey) + ", " + r + str(rnKey) + ", " + rmToPrint + str(rmkey) + ", " op2, instr = utilFunc.extendReg(rmVal, shift, option, instr, N) instr += " #" + str(shift) to_store, isSp = utilFunc.addSub(rdKey, rnVal, op2, sub_op, N, setFlags) utilFunc.finalize(rdKey, to_store.zfill(const.REG_SIZE), instr, isSp)
def helper_reg(binary, instr): rtKey = utilFunc.getRegKeyByStringKey(binary[27:32]) rnKey = utilFunc.getRegKeyByStringKey(binary[22:27]) rmKey = utilFunc.getRegKeyByStringKey(binary[11:16]) rnVal = utilFunc.getRegValueByStringkey(binary[22:27], '1') rmVal = utilFunc.getRegValueByStringkey(binary[11:16], '0') s = binary[19] option = binary[16:19] opc = binary[8:10] size = binary[0:2] wback = False postIndex = False scale = utilFunc.uInt(size) if s == '1': shift = scale else: shift = 0 if (option[1:3] == '10'): rmToPrint = 'w' elif (option[1:3] == '11'): rmToPrint = 'x' instr += str(rtKey) + ", [x" + str(rnKey) + ", " + rmToPrint + str( rmKey) + ", " offset, instr = utilFunc.extendReg(rmVal, shift, option, instr, 64) offset = utilFunc.sInt(offset, 64) instr += ' #' if size == '10': if s == '0': instr += '0' else: instr += '2' if size == '11': if s == '0': instr += '0' else: instr += '3' instr += ']' helper_all(binary, opc, size, wback, postIndex, offset, rtKey, rnKey, scale, instr)
def helper_reg(binary, instr): rtKey = utilFunc.getRegKeyByStringKey(binary[27:32]) rnKey = utilFunc.getRegKeyByStringKey(binary[22:27]) rmKey = utilFunc.getRegKeyByStringKey(binary[11:16]) rnVal = utilFunc.getRegValueByStringkey(binary[22:27], '1') rmVal = utilFunc.getRegValueByStringkey(binary[11:16], '0') s = binary[19] option = binary[16:19] opc = binary[8:10] size = binary[0:2] wback = False postIndex = False scale = utilFunc.uInt(size) if s == '1': shift = scale else: shift = 0 if(option[1:3] == '10'): rmToPrint = 'w' elif(option[1:3] == '11'): rmToPrint = 'x' instr += str(rtKey) + ", [x" + str(rnKey) + ", " + rmToPrint + str(rmKey) + ", " offset, instr = utilFunc.extendReg(rmVal, shift, option, instr, 64) offset = utilFunc.sInt(offset, 64) instr += ' #' if size == '10': if s == '0': instr += '0' else: instr += '2' if size == '11': if s == '0': instr += '0' else: instr += '3' instr += ']' helper_all(binary, opc, size, wback, postIndex, offset, rtKey, rnKey, scale, instr)