Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hdlmake
Manage
Activity
Members
Labels
Plan
Issues
20
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Hdlmake
Commits
af67d36d
Commit
af67d36d
authored
13 years ago
by
Pawel Szostek
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes
parent
c55fed44
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
synthesis/depend.py
+10
-5
10 additions, 5 deletions
synthesis/depend.py
synthesis/fetch.py
+1
-1
1 addition, 1 deletion
synthesis/fetch.py
synthesis/hdlmake.py
+32
-51
32 additions, 51 deletions
synthesis/hdlmake.py
synthesis/path.py
+16
-12
16 additions, 12 deletions
synthesis/path.py
with
59 additions
and
69 deletions
synthesis/depend.py
+
10
−
5
View file @
af67d36d
...
...
@@ -229,7 +229,6 @@ clean:
.PHONY: clean
"""
pwd
=
os
.
getcwd
()
#open the file and write the above preambule (part 1)
f
=
open
(
"
Makefile
"
,
"
w
"
)
f
.
write
(
notices
)
...
...
@@ -252,22 +251,28 @@ clean:
f
.
write
(
'
'
.
join
([
lib
+
"
/.
"
+
lib
for
lib
in
libs
]))
f
.
write
(
'
\n
'
)
f
.
write
(
make_preambule_p2
)
vlo
=
global_mod
.
opt_map
.
vlog_opt
vmo
=
global_mod
.
opt_map
.
vmap_opt
for
lib
in
libs
:
f
.
write
(
lib
+
"
/.
"
+
lib
+
"
:
\n
"
)
f
.
write
(
"
\t
(vlib
"
+
lib
+
"
&& vmap -modelsimini modelsim.ini
"
+
lib
+
"
"
+
lib
+
"
&& touch
"
+
lib
+
"
/.
"
+
lib
+
"
)
"
)
f
.
write
(
"
|| rm -rf
"
+
lib
+
"
\n
"
)
f
.
write
(
'
'
.
join
([
"
\t
(vlib
"
,
vlo
,
lib
,
"
&&
"
,
"
vmap
"
,
vmo
,
"
-modelsimini modelsim.ini
"
,
lib
,
"
&&
"
,
"
touch
"
,
lib
+
"
/.
"
+
lib
,
"
)
"
]))
f
.
write
(
'
'
.
join
([
"
||
"
,
"
rm -rf
"
,
lib
,
"
\n
"
]))
f
.
write
(
'
\n
'
)
#list rules for all _primary.dat files
rp
=
os
.
path
.
relpath
vco
=
global_mod
.
opt_map
.
vcom_opt
for
file
in
file_deps_dict
:
lib
=
file_lib_dict
[
file
]
basename
=
os
.
path
.
basename
(
file
)
purename
=
os
.
path
.
splitext
(
basename
)[
0
]
#each .dat depends on corresponding .vhd file
f
.
write
(
os
.
path
.
join
(
lib
,
purename
,
"
.
"
+
purename
)
+
"
:
"
+
rp
(
file
)
+
'
\n
'
)
f
.
write
(
'
\t\t
vcom $(VCOM_FLAGS)
-work
'
+
lib
+
'
'
+
rp
(
file
)
+
'
&&
mkdir -p
'
+
os
.
path
.
join
(
lib
,
purename
)
+
'
&&
touch
'
+
os
.
path
.
join
(
lib
,
purename
,
'
.
'
+
purename
)
+
'
\n
'
)
f
.
write
(
'
'
.
join
([
"
\t\t
vcom $(VCOM_FLAGS)
"
,
vco
,
"
-work
"
,
lib
,
rp
(
file
)
,
"
&&
"
,
"
mkdir -p
"
,
os
.
path
.
join
(
lib
,
purename
)
,
"
&&
"
,
"
touch
"
,
os
.
path
.
join
(
lib
,
purename
,
'
.
'
+
purename
)
,
'
\n
'
])
)
f
.
write
(
'
\n
'
)
if
len
(
file_deps_dict
[
file
])
!=
0
:
f
.
write
(
os
.
path
.
join
(
lib
,
purename
,
"
.
"
+
purename
)
+
"
:
"
)
...
...
This diff is collapsed.
Click to expand it.
synthesis/fetch.py
+
1
−
1
View file @
af67d36d
...
...
@@ -14,7 +14,7 @@ def fetch_from_svn(url, revision = None, fetchto = None):
cur_dir
=
os
.
getcwd
()
os
.
chdir
(
fetchto
)
p
.
echo
(
os
.
getcwd
())
basename
=
path
.
url_basename
(
url
)
cmd
=
"
svn checkout {0}
"
+
basename
...
...
This diff is collapsed.
Click to expand it.
synthesis/hdlmake.py
+
32
−
51
View file @
af67d36d
...
...
@@ -4,7 +4,7 @@
import
re
import
fileinput
import
sys
import
path
import
path
import
time
import
os
...
...
@@ -13,7 +13,7 @@ import random
import
string
import
global_mod
import
msg
as
p
from
optparse
import
O
pt
ionP
arse
r
import
o
pt
p
arse
from
fetch
import
fetch_from_svn
,
fetch_from_git
,
parse_repo_url
import
mnfst
...
...
@@ -47,41 +47,35 @@ def check_address_length(module):
else
:
return
None
def
main
():
import
depend
global_mod
.
t0
=
time
.
time
()
parser
=
OptionParser
()
parser
=
optparse
.
OptionParser
()
parser
.
add_option
(
"
--manifest-help
"
,
action
=
"
store_true
"
,
dest
=
"
manifest_help
"
,
help
=
"
print manifest file variables description
"
)
parser
.
add_option
(
"
-k
"
,
"
--make
"
,
dest
=
"
make
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
prepare makefile for simulation
"
)
parser
.
add_option
(
"
-f
"
,
"
--fetch
"
,
action
=
"
store_true
"
,
dest
=
"
fetch
"
,
help
=
"
fetch files from modules listed in MANIFEST
"
)
parser
.
add_option
(
"
-c
"
,
"
--clean
"
,
action
=
"
store_true
"
,
dest
=
"
clean
"
,
help
=
"
clean the mess made by me
"
)
parser
.
add_option
(
"
-l
"
,
"
--synthesize-locally
"
,
dest
=
"
local
"
,
action
=
"
store_true
"
,
help
=
"
perform a local synthesis
"
)
parser
.
add_option
(
"
-r
"
,
"
--synthesize-remotelly
"
,
dest
=
"
remote
"
,
action
=
"
store_true
"
,
help
=
"
perform a remote synthesis
"
)
parser
.
add_option
(
"
--tcl-file
"
,
dest
=
"
tcl
"
,
help
=
"
specify a TCL file used for synthesis
"
)
parser
.
add_option
(
"
--ise-file
"
,
dest
=
"
ise
"
,
help
=
"
specify .xise file for other actions
"
,
metavar
=
"
ISE
"
)
parser
.
add_option
(
"
-m
"
,
"
--manifest
"
,
dest
=
"
manifest
"
,
default
=
None
,
help
=
"
use given MANIFEST in all operations
"
,
metavar
=
"
MANIFEST
"
)
parser
.
add_option
(
"
-v
"
,
"
--verbose
"
,
dest
=
"
verbose
"
,
action
=
"
store_true
"
,
default
=
"
false
"
,
help
=
"
verbose mode
"
)
parser
.
add_option
(
"
-k
"
,
"
--do-make
"
,
dest
=
"
make
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
prepare makefile for simulation
"
)
parser
.
add_option
(
"
--inject
"
,
dest
=
"
inject
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
inject file list into ise project
"
)
parser
.
add_option
(
"
--make-list
"
,
dest
=
"
make_list
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
make list of project files in ISE format
"
)
parser
.
add_option
(
"
--tcl-file
"
,
dest
=
"
tcl
"
,
help
=
"
specify a .tcl file used for synthesis with ISE
"
)
parser
.
add_option
(
"
--qpf-file
"
,
dest
=
"
qpf
"
,
help
=
"
specify a .qpf file used for synthesis with QPF
"
)
parser
.
add_option
(
"
--ise-file
"
,
dest
=
"
ise
"
,
help
=
"
specify .xise file for other actions
"
,
metavar
=
"
ISE
"
)
parser
.
add_option
(
"
--synth-server
"
,
dest
=
"
synth_server
"
,
default
=
None
,
help
=
"
use given SERVER for remote synthesis
"
,
metavar
=
"
SERVER
"
)
parser
.
add_option
(
"
--synth-user
"
,
dest
=
"
synth_user
"
,
default
=
None
,
help
=
"
use given USER for remote synthesis
"
,
metavar
=
"
USER
"
)
parser
.
add_option
(
"
--make-list
"
,
dest
=
"
make_list
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
make list of project files in ISE format
"
)
parser
.
add_option
(
"
--no-del
"
,
dest
=
"
no_del
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
do not delete catalog after remote synthesis
"
)
parser
.
add_option
(
"
--inject
"
,
dest
=
"
inject
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
inject file list into ise project
"
)
(
global_mod
.
options
,
args
)
=
parser
.
parse_args
()
# check if manifest is given in the command line
# if yes, then use it
# if no, the look for it in the current directory (python manifest has priority)
if
global_mod
.
options
.
manifest
!=
None
:
global_mod
.
top_manifest
=
os
.
path
.
abspath
(
options
.
manifest
)
elif
os
.
path
.
exists
(
"
manifest.py
"
):
if
os
.
path
.
exists
(
"
manifest.py
"
):
global_mod
.
top_manifest
=
os
.
path
.
abspath
(
"
manifest.py
"
)
else
:
p
.
echo
(
"
No manifest found. At least an empty one is needed
"
)
quit
()
p
.
vprint
(
"
Manifests
'
scan queue:
"
+
str
([
global_mod
.
top_manifest
]))
p
.
vprint
(
"
Parsing manifest:
"
+
str
(
global_mod
.
top_manifest
))
if
global_mod
.
options
.
synth_server
!=
None
:
global_mod
.
synth_server
=
global_mod
.
options
.
synth_server
if
global_mod
.
options
.
synth_user
!=
None
:
...
...
@@ -99,15 +93,19 @@ def main():
tcl_pat
=
re
.
compile
(
"
^.*\.tcl$
"
)
for
file
in
os
.
listdir
(
"
.
"
):
#try to find it in the current dir
if
re
.
match
(
tcl_pat
,
file
):
p
.
vprint
(
"
Found .tcf l file in the current directory:
"
+
file
)
global_mod
.
opt_map
.
tcl
=
file
break
else
:
global_mod
.
opt_map
.
tcl
=
global_mod
.
options
.
tcl
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
manifest_help
==
True
:
parser
=
mnfst
.
init_manifest_parser
()
parser
.
print_help
()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
fetch
==
True
:
mnfst
.
fetch_manifest
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
modules
=
mnfst
.
fetch_manifest
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
p
.
vprint
(
"
Involved modules:
"
)
p
.
vpprint
(
modules
)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
local
==
True
:
if
global_mod
.
opt_map
.
tcl
==
None
:
...
...
@@ -125,16 +123,14 @@ def main():
results
=
os
.
popen
(
"
export PATH=$PATH:
"
+
path_ext
+
"
&&xtclsh
"
+
global_mod
.
opt_map
.
tcl
+
"
run_process
"
)
p
.
echo
(
results
.
readlines
())
quit
()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
remote
==
True
:
if
global_mod
.
opt_map
.
tcl
==
None
:
#option not taken but mandatory
p
.
echo
(
"
For Xilinx synthesis a tcl file in the top module is required
"
)
p
.
echo
(
"
For Xilinx synthesis a
.
tcl file in the top module is required
"
)
quit
()
if
not
os
.
path
.
exists
(
global_mod
.
opt_map
.
tcl
):
p
.
echo
(
"
Given .tcl doesn
'
t exist:
"
+
global_mod
.
opt_map
.
tcl
)
quit
()
p
.
vprint
(
"
The program will be using ssh connection:
"
+
global_mod
.
synth_user
+
"
@
"
+
global_mod
.
synth_server
)
global_mod
.
ssh
=
Connection
(
global_mod
.
synth_user
,
global_mod
.
synth_server
)
...
...
@@ -189,7 +185,7 @@ def main():
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
make_list
==
True
:
import
depend
modules
=
make_list_of_modules
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
modules
=
path
.
make_list_of_modules
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
p
.
vprint
(
"
Modules that will be taken into account in the makefile:
"
+
str
(
modules
))
deps
,
libs
=
depend
.
generate_deps_for_vhdl_in_modules
(
modules
)
...
...
@@ -199,46 +195,31 @@ def main():
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
make
==
True
:
import
depend
module_
file
_dict
=
path
.
make_list_of_modules
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
module_
manifest
_dict
=
path
.
make_list_of_modules
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
p
.
vprint
(
"
Modules that will be taken into account in the makefile:
"
)
p
.
vpprint
(
module_file_dict
)
#sv = make_list_of_files(modules = ".", file_type = "sv")
#p.pprint(sv)
#deps = depend.generate_deps_for_sv_files(sv)
#p.pprint(deps)
#quit()
deps
,
libs
=
depend
.
generate_deps_for_vhdl_in_modules
(
module_file_dict
)
p
.
vpprint
(
module_manifest_dict
)
deps
,
libs
=
depend
.
generate_deps_for_vhdl_in_modules
(
module_manifest_dict
)
depend
.
generate_makefile
(
deps
,
libs
)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
inject
==
True
:
if
global_mod
.
options
.
ise
==
None
:
if
global_mod
.
options
.
ise
_project
==
None
:
p
.
echo
(
"
You forgot to specify .xise file, didn
'
t you?
"
)
quit
()
if
not
os
.
path
.
exists
(
global_mod
.
options
.
ise
):
if
not
os
.
path
.
exists
(
global_mod
.
options
.
ise
_project
):
p
.
echo
(
"
Given ise file doesn
'
t exist
"
)
quit
()
import
depend
module_manifest_dict
=
make_list_of_modules
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
module_manifest_dict
=
path
.
make_list_of_modules
(
global_mod
.
top_manifest
,
global_mod
.
opt_map
)
p
.
vprint
(
"
Modules that will be taken into account in the makefile:
"
)
p
.
vpprint
(
modules
)
files
=
path
.
make_list_of_files
(
module_manifest_dict
,
file_type
=
"
vhd
"
)
module_files_dict
=
path
.
make_list_of_files
(
module_manifest_dict
,
file_type
=
"
vhd
"
)
p
.
vprint
(
"
List of used files
"
)
p
.
vpprint
(
files
)
p
.
vpprint
(
module_files_dict
)
inject_files_into_ise
(
global_mod
.
options
.
ise
,
files
)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if
global_mod
.
options
.
clean
==
True
:
if
os
.
path
.
exists
(
"
makefile
"
):
p
.
vprint
(
"
Running makefile clean-up
"
)
os
.
system
(
"
make clean > /dev/null
"
)
p
.
vprint
(
"
Removing the fetched modules
"
)
os
.
system
(
"
rm -rf
"
+
global_mod
.
fetchto
)
p
.
vprint
(
"
Removing the makefile
"
)
os
.
system
(
"
rm -f Makefile
"
)
inject_files_into_ise
(
global_mod
.
options
.
ise_project
,
files
)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
...
...
This diff is collapsed.
Click to expand it.
synthesis/path.py
+
16
−
12
View file @
af67d36d
...
...
@@ -91,6 +91,7 @@ def make_list_of_files(module_manifest_dict, file_type = None):
take_files - files specified directly in manifest. If there are some, we should take only them
file_type - file extension for filtering - if given, only this extension will be taken into account
"""
p
.
vpprint
(
module_manifest_dict
)
def
get_files
(
path
,
file_type
=
None
):
"""
Get lists of normal files and list folders recursively
...
...
@@ -141,6 +142,11 @@ def make_list_of_modules(top_manifest, top_opt_map):
module_manifest_dict
[
os
.
path
.
dirname
(
top_manifest
)]
=
top_manifest
while
True
:
if
opt_map
.
root_manifest
!=
None
:
root_manifest
=
opt_map
.
root_manifest
root_module
=
os
.
path
.
dirname
(
root_manifest
)
module_manifest_dict
[
root_module
]
=
root_manifest
new_manifests
.
append
(
root_manifest
)
if
opt_map
.
local
!=
[]:
modules
.
extend
(
opt_map
.
local
)
for
i
in
opt_map
.
local
:
...
...
@@ -152,28 +158,26 @@ def make_list_of_modules(top_manifest, top_opt_map):
module_manifest_dict
[
i
]
=
None
if
opt_map
.
git
!=
[]:
p
.
echo
(
opt_map
.
git
)
modules_git
=
os
.
path
.
join
(
opt_map
.
fetchto
,
url_basename
(
opt_map
.
git
))
modules
.
extend
(
modules_git
)
for
i
in
opt_map
.
git
:
manifest
=
search_for_manifest
(
i
)
module_git
=
os
.
path
.
join
(
opt_map
.
fetchto
,
url_basename
(
i
))
modules
.
append
(
module_git
)
manifest
=
search_for_manifest
(
module_git
)
if
manifest
!=
None
:
module_manifest_dict
[
i
]
=
manifest
module_manifest_dict
[
module_git
]
=
manifest
new_manifests
.
append
(
manifest
)
else
:
module_manifest_dict
[
i
]
=
None
module_manifest_dict
[
module_git
]
=
None
if
opt_map
.
svn
!=
[]:
p
.
echo
(
opt_map
.
svn
)
modules_svn
=
os
.
path
.
join
(
opt_map
.
fetchto
,
url_basename
(
opt_map
.
svn
))
modules
.
extend
(
modules_svn
)
for
i
in
opt_map
.
svn
:
manifest
=
search_for_manifest
(
i
)
module_svn
=
os
.
path
.
join
(
opt_map
.
fetchto
,
url_basename
(
i
))
modules
.
append
(
module_svn
)
manifest
=
search_for_manifest
(
module_svn
)
if
manifest
!=
None
:
module_manfiest_dict
[
i
]
=
manifest
module_manfiest_dict
[
module_svn
]
=
manifest
new_manifests
.
append
(
manifest
)
else
:
module_manifest_dict
[
i
]
=
None
module_manifest_dict
[
module_svn
]
=
None
if
len
(
new_manifests
)
==
0
:
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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