def _importVunitFiles(self, vunit_module): """ Imports VUnit sources from a VUnit module """ # I'm not sure how this would work because VUnit specifies a # single VHDL revision for a whole project, so there can be # incompatibilities as this is really used vunit_project = vunit_module.from_argv( ['--output-path', p.join(self._parms['target_dir'], 'vunit')]) # OSVVM is always avilable vunit_project.add_osvvm() # Communication library and array utility library are only # available on VHDL 2008 if vunit_project.vhdl_standard == '2008': for func in (vunit_project.add_com, vunit_project.add_array_util): try: func() except: # pragma: no cover pylint:disable=bare-except self._logger.exception("Error running '%s'", str(func)) raise # Get extra flags for building VUnit sources if self.getBuilder() in _VUNIT_FLAGS: vunit_flags = _VUNIT_FLAGS[self.getBuilder()][ vunit_project.vhdl_standard] else: vunit_flags = [] _source_file_args = [] for vunit_source_obj in vunit_project.get_compile_order(): path = p.abspath(vunit_source_obj.name) library = vunit_source_obj.library.name _source_file_args.append({ 'filename': path, 'library': library, 'flags': vunit_flags if path.endswith('.vhd') else [] }) for source in getSourceFileObjects(_source_file_args): self._sources[source.filename] = source
def _doParseConfigFile(self): """ Parse the configuration file without any previous checking """ self._logger.info("Parsing '%s'", self.filename) self._updateTimestamp() source_path_list = [] source_build_list = [] for _line in open(self.filename, mode='rb').readlines(): line = _replaceCfgComments("", _line.decode(errors='ignore')) line_source_list, line_build_list = self._parseLine(line) source_path_list += line_source_list source_build_list += line_build_list # At this point we have a list of sources parsed from the config # file and the info we need to build each one. We'll use a pool # to speed up parsing (important especially for libraries with # many files. The multiprocessing.Pool class used to hang, so # watch out if this behaves well enough to be used for source in getSourceFileObjects(source_build_list): self._logger.debug("Adding source %s", source) self._sources[source.filename] = source self._cleanUpSourcesList(source_path_list) # If no builder was configured, try to discover if 'builder' not in self._parms.keys(): self._discoverBuilder() # Set default flags if the user hasn't specified any self._setDefaultBuildFlagsIfNeeded() # If after parsing we haven't found the configured target # dir, we'll use '.hdlcc' as default if 'target_dir' not in self._parms.keys(): self._parms['target_dir'] = ".hdlcc" # If the configured target folder is not absolute, we assume it # should be relative to the folder where the configuration file # resides if not p.isabs(self._parms['target_dir']): self._parms['target_dir'] = p.join(p.dirname(self.filename), self._parms['target_dir']) self._parms['target_dir'] = p.abspath(self._parms['target_dir'])
def _doParseConfigFile(self): """ Parse the configuration file without any previous checking """ self._logger.info("Parsing '%s'", self.filename) self._updateTimestamp() source_path_list = [] source_build_list = [] for _line in open(self.filename, mode='rb').readlines(): line = _replaceCfgComments("", _line.decode(errors='ignore')) line_source_list, line_build_list = self._parseLine(line) source_path_list += line_source_list source_build_list += line_build_list # At this point we have a list of sources parsed from the config # file and the info we need to build each one. We'll use a pool # to speed up parsing (important especially for libraries with # many files. The multiprocessing.Pool class used to hang, so # watch out if this behaves well enough to be used self._logger.info("Adding %d sources", len(source_build_list)) for source in getSourceFileObjects(source_build_list): self._sources[source.filename] = source self._cleanUpSourcesList(source_path_list) # If no builder was configured, try to discover if 'builder' not in self._parms.keys(): self._discoverBuilder() # Set default flags if the user hasn't specified any self._setDefaultBuildFlagsIfNeeded() # If after parsing we haven't found the configured target # dir, we'll use '.hdlcc' as default if 'target_dir' not in self._parms.keys(): self._parms['target_dir'] = ".hdlcc" # If the configured target folder is not absolute, we assume it # should be relative to the folder where the configuration file # resides if not p.isabs(self._parms['target_dir']): self._parms['target_dir'] = p.join(p.dirname(self.filename), self._parms['target_dir']) self._parms['target_dir'] = p.abspath(self._parms['target_dir'])
def _importVunitFiles(self, vunit_module): """ Imports VUnit sources from a VUnit module """ # I'm not sure how this would work because VUnit specifies a # single VHDL revision for a whole project, so there can be # incompatibilities as this is really used vunit_project = vunit_module.from_argv( ['--output-path', p.join(self._parms['target_dir'], 'vunit')]) # OSVVM is always avilable vunit_project.add_osvvm() # Communication library and array utility library are only # available on VHDL 2008 if vunit_project.vhdl_standard == '2008': for func in (vunit_project.add_com, vunit_project.add_array_util): try: func() except: # pragma: no cover pylint:disable=bare-except self._logger.exception("Error running '%s'", str(func)) raise # Get extra flags for building VUnit sources if self.getBuilder() in _VUNIT_FLAGS: vunit_flags = _VUNIT_FLAGS[self.getBuilder()][vunit_project.vhdl_standard] else: vunit_flags = [] _source_file_args = [] for vunit_source_obj in vunit_project.get_compile_order(): path = p.abspath(vunit_source_obj.name) library = vunit_source_obj.library.name _source_file_args.append( {'filename' : path, 'library' : library, 'flags' : vunit_flags if path.endswith('.vhd') else []}) for source in getSourceFileObjects(_source_file_args): self._sources[source.filename] = source