示例#1
0
def enum_hdl_files(top, outdir, rtl_only=False, wrapper=False, filt=None):
    if isinstance(top, str):
        top = find(top)

    vgen_map = reg[f'hdlgen/map']
    dirs = {}
    for lang in ['v', 'sv', 'vhd']:
        dirs[lang] = reg[f'{lang}gen/include']

    dti_yielded = False

    if reg['hdl/toplang'] == 'sv':
        dti_yielded = True
        yield os.path.join(LIB_SVLIB_DIR, 'dti.sv')

    for node in NodeYielder(filt).visit(top):
        if node not in vgen_map:
            continue

        vinst = vgen_map[node]

        if vinst.lang == 'sv' and not dti_yielded:
            dti_yielded = True
            yield os.path.join(LIB_SVLIB_DIR, 'dti.sv')

        # TODO: What?
        if ((node is top) and wrapper and not rtl_only):
            yield os.path.join(outdir, f'wrap_{vinst.file_basename}')

        if isinstance(node, Gear):
            for f in vinst.files:
                path = find_in_dirs(f, dirs[vinst.lang])
                if path is not None:
                    yield path
                else:
                    yield os.path.join(outdir, f)

        if hasattr(vinst, 'file_basename'):
            file_name = getattr(vinst, 'impl_path', None)
            if file_name:
                yield file_name
            # elif rtl_only is False:
            #     for f in vinst.files:
            #         yield os.path.join(outdir, f)

        elif vinst.is_broadcast:
            if vinst.lang == 'v':
                yield os.path.join(LIB_VLIB_DIR, 'bc.v')
            elif vinst.lang == 'sv':
                yield os.path.join(LIB_SVLIB_DIR, 'bc.sv')
示例#2
0
 def module_name(self):
     if find_in_dirs(f'{self.hier_path_name}.{self.lang}',
                     self.hdl_path_list):
         return self.hier_path_name + '_hier'
     else:
         return self.hier_path_name
示例#3
0
 def module_name(self):
     if (self.hier_path_name in sv_keywords or find_in_dirs(
             f'{self.hier_path_name}.{self.lang}', self.hdl_path_list)):
         return self.hier_path_name + '_hier'
     else:
         return self.hier_path_name