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
0ded0fa7
Commit
0ded0fa7
authored
Jun 12, 2017
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the extra_modules option to force the inclusion of HDL modules in the solved file hierarchy
parent
477c281a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
20 deletions
+34
-20
action.py
hdlmake/action/action.py
+2
-1
variables.py
hdlmake/manifest_parser/variables.py
+5
-1
new_dep_solver.py
hdlmake/new_dep_solver.py
+27
-18
No files found.
hdlmake/action/action.py
View file @
0ded0fa7
...
...
@@ -158,7 +158,8 @@ class Action(list):
self
.
_deps_solved
=
True
solved_files
=
SourceFileSet
()
solved_files
.
add
(
dep_solver
.
make_dependency_set
(
self
.
parseable_fileset
,
self
.
top_entity
))
self
.
parseable_fileset
,
self
.
top_entity
,
self
.
config
.
get
(
"extra_modules"
)))
self
.
parseable_fileset
=
solved_files
def
build_file_set
(
self
):
...
...
hdlmake/manifest_parser/variables.py
View file @
0ded0fa7
...
...
@@ -39,8 +39,12 @@ class ManifestParser(ConfigParser):
general_options
=
[
{
'name'
:
'top_module'
,
'default'
:
None
,
'help'
:
"Top level entity for synthesis and simulation"
,
'help'
:
"Top level
HDL
entity for synthesis and simulation"
,
'type'
:
''
},
{
'name'
:
'extra_modules'
,
'default'
:
None
,
'help'
:
"Extra HDL entities that must be present in the design"
,
'type'
:
[]},
{
'name'
:
'include_dirs'
,
'default'
:
None
,
'help'
:
"Include dirs for Verilog sources"
,
...
...
hdlmake/new_dep_solver.py
View file @
0ded0fa7
...
...
@@ -125,28 +125,36 @@ def make_dependency_sorted_list(fileset, reverse=False):
return
sorted_list
def
make_dependency_set
(
fileset
,
top_level_entity
):
def
make_dependency_set
(
fileset
,
top_level_entity
,
extra_modules
=
None
):
"""Create the set of all files required to build the named
top_level_entity."""
from
hdlmake.srcfile
import
SourceFileSet
from
hdlmake.dep_file
import
DepRelation
assert
isinstance
(
fileset
,
SourceFileSet
)
fset
=
fileset
.
filter
(
DepFile
)
# Find the file that provides the named top level entity
top_rel_vhdl
=
DepRelation
(
"
%
s.
%
s"
%
(
"work"
,
top_level_entity
),
DepRelation
.
PROVIDE
,
DepRelation
.
ENTITY
)
top_rel_vlog
=
DepRelation
(
"
%
s.
%
s"
%
(
"work"
,
top_level_entity
),
DepRelation
.
PROVIDE
,
DepRelation
.
MODULE
)
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_rel_vlog
=
DepRelation
(
"
%
s.
%
s"
%
(
"work"
,
entity_name
),
DepRelation
.
PROVIDE
,
DepRelation
.
MODULE
)
for
rel
in
test_file
.
rels
:
if
(
rel
==
entity_rel_vhdl
)
or
(
rel
==
entity_rel_vlog
):
return
True
return
False
top_file
=
None
extra_files
=
[]
for
chk_file
in
fset
:
for
rel
in
chk_file
.
rels
:
if
(
rel
==
top_rel_vhdl
)
or
(
rel
==
top_rel_vlog
):
top_file
=
chk_file
break
if
top_file
:
break
if
_check_entity
(
chk_file
,
top_level_entity
)
:
top_file
=
chk_file
if
not
extra_modules
==
None
:
for
entity_aux
in
extra_modules
:
if
_check_entity
(
chk_file
,
entity_aux
)
:
extra_files
.
append
(
chk_file
)
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.'
,
...
...
@@ -156,7 +164,7 @@ def make_dependency_set(fileset, top_level_entity):
# walking the dependancy tree.
try
:
dep_file_set
=
set
()
file_set
=
set
([
top_file
])
file_set
=
set
([
top_file
]
+
extra_files
)
while
True
:
chk_file
=
file_set
.
pop
()
dep_file_set
.
add
(
chk_file
)
...
...
@@ -164,8 +172,9 @@ def make_dependency_set(fileset, top_level_entity):
except
KeyError
:
# no files left
pass
hierarchy_drivers
=
[
top_level_entity
]
if
not
extra_modules
==
None
:
hierarchy_drivers
+=
extra_modules
logging
.
info
(
"Found
%
d files as dependancies of
%
s."
,
len
(
dep_file_set
),
top_level_entity
)
# for dep_file in dep_file_set:
# logging.info("\t" + str(dep_file))
len
(
dep_file_set
),
", "
.
join
(
hierarchy_drivers
))
return
dep_file_set
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