Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
1d55f716
Commit
1d55f716
authored
Oct 30, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dep_file.py: split rels set into requires/provides.
parent
f7cfce26
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
39 deletions
+39
-39
dep_file.py
hdlmake/sourcefiles/dep_file.py
+6
-5
new_dep_solver.py
hdlmake/sourcefiles/new_dep_solver.py
+33
-34
No files found.
hdlmake/sourcefiles/dep_file.py
View file @
1d55f716
...
@@ -146,27 +146,28 @@ class DepFile(File):
...
@@ -146,27 +146,28 @@ class DepFile(File):
def
__init__
(
self
,
path
,
module
):
def
__init__
(
self
,
path
,
module
):
assert
isinstance
(
path
,
six
.
string_types
)
assert
isinstance
(
path
,
six
.
string_types
)
File
.
__init__
(
self
,
path
=
path
,
module
=
module
)
File
.
__init__
(
self
,
path
=
path
,
module
=
module
)
self
.
rels
=
set
()
self
.
provides
=
set
()
self
.
depends_on
=
set
()
self
.
requires
=
set
()
self
.
depends_on
=
set
()
# Set of files this file depends on.
self
.
dep_level
=
None
self
.
dep_level
=
None
self
.
is_parsed
=
False
self
.
is_parsed
=
False
def
add_require
(
self
,
rel
):
def
add_require
(
self
,
rel
):
"""Add dependency :param rel:"""
"""Add dependency :param rel:"""
assert
rel
.
direction
==
DepRelation
.
USE
assert
rel
.
direction
==
DepRelation
.
USE
self
.
re
l
s
.
add
(
rel
)
self
.
re
quire
s
.
add
(
rel
)
def
add_provide
(
self
,
rel
):
def
add_provide
(
self
,
rel
):
"""Add provide :param rel:"""
"""Add provide :param rel:"""
assert
rel
.
direction
==
DepRelation
.
PROVIDE
assert
rel
.
direction
==
DepRelation
.
PROVIDE
self
.
rel
s
.
add
(
rel
)
self
.
provide
s
.
add
(
rel
)
def
satisfies
(
self
,
rel_b
):
def
satisfies
(
self
,
rel_b
):
"""Check if any of the file object relations match any of the relations
"""Check if any of the file object relations match any of the relations
listed in the parameter (rel_b)"""
listed in the parameter (rel_b)"""
assert
isinstance
(
rel_b
,
DepRelation
)
assert
isinstance
(
rel_b
,
DepRelation
)
# self._parse_if_needed()
# self._parse_if_needed()
return
any
([
x
.
satisfies
(
rel_b
)
for
x
in
self
.
rel
s
])
return
any
([
x
.
satisfies
(
rel_b
)
for
x
in
self
.
provide
s
])
def
get_dep_level
(
self
):
def
get_dep_level
(
self
):
"""Get the dependency level for the file instance, so we can order
"""Get the dependency level for the file instance, so we can order
...
...
hdlmake/sourcefiles/new_dep_solver.py
View file @
1d55f716
...
@@ -64,42 +64,41 @@ def solve(fileset, standard_libs=None):
...
@@ -64,42 +64,41 @@ def solve(fileset, standard_libs=None):
not_satisfied
=
0
not_satisfied
=
0
for
investigated_file
in
fset
:
for
investigated_file
in
fset
:
# logging.info("INVESTIGATED FILE: %s" % investigated_file)
# logging.info("INVESTIGATED FILE: %s" % investigated_file)
# print(investigated_file.rels)
for
rel
in
investigated_file
.
requires
:
for
rel
in
investigated_file
.
rels
:
# logging.info("- relation: %s" % rel)
# logging.info("- relation: %s" % rel)
# logging.info("- direction: %s" % rel.direction)
# logging.info("- direction: %s" % rel.direction)
# Only analyze USE relations, we are looking for dependencies
# Only analyze USE relations, we are looking for dependencies
if
rel
.
direction
==
DepRelation
.
USE
:
assert
rel
.
direction
==
DepRelation
.
USE
satisfied_by
=
set
()
satisfied_by
=
set
()
for
dep_file
in
fset
:
for
dep_file
in
fset
:
if
dep_file
.
satisfies
(
rel
):
if
dep_file
.
satisfies
(
rel
):
if
dep_file
is
not
investigated_file
:
if
dep_file
is
not
investigated_file
:
investigated_file
.
depends_on
.
add
(
dep_file
)
investigated_file
.
depends_on
.
add
(
dep_file
)
satisfied_by
.
add
(
dep_file
)
satisfied_by
.
add
(
dep_file
)
if
len
(
satisfied_by
)
>
1
:
if
len
(
satisfied_by
)
>
1
:
logging
.
warning
(
logging
.
warning
(
"Relation
%
s satisfied by multiple (
%
d) files:
\n
%
s"
,
"Relation
%
s satisfied by multiple (
%
d) files:
\n
%
s"
,
str
(
rel
),
str
(
rel
),
len
(
satisfied_by
),
len
(
satisfied_by
),
'
\n
'
.
join
([
file_aux
.
path
for
'
\n
'
.
join
([
file_aux
.
path
for
file_aux
in
list
(
satisfied_by
)]))
file_aux
in
list
(
satisfied_by
)]))
elif
len
(
satisfied_by
)
==
0
:
elif
len
(
satisfied_by
)
==
0
:
# if relation is a USE PACKAGE, check against
# if relation is a USE PACKAGE, check against
# the standard libs provided by the tool HDL compiler
# the standard libs provided by the tool HDL compiler
required_lib
=
rel
.
obj_name
.
split
(
'.'
)[
0
]
required_lib
=
rel
.
obj_name
.
split
(
'.'
)[
0
]
if
(
not
standard_libs
is
None
and
if
(
not
standard_libs
is
None
and
required_lib
in
standard_libs
and
required_lib
in
standard_libs
and
rel
.
direction
is
DepRelation
.
USE
and
rel
.
direction
is
DepRelation
.
USE
and
rel
.
rel_type
is
DepRelation
.
PACKAGE
):
rel
.
rel_type
is
DepRelation
.
PACKAGE
):
logging
.
debug
(
"Not satisfied relation
%
s in
%
s will "
logging
.
debug
(
"Not satisfied relation
%
s in
%
s will "
"be covered by the target compiler "
"be covered by the target compiler "
"standard libs."
,
"standard libs."
,
str
(
rel
),
investigated_file
.
name
)
str
(
rel
),
investigated_file
.
name
)
else
:
else
:
logging
.
warning
(
"Relation
%
s in
%
s not satisfied by "
logging
.
warning
(
"Relation
%
s in
%
s not satisfied by "
"any source file"
,
"any source file"
,
str
(
rel
),
investigated_file
.
name
)
str
(
rel
),
investigated_file
.
name
)
not_satisfied
+=
1
not_satisfied
+=
1
logging
.
debug
(
"SOLVE END"
)
logging
.
debug
(
"SOLVE END"
)
if
not_satisfied
!=
0
:
if
not_satisfied
!=
0
:
logging
.
warning
(
logging
.
warning
(
...
@@ -141,7 +140,7 @@ def make_dependency_set(fileset, top_level_entity, extra_modules=None):
...
@@ -141,7 +140,7 @@ def make_dependency_set(fileset, top_level_entity, extra_modules=None):
entity_rel_vlog
=
DepRelation
(
entity_rel_vlog
=
DepRelation
(
"
%
s.
%
s"
%
"
%
s.
%
s"
%
(
"work"
,
entity_name
),
DepRelation
.
PROVIDE
,
DepRelation
.
MODULE
)
(
"work"
,
entity_name
),
DepRelation
.
PROVIDE
,
DepRelation
.
MODULE
)
for
rel
in
test_file
.
rel
s
:
for
rel
in
test_file
.
provide
s
:
if
(
rel
==
entity_rel_vhdl
)
or
(
rel
==
entity_rel_vlog
):
if
(
rel
==
entity_rel_vhdl
)
or
(
rel
==
entity_rel_vlog
):
return
True
return
True
return
False
return
False
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment