build-tools/newad.py
def address_allocation(fd,
                       hierarchy,
                       names,
                       address,
                       low_res=False,
                       gen_mirror=False,
                       plot_map=False):
    '''
    NOTE: The whole hierarchy thing is currently being bypassed
    TODO: Possibly remove hierarchy from here, or even make it optional
    hierarchy: Index into g_hierarchy (current hierarchy level)
    names: All signal names that belong in the current hierarchy
    address:
    for current index in g_hierarchy denoted with variable 'hierarchy'
    1. partition 'names' that belong inside vs outside the hierarchy
    2. (a) generate addresses for names (in_mod) that fall in the hierarchy
    (recurse)
    (b) generate addresses for signals outside the hierarchy (out_mod)
    '''
    if hierarchy == len(g_hierarchy):
        return generate_addresses(fd, names, address, low_res, gen_mirror,
                                  plot_map)
    h = g_hierarchy[hierarchy]
    in_mod, out_mod = [], []
    if type(h) is list:
        prefix = h[0]
        for hn in range(h[1]):
            hh = prefix + str(hn)
            address = address_allocation(
                fd, hierarchy + 1, [n for n in names if hh in n], address,
                low_res, gen_mirror, plot_map)
        out_mod = [n for n in names if prefix not in n]
    else:
        for n in names:
            (in_mod if h in n else out_mod).append(n)
        address = address_allocation(fd, hierarchy + 1, in_mod, address,
                                     low_res, gen_mirror, plot_map)
    return generate_addresses(fd, out_mod, address, low_res, gen_mirror,
                              plot_map)

    NOTE: The whole hierarchy thing is currently being bypassed
    TODO: Possibly remove hierarchy from here, or even make it optional
    hierarchy: Index into g_hierarchy (current hierarchy level)
    names: All signal names that belong in the current hierarchy
    address:
    for current index in g_hierarchy denoted with variable 'hierarchy'
    1. partition 'names' that belong inside vs outside the hierarchy
    2. (a) generate addresses for names (in_mod) that fall in the hierarchy
    (recurse)
    (b) generate addresses for signals outside the hierarchy (out_mod)
    
The whole hierarchy thing is currently being bypassed
TODO: Possibly remove hierarchy from here, or even make it optional
hierarchy: Index into g_hierarchy (current hierarchy level)
names: All signal names that belong in the current hierarchy
address:
for current index in g_hierarchy denoted with variable 'hierarchy'
1. partition 'names' that belong inside vs outside the hierarchy
2. (a) generate addresses for names (in_mod) that fall in the hierarchy
(recurse)
(b) generate addresses for signals outside the hierarchy (out_mod)
The whole hierarchy thing is currently being bypassed TODO : Possibly remove hierarchy from here or even make it optional hierarchy : Index into g_hierarchy ( current hierarchy level ) names : All signal names that belong in the current hierarchy address : for current index in g_hierarchy denoted with variable ' hierarchy ' 1 . partition ' names ' that belong inside vs outside the hierarchy 2 . ( a ) generate addresses for names ( in_mod ) that fall in the hierarchy ( recurse ) ( b ) generate addresses for signals outside the hierarchy ( out_mod )
def address_allocation(fd,
                       hierarchy,
                       names,
                       address,
                       low_res=False,
                       gen_mirror=False,
                       plot_map=False):
    if hierarchy == len(g_hierarchy):
        return generate_addresses(fd, names, address, low_res, gen_mirror,
                                  plot_map)
    h = g_hierarchy[hierarchy]
    in_mod, out_mod = [], []
    if type(h) is list:
        prefix = h[0]
        for hn in range(h[1]):
            hh = prefix + str(hn)
            address = address_allocation(
                fd, hierarchy + 1, [n for n in names if hh in n], address,
                low_res, gen_mirror, plot_map)
        out_mod = [n for n in names if prefix not in n]
    else:
        for n in names:
            (in_mod if h in n else out_mod).append(n)
        address = address_allocation(fd, hierarchy + 1, in_mod, address,
                                     low_res, gen_mirror, plot_map)
    return generate_addresses(fd, out_mod, address, low_res, gen_mirror,
                              plot_map)
def address_allocation ( fd , hierarchy , names , address , low_res = False , gen_mirror = False , plot_map = False ) : if hierarchy == len ( g_hierarchy ) : return generate_addresses ( fd , names , address , low_res , gen_mirror , plot_map ) h = g_hierarchy [ hierarchy ] in_mod , out_mod = [ ] , [ ] if type ( h ) is list : prefix = h [ 0 ] for hn in range ( h [ 1 ] ) : hh = prefix + str ( hn ) address = address_allocation ( fd , hierarchy + 1 , [ n for n in names if hh in n ] , address , low_res , gen_mirror , plot_map ) out_mod = [ n for n in names if prefix not in n ] else : for n in names : ( in_mod if h in n else out_mod ) . append ( n ) address = address_allocation ( fd , hierarchy + 1 , in_mod , address , low_res , gen_mirror , plot_map ) return generate_addresses ( fd , out_mod , address , low_res , gen_mirror , plot_map )
NOTE: The whole hierarchy thing is currently being bypassed
TODO: Possibly remove hierarchy from here, or even make it optional
hierarchy: Index into g_hierarchy (current hierarchy level)
names: All signal names that belong in the current hierarchy
address:
for current index in g_hierarchy denoted with variable 'hierarchy'
1. partition 'names' that belong inside vs outside the hierarchy
2.
NOTE : The whole hierarchy thing is currently being bypassed TODO : Possibly remove hierarchy from here or even make it optional hierarchy : Index into g_hierarchy ( current hierarchy level ) names : All signal names that belong in the current hierarchy address : for current index in g_hierarchy denoted with variable ' hierarchy ' 1 . partition ' names ' that belong inside vs outside the hierarchy 2 .
'''
    NOTE: The whole hierarchy thing is currently being bypassed
    TODO: Possibly remove hierarchy from here, or even make it optional
    hierarchy: Index into g_hierarchy (current hierarchy level)
    names: All signal names that belong in the current hierarchy
    address:
    for current index in g_hierarchy denoted with variable 'hierarchy'
    1. partition 'names' that belong inside vs outside the hierarchy
    2. (a) generate addresses for names (in_mod) that fall in the hierarchy
    (recurse)
    (b) generate addresses for signals outside the hierarchy (out_mod)
    '''
fd
hierarchy
names
address
low_res
gen_mirror
plot_map