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
484d5d34
Commit
484d5d34
authored
May 24, 2017
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor the way in which the tool specific makefile writer is chosen
parent
eeaca46d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
30 deletions
+21
-30
core.py
hdlmake/action/core.py
+11
-3
__init__.py
hdlmake/tools/__init__.py
+1
-1
makefile_writer.py
hdlmake/tools/makefile_writer.py
+9
-26
No files found.
hdlmake/action/core.py
View file @
484d5d34
...
...
@@ -28,7 +28,7 @@ import os
import
sys
import
os.path
from
hdlmake.tools
import
write_makefile
from
hdlmake.tools
import
load_syn_tool
,
load_sim_tool
import
hdlmake.fetch
as
fetch
import
hdlmake.new_dep_solver
as
dep_solver
from
hdlmake.util
import
path
as
path_mod
...
...
@@ -62,8 +62,16 @@ class ActionCore(Action):
def
makefile
(
self
):
"""Write the Makefile for the current design"""
self
.
_check_all_fetched_or_quit
()
write_makefile
(
self
)
action
=
self
.
config
.
get
(
"action"
)
if
action
==
"simulation"
:
sim_writer
=
load_sim_tool
(
self
.
config
.
get
(
"sim_tool"
))
sim_writer
.
simulation_makefile
(
self
)
elif
action
==
"synthesis"
:
syn_writer
=
load_syn_tool
(
self
.
config
.
get
(
"syn_tool"
))
syn_writer
.
synthesis_makefile
(
self
)
else
:
logging
.
error
(
"Unknown requested action:
%
s"
,
action
)
quit
()
def
_fetch_all
(
self
):
"""Fetch all the modules declared in the design"""
...
...
hdlmake/tools/__init__.py
View file @
484d5d34
"""Package that provides all the tool specific stuff"""
from
.makefile_writer
import
write_makefile
from
.makefile_writer
import
load_syn_tool
,
load_sim_tool
hdlmake/tools/makefile_writer.py
View file @
484d5d34
...
...
@@ -3,7 +3,7 @@
import
logging
def
_load_syn_tool
(
modules_pool
):
def
load_syn_tool
(
tool_name
):
"""Funtion that checks the provided module_pool and generate an
initialized instance of the the appropriated synthesis tool"""
from
.ise
import
ToolISE
...
...
@@ -20,17 +20,15 @@ def _load_syn_tool(modules_pool):
'diamond'
:
ToolDiamond
,
'libero'
:
ToolLibero
,
'icestorm'
:
ToolIcestorm
}
for
mod
in
modules_pool
:
if
'syn_tool'
in
mod
.
manifest_dict
:
tool_name
=
mod
.
manifest_dict
[
'syn_tool'
]
if
tool_name
in
available_tools
:
logging
.
debug
(
"Tool to be used found:
%
s"
,
tool_name
)
return
available_tools
[
tool_name
]()
logging
.
error
(
"Unknown synthesis tool:
%
s"
,
tool_name
)
quit
()
if
tool_name
in
available_tools
:
logging
.
debug
(
"Synthesis tool to be used found:
%
s"
,
tool_name
)
return
available_tools
[
tool_name
]()
else
:
logging
.
error
(
"Unknown synthesis tool:
%
s"
,
tool_name
)
quit
()
def
_load_sim_tool
(
modules_pool
):
def
load_sim_tool
(
tool_name
):
"""Funtion that checks the provided module_pool and generate an
initialized instance of the the appropriated simulation tool"""
from
.iverilog
import
ToolIVerilog
...
...
@@ -47,24 +45,9 @@ def _load_sim_tool(modules_pool):
'riviera'
:
ToolRiviera
,
'ghdl'
:
ToolGHDL
,
'vivado'
:
ToolVivado
}
manifest_dict
=
modules_pool
.
get_top_module
()
.
manifest_dict
tool_name
=
manifest_dict
[
'sim_tool'
]
if
tool_name
in
available_tools
:
logging
.
debug
(
"Simulation tool to be used found:
%
s"
,
tool_name
)
return
available_tools
[
tool_name
]()
else
:
logging
.
error
(
"Unknown simulation tool:
%
s"
,
tool_name
)
quit
()
def
write_makefile
(
modules_pool
):
"""Function that detects the appropriated tool and write the Makefile"""
action
=
modules_pool
.
config
.
get
(
'action'
)
if
action
==
"simulation"
:
sim_writer
=
_load_sim_tool
(
modules_pool
)
sim_writer
.
simulation_makefile
(
modules_pool
)
elif
action
==
"synthesis"
:
syn_writer
=
_load_syn_tool
(
modules_pool
)
syn_writer
.
synthesis_makefile
(
modules_pool
)
else
:
logging
.
error
(
"Unknown requested action:
%
s"
,
action
)
quit
()
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