Maintenance scheduled 24th July -- expect downtime along that day

Commit 033590e1 authored by William Kamp's avatar William Kamp Committed by Javier D. Garcia-Lasheras

Better support multiple VHDL libraries.

VHDL_parser.py extracts the library from instantiations.
new_dep_solver.py does not assume the work library.
core.py inherits the library from the parent Manifest.
parent 26f08930
......@@ -52,10 +52,10 @@ class ModuleContent(ModuleCore):
def process_manifest(self):
"""Process the content section of the manifest_dic"""
super(ModuleContent, self).process_manifest()
self._process_manifest_files()
self._process_manifest_modules()
self._process_manifest_makefiles()
super(ModuleContent, self).process_manifest()
def _process_manifest_files(self):
"""Process the files instantiated by the HDLMake module"""
......@@ -71,8 +71,10 @@ class ModuleContent(ModuleCore):
else:
self.manifest_dict["files"] = path_mod.flatten_list(
self.manifest_dict["files"])
logging.debug("Files in %s: %s",
self.path, str(self.manifest_dict["files"]))
logging.debug("Files in %s: %s to library %s" ,
self.path,
str(self.manifest_dict["files"]),
self.library)
paths = self._make_list_of_paths(self.manifest_dict["files"])
self.files = self._create_file_list_from_paths(paths=paths)
......
......@@ -143,5 +143,8 @@ class ModuleCore(ModuleConfig):
# Libraries
if "library" in self.manifest_dict:
self.library = self.manifest_dict["library"]
elif self.parent:
self.library = self.parent.library
if "action" in self.manifest_dict:
self.action = self.manifest_dict["action"].lower()
......@@ -136,8 +136,8 @@ def make_dependency_set(fileset, top_level_entity, extra_modules=None):
def _check_entity(test_file, entity_name):
""" Check if the input file provides the entity pointed by the name"""
entity_rel_vhdl = DepRelation(
"%s.%s" %
("work", entity_name), DepRelation.PROVIDE, DepRelation.ENTITY)
entity_name,
DepRelation.PROVIDE, DepRelation.ENTITY)
entity_rel_vlog = DepRelation(
"%s.%s" %
("work", entity_name), DepRelation.PROVIDE, DepRelation.MODULE)
......
......@@ -248,7 +248,10 @@ class VHDLParser(DepParser):
# instantions
libraries = set([dep_file.library])
instance_pattern = re.compile(
r"^\s*(\w+)\s*:\s*(?:entity\s+\w+\.)?(\w+)\s*(?:\(\s*\w+\s*\)\s*)?(?:port\s+map.*?|generic\s+map.*?)",
r"^\s*(?P<LABEL>\w+)\s*:"
r"\s*(?:entity\s+(?P<LIB>\w+)\.)?(?P<ENTITY>\w+)"
r"\s*(?:\(\s*(?P<ARCH>\w+)\s*\)\s*)?"
r"(?:port\s+map.*?|generic\s+map.*?)",
re.DOTALL | re.MULTILINE | re.IGNORECASE)
def do_instance(text):
......@@ -256,14 +259,17 @@ class VHDLParser(DepParser):
instance_pattern in the VHDL code -- group() returns positive
matches as indexed plain strings. It adds the found USE
relations to the file"""
for lib in libraries:
logging.debug("-> instantiates %s.%s as %s",
lib, text.group(2), text.group(1))
dep_file.add_relation(DepRelation(
"%s.%s" % (lib, text.group(2)),
DepRelation.USE, DepRelation.ENTITY))
return "<hdlmake instance %s|%s>" % (text.group(1),
text.group(2))
logging.debug("-> instantiates %s.%s(%s) as %s",
text.group("LIB"), text.group("ENTITY"), text.group("ARCH"), text.group("LABEL"))
lib = text.group("LIB")
if not lib or lib == "work":
lib = dep_file.library
dep_file.add_relation(DepRelation(
"%s.%s" % (lib, text.group("ENTITY")),
DepRelation.USE, DepRelation.ENTITY))
return "<hdlmake instance %s|%s|%s>" % (text.group("LABEL"),
lib,
text.group("ENTITY"))
buf = re.sub(instance_pattern, do_instance, buf)
instance_from_library_pattern = re.compile(
......
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