build-tools/merge_json.py
def expand_arrays(json_dict, aw_threshold=2, verbose=False):
    ''' Expand register array to individual per-element registers for arrays of
    address width <= aw_threshold
    '''
    names = [k for k in json_dict if 'addr_width' in json_dict[k] and 0 < json_dict[k]['addr_width'] <= aw_threshold]
    for name in names:
        k_expansion = {}
        if verbose:
            print(name)
            print(json_dict[name])
        for ix in range(2**json_dict[name]['addr_width']):
            element_name = name+'_{}'.format(ix)
            k_expansion.update({element_name: copy.deepcopy(json_dict[name])})
            k_expansion[element_name]['addr_width'] = 0
            k_expansion[element_name]['base_addr'] = json_dict[name]['base_addr'] + ix
            if verbose:
                print(element_name)
                print(json_dict[name]['base_addr'])
                print(ix)
                print(k_expansion[element_name])
        del json_dict[name]
        json_dict.update(k_expansion)
 Expand register array to individual per-element registers for arrays of
    address width <= aw_threshold
    
Expand register array to individual per-element registers for arrays of
address width <= aw_threshold
Expand register array to individual per - element registers for arrays of address width < = aw_threshold
def expand_arrays(json_dict, aw_threshold=2, verbose=False):
    names = [k for k in json_dict if 'addr_width' in json_dict[k] and 0 < json_dict[k]['addr_width'] <= aw_threshold]
    for name in names:
        k_expansion = {}
        if verbose:
            print(name)
            print(json_dict[name])
        for ix in range(2**json_dict[name]['addr_width']):
            element_name = name+'_{}'.format(ix)
            k_expansion.update({element_name: copy.deepcopy(json_dict[name])})
            k_expansion[element_name]['addr_width'] = 0
            k_expansion[element_name]['base_addr'] = json_dict[name]['base_addr'] + ix
            if verbose:
                print(element_name)
                print(json_dict[name]['base_addr'])
                print(ix)
                print(k_expansion[element_name])
        del json_dict[name]
        json_dict.update(k_expansion)
def expand_arrays ( json_dict , aw_threshold = 2 , verbose = False ) : names = [ k for k in json_dict if 'addr_width' in json_dict [ k ] and 0 < json_dict [ k ] [ 'addr_width' ] <= aw_threshold ] for name in names : k_expansion = { } if verbose : print ( name ) print ( json_dict [ name ] ) for ix in range ( 2 ** json_dict [ name ] [ 'addr_width' ] ) : element_name = name + '_{}' . format ( ix ) k_expansion . update ( { element_name : copy . deepcopy ( json_dict [ name ] ) } ) k_expansion [ element_name ] [ 'addr_width' ] = 0 k_expansion [ element_name ] [ 'base_addr' ] = json_dict [ name ] [ 'base_addr' ] + ix if verbose : print ( element_name ) print ( json_dict [ name ] [ 'base_addr' ] ) print ( ix ) print ( k_expansion [ element_name ] ) del json_dict [ name ] json_dict . update ( k_expansion )
Expand register array to individual per-element registers for arrays of
address width <= aw_threshold
Expand register array to individual per - element registers for arrays of address width < = aw_threshold
''' Expand register array to individual per-element registers for arrays of
    address width <= aw_threshold
    '''
json_dict
aw_threshold
verbose