def __sbiw_rd_i(op):
    """
    Decode and return the 'Rd' and 'immediate' arguments of a SBIW opcode
    """
    AVR_SBIW_RD_MASK = 0x0030
    AVR_SBIW_CONST_MASK = 0x00CF

    imm_part = op & AVR_SBIW_CONST_MASK
    imm = ((imm_part >> 2) & 0x30) | (imm_part & 0xF)

    # rd_part is 2 bits and indicates r24, 26, 28, or 30
    rd_part = (op & AVR_SBIW_RD_MASK) >> 4
    rd = (2 * rd_part) + 24

    return (rd, imm)