Commit db5e2460 authored by Tristan Gingold's avatar Tristan Gingold

sourcefiles: add top_depends_on

So that architecture or package bodies in a separate file
don't create circular dependencies
parent 83e380d1
......@@ -158,7 +158,16 @@ class DepFile(File):
# Relations provided/required by this file
self.provides = set()
self.requires = set()
self.depends_on = set() # Set of files this file depends on.
# File dependences. Both are set of files.
# depends_on is for file required dependency, like module if it is
# instantiated, packages used...
# top_depends_on is for design dependency, like package body or
# architecture. The file doesn't depend on it, but they are needed
# for the whole design
self.depends_on = set()
self.top_depends_on = set()
self.included_files = set()
self.dep_level = None
......
......@@ -27,7 +27,7 @@ from __future__ import print_function
from __future__ import absolute_import
import logging
from ..sourcefiles.dep_file import DepFile
from ..sourcefiles.dep_file import DepFile, DepRelation
from .systemlibs import all_system_libs
......@@ -104,8 +104,15 @@ def parse_source_files(graph, fileset):
for rel in investigated_file.requires:
if rel.provided_by is None:
continue
if rel.provided_by is not investigated_file:
if rel.provided_by is investigated_file:
# A file cannot depends on itself.
continue
if rel.rel_type in (DepRelation.ARCHITECTURE, DepRelation.PACKAGE_BODY):
# The investigate file does not depend on the erchitecture or package body.
# However, the architecture or package body needs to be added in the
# design.
investigated_file.top_depends_on.add(rel.provided_by)
else:
investigated_file.depends_on.add(rel.provided_by)
......@@ -226,6 +233,8 @@ def make_dependency_set(graph, fileset, top_library, top_entity, extra_modules=N
dep_file_set.add(chk_file)
for f in chk_file.depends_on:
file_set.add(f)
for f in chk_file.top_depends_on:
file_set.add(f)
hierarchy_drivers = [top_entity]
if extra_modules is not None:
......
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