Commit 2a98971e authored by Benny Simonsen's avatar Benny Simonsen

Add posiblity to set library of top_entity

When top_entity = '<entity>' the behavior is unchanged, (top_library = deflib).

When top_entity = '<top_library>.<entity>':
The top_library is set to <top_library> (the part in front of first dot).
top_entity is the part after first dot.

When top_entity = '.<entity>' (empty in front of first dot):
The top_library is set to library from library = '<library>' in Manifest.py.
top_entity is the part after first dot.

Note: top_entity = sim/syn_top or top_entity

In other places, like makefiles TOP_MODULE is set to sim/syn_top,
don't know if there should be fixed anything there.
parent b73be282
......@@ -82,6 +82,20 @@ class Action(object):
# Parse the top manifest and all sub-modules.
self.top_manifest.parse_manifest()
def split_to_top_lib_and_entity(self):
# If '.' included in top_entity:
# Split top at first . Before . -> top_library, after . -> top_entity
try:
self.top_entity
except NameError:
return
if '.' in self.top_entity:
_ = self.top_entity.split('.')
self.top_library = _[0]
if self.top_library == '':
self.top_library = self.top_manifest.manifest_dict['library']
self.top_entity = '.'.join(_[1:])
def setup(self):
"""Set tool and top_entity"""
top_dict = self.top_manifest.manifest_dict
......@@ -90,6 +104,7 @@ class Action(object):
if action == None:
self.tool = None
self.top_entity = top_dict.get("top_module")
self.split_to_top_lib_and_entity()
elif action == "simulation":
tool = top_dict.get("sim_tool")
if tool is None:
......@@ -97,6 +112,7 @@ class Action(object):
self.tool = load_sim_tool(tool)
self.top_entity = top_dict.get("sim_top") \
or top_dict.get("top_module")
self.split_to_top_lib_and_entity()
top_dict["sim_top"] = self.top_entity
elif action == "synthesis":
tool = top_dict.get("syn_tool")
......@@ -105,12 +121,14 @@ class Action(object):
self.tool = load_syn_tool(tool)
self.top_entity = top_dict.get("syn_top") \
or top_dict.get("top_module")
self.split_to_top_lib_and_entity()
top_dict["syn_top"] = self.top_entity
deflib = self.tool.default_library
else:
raise Exception("Unknown requested action: {}".format(action))
# Set default library
self.top_library = deflib
if self.top_library is None:
self.top_library = deflib
if deflib:
for mod in self.all_manifests:
if mod.files is not None and mod.library is None:
......
......@@ -104,8 +104,8 @@ class ActionTree(Action):
top_id = path.relpath(chk_file.path)
if top_file is None:
logging.critical('Could not find a top level file that provides the '
'top_module="%s". Continuing with the full file set.',
self.cmd.top_entity)
'top_module="%s.%s". Continuing with the full file set.',
self.cmd.top_library, self.cmd.top_entity)
else:
raise Exception('Unknown tree mode: %s', self.options.mode)
......
......@@ -195,8 +195,8 @@ def make_dependency_set(graph, fileset, top_library, top_entity, extra_modules=N
if rel is None:
logging.critical(
'Could not find a top level file that provides the '
'"%s" top module. Continuing with the full file set.',
top_entity)
'"%s.%s" top module. Continuing with the full file set.',
top_library, top_entity)
return fileset
top_file = rel.provided_by
......
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