Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SoCTools Flow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SoCLabs
SoCTools Flow
Commits
d62fbdac
Commit
d62fbdac
authored
1 year ago
by
dam1n19
Browse files
Options
Downloads
Patches
Plain Diff
Updated filelist generation script
parent
b08d00e4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/filelist_compile.py
+36
-7
36 additions, 7 deletions
bin/filelist_compile.py
with
36 additions
and
7 deletions
bin/filelist_compile.py
+
36
−
7
View file @
d62fbdac
...
@@ -44,13 +44,14 @@ def env_var_substitute(path, tcl=False):
...
@@ -44,13 +44,14 @@ def env_var_substitute(path, tcl=False):
sub_path
=
os
.
path
.
expandvars
(
sub_path
)
sub_path
=
os
.
path
.
expandvars
(
sub_path
)
return
sub_path
return
sub_path
def
read_list
(
filelist
,
first
,
args
):
def
read_list
(
filelist
,
first
,
incdirs
,
args
):
# Create Filelist List Structure
# Create Filelist List Structure
compiled_filelist
=
[]
compiled_filelist
=
[]
# Open Filelist and Read Lines
# Open Filelist and Read Lines
f
=
open
(
filelist
,
"
r
"
)
f
=
open
(
filelist
,
"
r
"
)
filelines
=
f
.
readlines
()
filelines
=
f
.
readlines
()
f
.
close
()
f
.
close
()
hdl_files
=
[]
# Remove Black Lines from list
# Remove Black Lines from list
filelines
=
[
x
.
rstrip
(
"
\n
"
)
for
x
in
filelines
]
filelines
=
[
x
.
rstrip
(
"
\n
"
)
for
x
in
filelines
]
filelines
=
[
x
for
x
in
filelines
if
x
!=
""
]
filelines
=
[
x
for
x
in
filelines
if
x
!=
""
]
...
@@ -67,7 +68,7 @@ def read_list(filelist, first, args):
...
@@ -67,7 +68,7 @@ def read_list(filelist, first, args):
print
(
line_list
[
1
]
+
"
is in the exclusions list
"
)
print
(
line_list
[
1
]
+
"
is in the exclusions list
"
)
else
:
else
:
print
(
line_list
[
1
])
print
(
line_list
[
1
])
temp_list
,
first
=
read_list
(
env_var_substitute
(
line_list
[
1
]),
first
,
args
)
temp_list
,
first
,
incdirs
=
read_list
(
env_var_substitute
(
line_list
[
1
]),
first
,
incdirs
,
args
)
compiled_filelist
+=
temp_list
compiled_filelist
+=
temp_list
elif
line_list
[
0
]
==
"
-y
"
:
elif
line_list
[
0
]
==
"
-y
"
:
...
@@ -88,6 +89,10 @@ def read_list(filelist, first, args):
...
@@ -88,6 +89,10 @@ def read_list(filelist, first, args):
elif
line_list
[
0
].
startswith
(
"
+incdir+
"
):
elif
line_list
[
0
].
startswith
(
"
+incdir+
"
):
# Append to filelist
# Append to filelist
if
args
.
absolute
==
True
:
incdirs
.
append
(
env_var_substitute
(
line_list
[
0
].
lstrip
(
"
+incdir+
"
)))
else
:
incdirs
.
append
(
line_list
[
0
].
lstrip
(
"
+incdir+
"
))
if
args
.
tcl
==
False
:
if
args
.
tcl
==
False
:
for
file
in
os
.
listdir
(
env_var_substitute
(
line_list
[
0
].
lstrip
(
"
+incdir+
"
))):
for
file
in
os
.
listdir
(
env_var_substitute
(
line_list
[
0
].
lstrip
(
"
+incdir+
"
))):
if
file
.
endswith
(
verilog_extensions
):
if
file
.
endswith
(
verilog_extensions
):
...
@@ -115,17 +120,36 @@ def read_list(filelist, first, args):
...
@@ -115,17 +120,36 @@ def read_list(filelist, first, args):
# Append to filelist
# Append to filelist
if
args
.
absolute
==
True
:
if
args
.
absolute
==
True
:
if
args
.
tcl
==
True
:
if
args
.
tcl
==
True
:
compiled_filelist
.
append
(
"
read_verilog
"
+
str
(
env_var_substitute
(
line_list
[
0
],
tcl
=
True
)).
replace
(
"
$
"
,
"
$env
"
))
hdl_files
.
append
(
str
(
env_var_substitute
(
line_list
[
0
],
tcl
=
True
)).
replace
(
"
$
"
,
"
$env
"
))
# compiled_filelist.append("read_verilog " + str(env_var_substitute(line_list[0], tcl=True)).replace("$","$env"))
else
:
else
:
compiled_filelist
.
append
(
env_var_substitute
(
line_list
[
0
]))
compiled_filelist
.
append
(
env_var_substitute
(
line_list
[
0
]))
else
:
else
:
if
args
.
tcl
==
True
:
if
args
.
tcl
==
True
:
hdl_files
.
append
(
str
(
line_list
[
0
]).
replace
(
"
$
"
,
"
$env
"
))
# compiled_filelist.append("read_verilog " + str(line_list[0]).replace("$","$env"))
# compiled_filelist.append("read_verilog " + str(line_list[0]).replace("$","$env"))
compiled_filelist
.
append
(
"
add_files -norecurse -scan_for_includes
"
+
str
(
line_list
[
0
]).
replace
(
"
$
"
,
"
$env
"
))
#
compiled_filelist.append("add_files -norecurse -scan_for_includes
-copy_to vivado/built_mcu_fpga/MCULIB
" + str(line_list[0]).replace("$","$env"))
else
:
else
:
compiled_filelist
.
append
(
line_list
[
0
])
compiled_filelist
.
append
(
line_list
[
0
])
return
compiled_filelist
,
first
if
len
(
hdl_files
)
>
0
:
# temp_str = 'add_files -norecurse -scan_for_includes "'
temp_str
=
'
add_files -norecurse -force -copy_to vivado/built_mcu_fpga/MCULIB
"'
for
file
in
hdl_files
:
temp_str
+=
file
+
"
"
temp_str
+=
'"'
compiled_filelist
.
append
(
temp_str
)
return
compiled_filelist
,
first
,
incdirs
def
incdir_compile
(
args
,
incdirs
):
temp_str
=
""
if
len
(
incdirs
)
>
0
:
temp_str
=
'
set_property include_dirs
"'
for
directory
in
incdirs
:
temp_dir
=
str
(
directory
).
replace
(
"
$
"
,
"
$env
"
)
temp_str
+=
"
"
+
temp_dir
temp_str
+=
'"
[current_fileset]
'
return
temp_str
def
filelist_compile
(
args
):
def
filelist_compile
(
args
):
input_filelist
=
args
.
filelist
input_filelist
=
args
.
filelist
...
@@ -133,14 +157,19 @@ def filelist_compile(args):
...
@@ -133,14 +157,19 @@ def filelist_compile(args):
print
(
"
------------------
"
)
print
(
"
------------------
"
)
print
(
"
Compiling Filelist
"
)
print
(
"
Compiling Filelist
"
)
print
(
"
------------------
"
)
print
(
"
------------------
"
)
incdirs
=
[]
# Read in filelist and add newlines to paths
# Read in filelist and add newlines to paths
filelist
,
first
=
read_list
(
input_filelist
,
True
,
args
)
filelist
,
first
,
incdirs
=
read_list
(
input_filelist
,
True
,
incdirs
,
args
)
filelist
=
[
x
+
"
\n
"
for
x
in
filelist
]
filelist
=
[
x
+
"
\n
"
for
x
in
filelist
]
# Create string of all paths to write out
# Create string of all paths to write out
filelist_str
=
filelist_header
if
(
args
.
tcl
==
False
)
else
filelist_header
.
replace
(
"
//
"
,
"
#
"
)
filelist_str
=
filelist_header
if
(
args
.
tcl
==
False
)
else
filelist_header
.
replace
(
"
//
"
,
"
#
"
)
for
path
in
filelist
:
filelist_str
+=
path
for
path
in
filelist
:
filelist_str
+=
path
print
(
"
Compile Done
"
)
print
(
"
Compile Done
"
)
print
(
"
------------------
"
)
print
(
"
------------------
"
)
if
args
.
tcl
==
True
:
print
(
"
Compile Incdirs
"
)
print
(
"
------------------
"
)
filelist_str
+=
incdir_compile
(
args
,
incdirs
)
# Write out output filelist
# Write out output filelist
f_outlist
=
open
(
output_filelist
,
"
w
"
)
f_outlist
=
open
(
output_filelist
,
"
w
"
)
f_outlist
.
write
(
filelist_str
)
f_outlist
.
write
(
filelist_str
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment