import re


def fasm2bitarray(fasm_value):
    """ Convert FASM value into array of bits ('0', '1')

    Note: index 0 is the LSB.

    """
    m = re.match("([0-9]+)'b([01]+)", fasm_value)
    assert m is not None, fasm_value

    bits = int(m.group(1))
    bitarray = m.group(2)

    assert len(bitarray) == bits, (fasm_value, len(bitarray), bits)

    return [b for b in bitarray][::-1]