def dec_to_list(dec_val, num_bits):
    """
        Converts decimal value to list of 1's and 0's.
    """
    bin_str = '{0:b}'.format(dec_val)
    bin_str = str.zfill(bin_str, num_bits)
    ret_list = []
    for bin_val in bin_str:
        ret_list.append(int(bin_val))

    return ret_list