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
b89ecb22
Commit
b89ecb22
authored
Aug 09, 2016
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start refactoring simulators for a future common base
parent
1582a4e4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
56 deletions
+34
-56
ghdl.py
hdlmake/tools/ghdl.py
+2
-28
iverilog.py
hdlmake/tools/iverilog.py
+3
-28
make_sim.py
hdlmake/tools/make_sim.py
+29
-0
No files found.
hdlmake/tools/ghdl.py
View file @
b89ecb22
...
...
@@ -23,11 +23,9 @@
"""Module providing support for GHDL simulator"""
import
os
import
string
from
.make_sim
import
ToolSim
from
hdlmake.util
import
path
as
path_mod
from
hdlmake.srcfile
import
VHDLFile
...
...
@@ -45,7 +43,7 @@ class ToolGHDL(ToolSim):
HDL_FILES
=
[
VHDLFile
]
CLEAN_TARGETS
=
{
'clean'
:
[
"*.cf"
,
"*.o"
,
"$(TOP_MODULE)"
],
CLEAN_TARGETS
=
{
'clean'
:
[
"*.cf"
,
"*.o"
,
"$(TOP_MODULE)"
,
"work"
],
'mrproper'
:
[
"*.vcd"
]}
def
__init__
(
self
):
...
...
@@ -67,32 +65,8 @@ class ToolGHDL(ToolSim):
def
makefile_sim_compilation
(
self
):
"""Print the GDHL simulation compilation target"""
fileset
=
self
.
fileset
self
.
writeln
(
"simulation: $(VERILOG_OBJ) $(VHDL_OBJ)"
)
self
.
writeln
(
"
\t\t
ghdl -e $(TOP_MODULE)"
)
self
.
writeln
(
'
\n
'
)
for
file_aux
in
fileset
:
if
any
(
isinstance
(
file_aux
,
file_type
)
for
file_type
in
self
.
_hdl_files
):
self
.
write
(
"
%
s:
%
s"
%
(
os
.
path
.
join
(
file_aux
.
library
,
file_aux
.
purename
,
".
%
s_
%
s"
%
(
file_aux
.
purename
,
file_aux
.
extension
())),
file_aux
.
rel_path
()))
# list dependencies, do not include the target file
for
dep_file
in
[
dfile
for
dfile
in
file_aux
.
depends_on
if
dfile
is
not
file_aux
]:
if
dep_file
in
fileset
:
name
=
dep_file
.
purename
extension
=
dep_file
.
extension
()
self
.
write
(
"
\\\n
"
+
os
.
path
.
join
(
dep_file
.
library
,
name
,
".
%
s_
%
s"
%
(
name
,
extension
)))
else
:
# the file is included -> we depend directly on it
self
.
write
(
"
\\\n
"
+
dep_file
.
rel_path
())
self
.
writeln
()
self
.
writeln
(
"
\t\t
ghdl -a $<"
)
self
.
write
(
"
\t\t
@"
+
path_mod
.
mkdir_command
()
+
" $(dir $@)"
)
self
.
writeln
(
" && touch $@
\n
"
)
self
.
writeln
()
self
.
makefile_sim_dep_files
(
"ghdl -a $<"
)
hdlmake/tools/iverilog.py
View file @
b89ecb22
...
...
@@ -23,11 +23,9 @@
"""Module providing support for IVerilog (Icarus Verilog) simulator"""
import
os
import
string
from
.make_sim
import
ToolSim
from
hdlmake.util
import
path
as
path_mod
from
hdlmake.srcfile
import
VerilogFile
,
VHDLFile
,
SVFile
...
...
@@ -56,8 +54,6 @@ class ToolIVerilog(ToolSim):
def
makefile_sim_compilation
(
self
):
"""Generate compile simulation Makefile target for IVerilog"""
fileset
=
self
.
fileset
top_module
=
self
.
top_module
self
.
writeln
(
"simulation: include_dirs $(VERILOG_OBJ) $(VHDL_OBJ)"
)
self
.
writeln
(
"
\t\t
iverilog $(IVERILOG_OPT) -s $(TOP_MODULE)"
" -o $(TOP_MODULE).vvp -c run.command"
)
...
...
@@ -66,33 +62,12 @@ class ToolIVerilog(ToolSim):
self
.
writeln
(
"
\t\t
echo
\"
# IVerilog command file,"
" generated by HDLMake
\"
> run.command"
)
self
.
writeln
()
top_module
=
self
.
top_module
for
inc
in
top_module
.
get_include_dirs_list
():
self
.
writeln
(
"
\t\t
echo
\"
+incdir+"
+
inc
+
"
\"
>> run.command"
)
self
.
writeln
(
'
\n
'
)
for
file_aux
in
fileset
:
if
any
(
isinstance
(
file_aux
,
file_type
)
for
file_type
in
self
.
_hdl_files
):
self
.
write
(
"
%
s:
%
s"
%
(
os
.
path
.
join
(
file_aux
.
library
,
file_aux
.
purename
,
".
%
s_
%
s"
%
(
file_aux
.
purename
,
file_aux
.
extension
())),
file_aux
.
rel_path
()))
# list dependencies, do not include the target file
for
dep_file
in
[
dfile
for
dfile
in
file_aux
.
depends_on
if
dfile
is
not
file_aux
]:
if
dep_file
in
fileset
:
name
=
dep_file
.
purename
extension
=
dep_file
.
extension
()
self
.
write
(
"
\\\n
"
+
os
.
path
.
join
(
dep_file
.
library
,
name
,
".
%
s_
%
s"
%
(
name
,
extension
)))
else
:
# the file is included -> we depend directly on it
self
.
write
(
"
\\\n
"
+
dep_file
.
rel_path
())
self
.
writeln
()
self
.
writeln
(
"
\t\t
echo $< >> run.command"
)
self
.
write
(
"
\t\t
@"
+
path_mod
.
mkdir_command
()
+
" $(dir $@)"
)
self
.
writeln
(
" && touch $@
\n
"
)
self
.
writeln
()
compilation_command
=
"echo $< >> run.command"
self
.
makefile_sim_dep_files
(
compilation_command
)
def
makefile_sim_options
(
self
):
"""Print the IVerilog options to the Makefile"""
...
...
hdlmake/tools/make_sim.py
View file @
b89ecb22
...
...
@@ -4,6 +4,7 @@ import os
import
string
from
.makefile
import
ToolMakefile
from
hdlmake.util
import
path
as
path_mod
class
ToolSim
(
ToolMakefile
):
...
...
@@ -76,6 +77,34 @@ PWD := $$(shell pwd)
"
\\
"
)
self
.
writeln
()
def
makefile_sim_dep_files
(
self
,
compilation_command
):
"""Print dummy targets to handle file dependencies"""
fileset
=
self
.
fileset
for
file_aux
in
fileset
:
if
any
(
isinstance
(
file_aux
,
file_type
)
for
file_type
in
self
.
_hdl_files
):
self
.
write
(
"
%
s:
%
s"
%
(
os
.
path
.
join
(
file_aux
.
library
,
file_aux
.
purename
,
".
%
s_
%
s"
%
(
file_aux
.
purename
,
file_aux
.
extension
())),
file_aux
.
rel_path
()))
# list dependencies, do not include the target file
for
dep_file
in
[
dfile
for
dfile
in
file_aux
.
depends_on
if
dfile
is
not
file_aux
]:
if
dep_file
in
fileset
:
name
=
dep_file
.
purename
extension
=
dep_file
.
extension
()
self
.
write
(
"
\\\n
"
+
os
.
path
.
join
(
dep_file
.
library
,
name
,
".
%
s_
%
s"
%
(
name
,
extension
)))
else
:
# the file is included -> we depend directly on it
self
.
write
(
"
\\\n
"
+
dep_file
.
rel_path
())
self
.
writeln
()
self
.
writeln
(
"
\t\t
"
+
compilation_command
)
self
.
write
(
"
\t\t
@"
+
path_mod
.
mkdir_command
()
+
" $(dir $@)"
)
self
.
writeln
(
" && touch $@
\n
"
)
self
.
writeln
()
def
makefile_sim_command
(
self
):
"""Generic method to write the simulation Makefile user commands"""
if
self
.
top_module
.
manifest_dict
[
"sim_pre_cmd"
]:
...
...
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