本文整理汇总了Python中vunit.project.Project.has_library方法的典型用法代码示例。如果您正苦于以下问题:Python Project.has_library方法的具体用法?Python Project.has_library怎么用?Python Project.has_library使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vunit.project.Project
的用法示例。
在下文中一共展示了Project.has_library方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VUnit
# 需要导入模块: from vunit.project import Project [as 别名]
# 或者: from vunit.project.Project import has_library [as 别名]
#.........这里部分代码省略.........
if create_new:
database = DataBase(project_database_file_name, new=True)
database[key] = version
return PickledDataBase(database)
@staticmethod
def _configure_logging(log_level):
"""
Configure logging based on log_level string
"""
level = getattr(logging, log_level.upper())
logging.basicConfig(filename=None, format='%(levelname)7s - %(message)s', level=level)
def add_external_library(self, library_name, path):
"""
Add external black box library
"""
self._project.add_library(library_name, abspath(path), is_external=True)
return self._create_library_facade(library_name)
def add_library(self, library_name):
"""
Add vunit managed white box library
"""
path = join(self._simulator_factory.simulator_output_path, "libraries", library_name)
self._project.add_library(library_name, abspath(path))
return self._create_library_facade(library_name)
def library(self, library_name):
"""
Get reference to library
"""
if not self._project.has_library(library_name):
raise KeyError(library_name)
return self._create_library_facade(library_name)
def _create_library_facade(self, library_name):
"""
Create a Library object to be exposed to users
"""
return LibraryFacade(library_name, self, self._project, self._configuration)
def set_generic(self, name, value):
"""
Globally set generic
"""
self._configuration.set_generic(name.lower(), value, scope=create_scope())
def set_parameter(self, name, value):
"""
Globally set parameter
"""
self.set_generic(name, value)
def set_sim_option(self, name, value):
"""
Globally set simulation option
"""
self._configuration.set_sim_option(name, value, scope=create_scope())
def set_pli(self, value):
"""
Globally set pli
"""
self._configuration.set_pli(value, scope=create_scope())
示例2: VUnit
# 需要导入模块: from vunit.project import Project [as 别名]
# 或者: from vunit.project.Project import has_library [as 别名]
#.........这里部分代码省略.........
.. code-block:: python
prj.add_external_library("unisim", "path/to/unisim/")
"""
self._project.add_library(library_name, abspath(path), is_external=True)
return self._create_library_facade(library_name)
def add_library(self, library_name):
"""
Add a library managed by VUnit.
:param library_name: The name of the library
:returns: The created :class:`.Library` object
:example:
.. code-block:: python
library = prj.add_library("lib")
"""
path = join(self._simulator_factory.simulator_output_path, "libraries", library_name)
self._project.add_library(library_name, abspath(path))
return self._create_library_facade(library_name)
def library(self, library_name):
"""
Get a library
:param library_name: The name of the library
:returns: A :class:`.Library` object
"""
if not self._project.has_library(library_name):
raise KeyError(library_name)
return self._create_library_facade(library_name)
def _create_library_facade(self, library_name):
"""
Create a Library object to be exposed to users
"""
return Library(library_name, self, self._project, self._configuration)
def set_generic(self, name, value):
"""
Globally set a value of generic
:param name: The name of the generic
:param value: The value of the generic
:example:
.. code-block:: python
prj.set_generic("data_width", 16)
"""
self._configuration.set_generic(name.lower(), value, scope=create_scope())
def set_parameter(self, name, value):
"""
Globally set value of parameter
:param name: The name of the parameter
:param value: The value of the parameter