Commit bd496241 authored by Benny Simonsen's avatar Benny Simonsen

Move functions from makefilesyn.py to makefile.py

Functions moved:
- get_num_hdl_libs(self)
- get_library_for_top_module(self)

Tested with this change on developbranch, testsuite passes.
parent acbb3699
......@@ -191,3 +191,37 @@ class ToolMakefile(object):
self.write("\n")
else:
self.write(text + "\n")
def get_num_hdl_libs(self):
num_libs = len(self.get_all_libs());
return num_libs;
def get_library_for_top_module(self):
if self.get_num_hdl_libs() == 1:
# this may now be excessive, based on the "catch-all" return statement at the bottom.
return self.default_library
else:
#find and return the library name for the top HDL module...
fileset_dict = {}
fileset_dict.update(self.HDL_FILES)
top_file = self.manifest_dict[self.ACTION_SHORTNAME + "_top"]
for hdlfiletype in fileset_dict:
for specific_file in self.fileset:
if isinstance(specific_file, hdlfiletype):
if specific_file.purename == top_file:
#logging.info(self.TOOL_INFO['name']
# + "libfinder_top_module, FOUND library_name: "
# + specific_file.library + " for module: "
# + top_file )
return str(specific_file.library)
#In case we dont find a library then post an info message before returning the default value
logging.info( self.TOOL_INFO['name']
+ "function get_library_for_top_module, "
+ "failed to find a library for the top module: "
+ top_file + " Will use the default_library: "
+ self.default_library
)
return self.default_library
......@@ -19,6 +19,7 @@ def _check_simulation_manifest(top_manifest):
class MakefileSim(ToolMakefile):
"""Class that provides the Makefile writing methods and status"""
ACTION_SHORTNAME = "sim"
SIMULATOR_CONTROLS = {}
......
......@@ -21,6 +21,7 @@ def _check_synthesis_manifest(top_manifest):
class MakefileSyn(ToolMakefile):
"""Class that provides the synthesis Makefile writing methods and status"""
ACTION_SHORTNAME = "syn"
"""Makefile template to build and execute a command.
Arguments:
......@@ -236,37 +237,3 @@ SYN_POST_{0}_CMD := {2}
if isinstance(specific_file, filetype):
sources_with_libs_list.append(specific_file)
return sorted(set(f.library for f in sources_with_libs_list))
def get_num_hdl_libs(self):
num_libs = len(self.get_all_libs());
return num_libs;
def get_library_for_top_module(self):
if self.get_num_hdl_libs() == 1:
# this may now be excessive, based on the "catch-all" return statement at the bottom.
return self.default_library
else:
#find and return the library name for the top HDL module...
fileset_dict = {}
fileset_dict.update(self.HDL_FILES)
top_file = self.manifest_dict["syn_top"]
for hdlfiletype in fileset_dict:
for specific_file in self.fileset:
if isinstance(specific_file, hdlfiletype):
if specific_file.purename == top_file:
#logging.info(self.TOOL_INFO['name']
# + "libfinder_top_module, FOUND library_name: "
# + specific_file.library + " for module: "
# + top_file )
return str(specific_file.library)
#In case we dont find a library then post an info message before returning the default value
logging.info( self.TOOL_INFO['name']
+ "function get_library_for_top_module, "
+ "failed to find a library for the top module: "
+ top_file + " Will use the default_library: "
+ self.default_library
)
return self.default_library
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment