Skip to content
Snippets Groups Projects
Commit ea7bc2d4 authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Added create_quartus_ip_lib_file() to created QIP file with all sources in...

Added create_quartus_ip_lib_file() to created QIP file with all sources in synth_files key for eachHDL library.
parent b26b50e9
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,38 @@ class QuartusConfig(hdl_config.HdlConfig):
"""
hdl_config.HdlConfig.__init__(self, libRootDir, toolRootDir, libFileName, toolFileName)
def create_quartus_ip_lib_file(self, lib_names=None):
"""Create the Quartus IP file <hdl_lib_name>_lib.qip for all HDL libraries. The <hdl_lib_name>_lib.qip file contains the list of files that is given
by the synth_files key.
The postfix '_lib' is used to distinguish this qip file from a <hdl_lib_name>.qip that may be used for HDL libraries that have a
synth_top_level_entity.
Arguments:
- lib_names : one or more HDL libraries
"""
if lib_names==None: lib_names=self.lib_names
lib_dicts = self.libs.get_dicts('hdl_lib_name', lib_names)
for lib_dict in cm.listify(lib_dicts):
# Open qip
lib_name = lib_dict['hdl_lib_name']
qip_name = lib_name + '_lib.qip'
qip_path = self.get_lib_build_dirs('synth', lib_dicts=lib_dict)
cm.mkdir(qip_path)
qipPathName = os.path.join(qip_path, qip_name)
with open(qipPathName, 'w') as fp:
# - hdl files
synth_files = lib_dict['synth_files'].split()
lib_path = self.libs.get_filePath(lib_dict)
for fn in synth_files:
fpn = os.path.expandvars(fn) # support using environment variables in the file path
if os.path.isabs(fpn):
filePathName = fpn # use absolute path to file
else:
filePathName = os.path.join(lib_path, fpn) # derive absolute path to file from library path and local path to file
fp.write('set_global_assignment -name VHDL_FILE %s\n' % filePathName)
def create_quartus_project_file(self, lib_names=None):
"""Create the Quartus project file for all HDL libraries that have a toplevel entity key synth_top_level_entity.
......@@ -69,7 +101,7 @@ class QuartusConfig(hdl_config.HdlConfig):
lib_dicts = self.libs.get_dicts(key='hdl_lib_name', values=lib_names)
syn_dicts = self.libs.get_dicts(key='synth_top_level_entity', values=None, dicts=lib_dicts)
for syn_dict in cm.listify(syn_dicts):
# Open qpf
# Open qpf for each HDL library that has a synth_top_level_entity
lib_name = syn_dict['hdl_lib_name']
top_level_entity = syn_dict['synth_top_level_entity']
if top_level_entity=='':
......@@ -96,9 +128,9 @@ if __name__ == '__main__':
print 'HDL library paths that are found in $%s:' % libRootDir
for p in qsyn.libs.filePaths:
print ' ', p
print ''
print 'HDL libraries with top level entity for synthesis that are found in $%s:' % libRootDir
print ''
print 'HDL libraries with a top level entity for synthesis that are found in $%s:' % libRootDir
print ' %-20s' % 'HDL library', ': Revision(s)'
syn_dicts = qsyn.libs.get_dicts(key='synth_top_level_entity')
for d in cm.listify(syn_dicts):
......@@ -108,6 +140,11 @@ if __name__ == '__main__':
print ' %-20s' % d['hdl_lib_name'], ':', d['synth_top_level_entity']
print ''
print 'Create Quartus project files for technology %s and all HDL libraries in $%s.' % (technologyName, libRootDir)
print 'Create Quartus IP library qip files for all HDL libraries in $%s.' % libRootDir
qsyn.create_quartus_ip_lib_file()
print ''
print 'Create Quartus project files for all HDL libraries with a top level entity for synthesis that are found in $%s.' % libRootDir
qsyn.create_quartus_project_file()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment