def _translate_structural(s, m): """Translate structural part of component m. This method will be recursively applied to different components in the hierarchy. """ m_rtype = m._pass_structural_rtlir_gen.rtlir_type s.structural.component_is_top[m] = m is s.tr_top s.structural.component_name[m] = m_rtype.get_name() s.structural.component_file_info[m] = m_rtype.get_file_info() s.structural.component_full_name[m] = get_component_full_name(m_rtype) s.structural.component_unique_name[m] = \ s.rtlir_tr_component_unique_name(m_rtype) if m is s.tr_top and s.tr_cfgs: s.structural.component_explicit_module_name[m] = s.tr_cfgs[ m].explicit_module_name else: s.structural.component_explicit_module_name[m] = '' if s.tr_cfgs: s.structural.component_no_synthesis[m] = s.tr_cfgs[m].no_synthesis else: s.structural.component_no_synthesis[m] = False # Translate declarations of signals s.translate_decls(m) # Translate connections s.translate_connections(m) # Grab the pickled external source generated by PlaceholderPass s.get_placeholder_src(m)
def get_component_unique_name( c_rtype ): full_name = get_component_full_name( c_rtype ) special_chars = [' ', '<', '>', '.'] if len( full_name ) < 64 and not any([c in full_name for c in special_chars]): return full_name comp_name = c_rtype.get_name() param_hash = blake2b(digest_size = 8) param_hash.update(full_name[len(comp_name):].encode('ascii')) param_name = param_hash.hexdigest() return comp_name + "__" + param_name
def get_component_unique_name(c_rtype): full_name = get_component_full_name(c_rtype) if len(full_name) < 64: return full_name comp_name = c_rtype.get_name() param_hash = blake2b(digest_size=8) param_hash.update(full_name[len(comp_name):].encode('ascii')) param_name = param_hash.hexdigest() return comp_name + "__" + param_name def get_string(obj): """Return the string that identifies `obj`""" if isinstance(obj, type): return obj.__name__ return str(obj)
def _translate_structural(s, m): """Translate structural part of component m. This method will be recursively applied to different components in the hierarchy. """ m_rtype = m._pass_structural_rtlir_gen.rtlir_type s.structural.component_file_info[m] = m_rtype.get_file_info() s.structural.component_name[m] = m_rtype.get_name() s.structural.component_full_name[m] = get_component_full_name(m_rtype) s.structural.component_unique_name[m] = \ s.rtlir_tr_component_unique_name(m_rtype) # Translate declarations of signals s.translate_decls(m) # Translate connections s.translate_connections(m)