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
775fa73d
Commit
775fa73d
authored
Oct 29, 2019
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dep_file.py: remove duplicated attribute (file_path vs path).
parent
573ef26e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
17 deletions
+14
-17
dep_file.py
hdlmake/sourcefiles/dep_file.py
+4
-5
new_dep_solver.py
hdlmake/sourcefiles/new_dep_solver.py
+1
-1
srcfile.py
hdlmake/sourcefiles/srcfile.py
+1
-1
vhdl_parser.py
hdlmake/sourcefiles/vhdl_parser.py
+3
-4
vlog_parser.py
hdlmake/sourcefiles/vlog_parser.py
+3
-4
makefilesim.py
hdlmake/tools/makefilesim.py
+1
-1
makefilevsim.py
hdlmake/tools/makefilevsim.py
+1
-1
No files found.
hdlmake/sourcefiles/dep_file.py
View file @
775fa73d
...
@@ -142,10 +142,9 @@ class DepFile(File):
...
@@ -142,10 +142,9 @@ class DepFile(File):
"""Class that serves as base to all those HDL files that can be
"""Class that serves as base to all those HDL files that can be
parsed and solved (Verilog, SystemVerilog, VHDL)"""
parsed and solved (Verilog, SystemVerilog, VHDL)"""
def
__init__
(
self
,
file_path
,
module
):
def
__init__
(
self
,
path
,
module
):
assert
isinstance
(
file_path
,
six
.
string_types
)
assert
isinstance
(
path
,
six
.
string_types
)
File
.
__init__
(
self
,
path
=
file_path
,
module
=
module
)
File
.
__init__
(
self
,
path
=
path
,
module
=
module
)
self
.
file_path
=
file_path
self
.
rels
=
set
()
self
.
rels
=
set
()
self
.
depends_on
=
set
()
self
.
depends_on
=
set
()
self
.
dep_level
=
None
self
.
dep_level
=
None
...
@@ -181,5 +180,5 @@ class DepFile(File):
...
@@ -181,5 +180,5 @@ class DepFile(File):
logging
.
warning
(
"Probably run into a circular reference of file "
logging
.
warning
(
"Probably run into a circular reference of file "
"dependencies. It appears
%
s depends on itself, "
"dependencies. It appears
%
s depends on itself, "
"indirectly via atleast one other file."
,
"indirectly via atleast one other file."
,
self
.
file_
path
)
self
.
path
)
return
self
.
dep_level
return
self
.
dep_level
hdlmake/sourcefiles/new_dep_solver.py
View file @
775fa73d
...
@@ -116,7 +116,7 @@ def make_dependency_sorted_list(fileset):
...
@@ -116,7 +116,7 @@ def make_dependency_sorted_list(fileset):
All files that another depends on will be earlier in the list."""
All files that another depends on will be earlier in the list."""
dependable
=
[
f
for
f
in
fileset
if
isinstance
(
f
,
DepFile
)]
dependable
=
[
f
for
f
in
fileset
if
isinstance
(
f
,
DepFile
)]
non_dependable
=
[
f
for
f
in
fileset
if
not
isinstance
(
f
,
DepFile
)]
non_dependable
=
[
f
for
f
in
fileset
if
not
isinstance
(
f
,
DepFile
)]
dependable
.
sort
(
key
=
lambda
f
:
f
.
file_
path
.
lower
())
dependable
.
sort
(
key
=
lambda
f
:
f
.
path
.
lower
())
# Not necessary, but will tend to group files more nicely
# Not necessary, but will tend to group files more nicely
# in the output.
# in the output.
dependable
.
sort
(
key
=
DepFile
.
get_dep_level
)
dependable
.
sort
(
key
=
DepFile
.
get_dep_level
)
...
...
hdlmake/sourcefiles/srcfile.py
View file @
775fa73d
...
@@ -44,7 +44,7 @@ class SourceFile(DepFile):
...
@@ -44,7 +44,7 @@ class SourceFile(DepFile):
self
.
library
=
library
self
.
library
=
library
if
not
library
:
if
not
library
:
self
.
library
=
"work"
self
.
library
=
"work"
DepFile
.
__init__
(
self
,
file_
path
=
path
,
module
=
module
)
DepFile
.
__init__
(
self
,
path
=
path
,
module
=
module
)
def
__hash__
(
self
):
def
__hash__
(
self
):
return
hash
(
self
.
path
+
self
.
library
)
return
hash
(
self
.
path
+
self
.
library
)
...
...
hdlmake/sourcefiles/vhdl_parser.py
View file @
775fa73d
...
@@ -42,16 +42,15 @@ class VHDLParser(DepParser):
...
@@ -42,16 +42,15 @@ class VHDLParser(DepParser):
"""Parse the provided VHDL file and add the detected relations to it"""
"""Parse the provided VHDL file and add the detected relations to it"""
from
.dep_file
import
DepRelation
from
.dep_file
import
DepRelation
assert
not
dep_file
.
is_parsed
assert
not
dep_file
.
is_parsed
logging
.
debug
(
"Parsing
%
s"
,
dep_file
.
path
)
logging
.
debug
(
"Parsing
%
s"
,
dep_file
.
path
)
def
_preprocess
(
vhdl_file
):
def
_preprocess
(
vhdl_file
):
"""Preprocess the supplied VHDL file instance"""
"""Preprocess the supplied VHDL file instance"""
file_path
=
vhdl_file
.
file_path
buf
=
open
(
vhdl_file
.
path
,
"r"
)
.
read
()
buf
=
open
(
file_path
,
"r"
)
.
read
()
logging
.
debug
(
logging
.
debug
(
"preprocess file
%
s (of length
%
d) in library
%
s"
,
"preprocess file
%
s (of length
%
d) in library
%
s"
,
file_
path
,
len
(
buf
),
vhdl_file
.
library
)
vhdl_file
.
path
,
len
(
buf
),
vhdl_file
.
library
)
# Remove the comments and strings from the VHDL code
# Remove the comments and strings from the VHDL code
pattern
=
re
.
compile
(
'--.*?$|".?"'
,
re
.
DOTALL
|
re
.
MULTILINE
)
pattern
=
re
.
compile
(
'--.*?$|".?"'
,
re
.
DOTALL
|
re
.
MULTILINE
)
return
re
.
sub
(
pattern
,
""
,
buf
)
return
re
.
sub
(
pattern
,
""
,
buf
)
...
...
hdlmake/sourcefiles/vlog_parser.py
View file @
775fa73d
...
@@ -78,7 +78,7 @@ class VerilogPreprocessor(object):
...
@@ -78,7 +78,7 @@ class VerilogPreprocessor(object):
if
os
.
path
.
isfile
(
probable_file
):
if
os
.
path
.
isfile
(
probable_file
):
return
os
.
path
.
abspath
(
probable_file
)
return
os
.
path
.
abspath
(
probable_file
)
raise
Exception
(
"Can't find {} for {} in any of the include "
raise
Exception
(
"Can't find {} for {} in any of the include "
"directories: {}"
.
format
(
filename
,
self
.
vlog_file
.
file_
path
,
"directories: {}"
.
format
(
filename
,
self
.
vlog_file
.
path
,
', '
.
join
(
self
.
vlog_file
.
include_dirs
)))
', '
.
join
(
self
.
vlog_file
.
include_dirs
)))
def
_preprocess_file
(
self
,
file_content
,
file_name
,
library
):
def
_preprocess_file
(
self
,
file_content
,
file_name
,
library
):
...
@@ -242,10 +242,9 @@ class VerilogPreprocessor(object):
...
@@ -242,10 +242,9 @@ class VerilogPreprocessor(object):
# assert isinstance(vlog_file, VerilogFile)
# assert isinstance(vlog_file, VerilogFile)
# assert isinstance(vlog_file, DepFile)
# assert isinstance(vlog_file, DepFile)
self
.
vlog_file
=
vlog_file
self
.
vlog_file
=
vlog_file
file_path
=
vlog_file
.
file_path
buf
=
open
(
vlog_file
.
path
,
"r"
)
.
read
()
buf
=
open
(
file_path
,
"r"
)
.
read
()
return
self
.
_preprocess_file
(
file_content
=
buf
,
return
self
.
_preprocess_file
(
file_content
=
buf
,
file_name
=
file_
path
,
file_name
=
vlog_file
.
path
,
library
=
vlog_file
.
library
)
library
=
vlog_file
.
library
)
...
...
hdlmake/tools/makefilesim.py
View file @
775fa73d
...
@@ -108,7 +108,7 @@ TOP_MODULE := {top_module}
...
@@ -108,7 +108,7 @@ TOP_MODULE := {top_module}
if
isinstance
(
file_aux
,
tuple
(
self
.
HDL_FILES
)):
if
isinstance
(
file_aux
,
tuple
(
self
.
HDL_FILES
)):
self
.
write
(
"{}: {}"
.
format
(
self
.
get_stamp_file
(
file_aux
),
file_aux
.
rel_path
()))
self
.
write
(
"{}: {}"
.
format
(
self
.
get_stamp_file
(
file_aux
),
file_aux
.
rel_path
()))
# list dependencies, do not include the target file
# list dependencies, do not include the target file
for
dep_file
in
sorted
(
file_aux
.
depends_on
,
key
=
(
lambda
x
:
x
.
file_
path
)):
for
dep_file
in
sorted
(
file_aux
.
depends_on
,
key
=
(
lambda
x
:
x
.
path
)):
if
dep_file
is
file_aux
:
if
dep_file
is
file_aux
:
# Do not depend on itself.
# Do not depend on itself.
continue
continue
...
...
hdlmake/tools/makefilevsim.py
View file @
775fa73d
...
@@ -138,7 +138,7 @@ class MakefileVsim(MakefileSim):
...
@@ -138,7 +138,7 @@ class MakefileVsim(MakefileSim):
# list dependencies, do not include the target file
# list dependencies, do not include the target file
for
dep_file
in
sorted
([
dfile
for
dfile
for
dep_file
in
sorted
([
dfile
for
dfile
in
vlog
.
depends_on
if
dfile
is
not
vlog
],
in
vlog
.
depends_on
if
dfile
is
not
vlog
],
key
=
(
lambda
x
:
x
.
file_
path
)):
key
=
(
lambda
x
:
x
.
path
)):
if
dep_file
in
fileset
and
not
dep_file
.
is_include
:
if
dep_file
in
fileset
and
not
dep_file
.
is_include
:
name
=
dep_file
.
purename
name
=
dep_file
.
purename
extension
=
dep_file
.
extension
()
extension
=
dep_file
.
extension
()
...
...
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