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
29d8cad3
Commit
29d8cad3
authored
Jul 29, 2016
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start refactoring Action module
parent
961a52fa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
44 deletions
+29
-44
action.py
hdlmake/action/action.py
+16
-1
remote_synthesis.py
hdlmake/action/remote_synthesis.py
+3
-11
simulation.py
hdlmake/action/simulation.py
+3
-11
synthesis.py
hdlmake/action/synthesis.py
+4
-10
synthesis_project.py
hdlmake/action/synthesis_project.py
+3
-11
No files found.
hdlmake/action/action.py
View file @
29d8cad3
...
...
@@ -21,7 +21,7 @@
import
sys
import
logging
import
importlib
class
Action
(
object
):
def
__init__
(
self
,
modules_pool
):
...
...
@@ -29,6 +29,12 @@ class Action(object):
self
.
options
=
modules_pool
.
env
.
options
self
.
env
=
modules_pool
.
env
if
modules_pool
.
get_top_module
()
.
manifest_dict
[
"action"
]
is
"synthesis"
:
tool_name
=
modules_pool
.
get_top_module
()
.
manifest_dict
[
"syn_tool"
]
elif
modules_pool
.
get_top_module
()
.
manifest_dict
[
"action"
]
is
"simulation"
:
tool_name
=
modules_pool
.
get_top_module
()
.
manifest_dict
[
"sim_tool"
]
tool_module
=
self
.
_load_tool
(
tool_name
)
self
.
tool
=
tool_module
.
ToolControls
()
self
.
_check_manifest
()
self
.
_check_env
()
self
.
_check_options
()
...
...
@@ -49,6 +55,15 @@ class Action(object):
def
run
(
self
):
raise
NotImplementedError
()
def
_load_tool
(
self
,
tool_name
):
try
:
tool_module
=
importlib
.
import_module
(
"hdlmake.tools.
%
s.
%
s"
%
(
tool_name
,
tool_name
))
except
Exception
as
e
:
logging
.
error
(
e
)
quit
()
return
tool_module
def
_check_all_fetched_or_quit
(
self
):
pool
=
self
.
modules_pool
if
not
pool
.
is_everything_fetched
():
...
...
hdlmake/action/remote_synthesis.py
View file @
29d8cad3
...
...
@@ -23,7 +23,6 @@
import
logging
import
os
import
sys
import
importlib
from
hdlmake.srcfile
import
SourceFileFactory
...
...
@@ -45,18 +44,11 @@ class GenerateRemoteSynthesisMakefile(Action):
def
run
(
self
):
self
.
_check_all_fetched_or_quit
()
self
.
_check_manifest
()
tool_name
=
self
.
modules_pool
.
get_top_module
()
.
manifest_dict
[
"syn_tool"
]
try
:
tool_module
=
importlib
.
import_module
(
"hdlmake.tools.
%
s.
%
s"
%
(
tool_name
,
tool_name
))
except
Exception
as
e
:
logging
.
error
(
e
)
quit
()
tool_object
=
tool_module
.
ToolControls
()
self
.
_generate_remote_synthesis_makefile
(
tool_object
)
self
.
_generate_remote_synthesis_makefile
()
def
_generate_remote_synthesis_makefile
(
self
,
tool_object
):
def
_generate_remote_synthesis_makefile
(
self
):
tool_object
=
self
.
tool
logging
.
info
(
"Generating makefile for remote synthesis."
)
top_mod
=
self
.
modules_pool
.
get_top_module
()
...
...
hdlmake/action/simulation.py
View file @
29d8cad3
...
...
@@ -23,7 +23,6 @@
from
__future__
import
print_function
import
logging
import
sys
import
importlib
from
hdlmake.dep_file
import
DepFile
import
hdlmake.new_dep_solver
as
dep_solver
...
...
@@ -44,18 +43,11 @@ class GenerateSimulationMakefile(Action):
def
run
(
self
):
self
.
_check_all_fetched_or_quit
()
self
.
_check_manifest
()
tool_name
=
self
.
modules_pool
.
get_top_module
()
.
manifest_dict
[
"sim_tool"
]
try
:
tool_module
=
importlib
.
import_module
(
"hdlmake.tools.
%
s.
%
s"
%
(
tool_name
,
tool_name
))
except
Exception
as
e
:
logging
.
error
(
e
)
quit
()
tool_object
=
tool_module
.
ToolControls
()
self
.
_generate_simulation_makefile
(
tool_object
)
self
.
_generate_simulation_makefile
()
def
_generate_simulation_makefile
(
self
,
tool_object
):
def
_generate_simulation_makefile
(
self
):
tool_object
=
self
.
tool
tool_info
=
tool_object
.
get_keys
()
if
sys
.
platform
==
'cygwin'
:
bin_name
=
tool_info
[
'windows_bin'
]
...
...
hdlmake/action/synthesis.py
View file @
29d8cad3
...
...
@@ -42,18 +42,12 @@ class GenerateSynthesisMakefile(Action):
def
run
(
self
):
self
.
_check_all_fetched_or_quit
()
self
.
_check_manifest
()
tool_name
=
self
.
modules_pool
.
get_top_module
()
.
manifest_dict
[
"syn_tool"
]
try
:
tool_module
=
importlib
.
import_module
(
"hdlmake.tools.
%
s.
%
s"
%
(
tool_name
,
tool_name
))
except
Exception
as
e
:
logging
.
error
(
e
)
quit
()
tool_object
=
tool_module
.
ToolControls
()
self
.
_generate_synthesis_makefile
(
tool_object
)
self
.
_generate_synthesis_makefile
()
def
_generate_synthesis_makefile
(
self
,
tool_object
):
def
_generate_synthesis_makefile
(
self
):
tool_object
=
self
.
tool
tool_info
=
tool_object
.
get_keys
()
if
sys
.
platform
==
'cygwin'
:
bin_name
=
tool_info
[
'windows_bin'
]
...
...
hdlmake/action/synthesis_project.py
View file @
29d8cad3
...
...
@@ -24,7 +24,6 @@ from __future__ import print_function
import
logging
import
sys
import
os
import
importlib
from
hdlmake.srcfile
import
SourceFileFactory
from
hdlmake.util
import
path
...
...
@@ -54,14 +53,7 @@ class GenerateSynthesisProject(Action):
def
run
(
self
):
self
.
_check_all_fetched_or_quit
()
self
.
_check_manifest
()
tool_name
=
self
.
modules_pool
.
get_top_module
()
.
manifest_dict
[
"syn_tool"
]
try
:
tool_module
=
importlib
.
import_module
(
"hdlmake.tools.
%
s.
%
s"
%
(
tool_name
,
tool_name
))
except
Exception
as
e
:
logging
.
error
(
e
)
quit
()
tool_object
=
tool_module
.
ToolControls
()
self
.
_generate_synthesis_project
(
tool_object
)
self
.
_generate_synthesis_project
()
def
_write_project_vhd
(
self
,
tool
,
version
):
...
...
@@ -134,8 +126,8 @@ end sdb_meta_pkg;""")
def
_generate_synthesis_project
(
self
,
tool_object
):
def
_generate_synthesis_project
(
self
):
tool_object
=
self
.
tool
tool_info
=
tool_object
.
get_keys
()
if
sys
.
platform
==
'cygwin'
:
bin_name
=
tool_info
[
'windows_bin'
]
...
...
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