本文整理汇总了Python中chiptools.core.project.Project.load_project方法的典型用法代码示例。如果您正苦于以下问题:Python Project.load_project方法的具体用法?Python Project.load_project怎么用?Python Project.load_project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chiptools.core.project.Project
的用法示例。
在下文中一共展示了Project.load_project方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testReporter
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testReporter(self):
project = Project()
project.load_project(self.project_path)
# Check the synthesis reporter
self.assertTrue(
callable(project.get_reporter())
)
示例2: test_preprocessor
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def test_preprocessor(self):
"""Invalid preprocessors should not be executed on files."""
project = Project()
project.load_project(self.project_path)
files = project.get_files()
preprocessors = list(
filter(
lambda x: os.path.exists(x.preprocessor), files
)
)
self.assertTrue(len(preprocessors) > 0)
project.run_preprocessors()
regex = re.compile('library ieee;')
for libname in self.project_structure.keys():
files = self.project_structure[libname]
for path in files:
path = os.path.join(self.root, libname, path)
with open(path, 'r') as f:
data = f.readlines()
match = regex.match(data[0])
self.assertIsNotNone(
match,
msg='File {0} was not correctly preserved.'.format(
path
)
)
示例3: testGenerics
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testGenerics(self):
project = Project()
project.load_project(self.project_path)
# Check the synthesis generics
self.assertDictEqual(
self.project_generics,
project.get_generics(),
)
示例4: testProjectConstraints
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testProjectConstraints(self):
project = Project()
project.load_project(self.project_path)
# Check the project constraints
self.assertEqual(
self.project_constraints,
[os.path.basename(c.path) for c in project.get_constraints()],
)
示例5: testSynthesisToolName
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testSynthesisToolName(self):
project = Project()
project.load_project(self.project_path)
# Check synthesis tool name
self.assertEqual(
self.synthesis_tool_name,
project.get_synthesis_tool_name()
)
示例6: testSimulationToolName
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testSimulationToolName(self):
project = Project()
project.load_project(self.project_path)
# Check simulation tool name
self.assertEqual(
self.simulation_tool_name,
project.get_simulation_tool_name()
)
示例7: testProjectPart
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testProjectPart(self):
project = Project()
project.load_project(self.project_path)
# Check project part
self.assertEqual(
self.project_part,
project.get_fpga_part()
)
示例8: testSimulationDirectory
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testSimulationDirectory(self):
project = Project()
project.load_project(self.project_path)
abs_path = os.path.join(
os.path.abspath(self.root),
self.simulation_directory
)
self.assertEqual(project.get_simulation_directory(), abs_path)
示例9: testSynthesisDirectory
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testSynthesisDirectory(self):
project = Project()
project.load_project(self.project_path)
abs_path = os.path.join(
os.path.abspath(self.root),
self.synthesis_directory
)
self.assertEqual(project.get_synthesis_directory(), abs_path)
示例10: testPreprocessor
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testPreprocessor(self):
project = Project()
project.load_project(self.project_path)
files = project.get_files()
preprocessors = list(
filter(
lambda x: os.path.exists(x.preprocessor), files
)
)
self.assertTrue(len(preprocessors) > 0)
project.run_preprocessors()
示例11: setUpClass
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def setUpClass(cls):
"""
The *setUpClass* method prepares the ChipTools simulation environment
if it has not already been loaded.
If this test case is loaded via the ChipTools Project API it will be
initialised via a call to the *load_environment* method, which pulls
the simulation environment information from the parent Project
instance.
If this test case is loaded via an external tool such as Nosetests the
setUpClass method will attempt to load the project file pointed to by
the project path stored in the *project* attribute. When you create
your test case you can specify this attribute in your test class to
allow an external runner like Nosetests to call your test cases.
If the environment was not already initialised by ChipTools and a valid
project file path is not stored in the *project* attribute, this method
will raise an EnvironmentError and cause your test to fail.
This method overloads the unittest.TestCase.setUpClass classmethod,
which is called once when a TestCase class is instanced.
"""
log.debug("setUpClass of {0} called...".format(cls))
# Check to see if the environment that this class is initialised for
# matches the project path (if specified). If the environment was
# initialised by the ChipTools internal loaded then skip these steps.
if cls._environment_type != "chiptools":
if cls._loaded_path != cls.project:
project = Project()
project.load_project(cls.project)
# Using external test runner (such as Nosetests) to execute this
# test. The test environment therefore needs to be loaded from
# the Project instance:
simulator, root, libs = cls.get_environment(project)
cls._loaded_path = cls.project
cls._simulator = simulator
cls._simulation_root = root
cls._simulation_libraries = libs
cls._environment_type = "external"
# Compile the design if required (simulators with caching will
# perform this step once).
cls._simulator.compile_project(includes=cls._simulation_libraries)
log.debug("...finished initialising environment for {0}".format(cls))
if cls._environment_type is None:
raise EnvironmentError(
"The simulation environment for this TestCase is not "
+ "initialised so the test cases cannot be executed. "
+ "If you are running this test directly ensure that "
+ 'the TestCase class has a "project" attribute which '
+ "holds a path to a valid ChipTools project file."
)
示例12: testFileSet
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testFileSet(self):
project = Project()
project.load_project(self.project_path)
# Check the file set loaded from the project
expected_files = []
for libname in self.project_structure.keys():
files = self.project_structure[libname]
for path in files:
expected_files.append(os.path.basename(path))
self.assertEqual(
sorted(expected_files),
sorted([os.path.basename(f.path) for f in project.get_files()]),
)
示例13: testProjectLoad
# 需要导入模块: from chiptools.core.project import Project [as 别名]
# 或者: from chiptools.core.project.Project import load_project [as 别名]
def testProjectLoad(self):
project = Project()
project.load_project(self.project_path)