from typing import Tuple


def int_to_binary(val: int, dim: int) -> Tuple[int, ...]:
    """Convert an integer to corresponding binary tuple, with most significant bit as
     the first element of tuple.

    :param val: input integer
    :type val: int
    :param dim: Bit width
    :type dim: int

    :return: Binary tuple of width dim
    :rtype: Tuple[int, ...]
    """
    return tuple(map(int, format(val, "0{}b".format(dim))))