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
f6ba3e94
Commit
f6ba3e94
authored
Apr 30, 2019
by
Nicolas Chevillot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace quit() with raise Exception
parent
c4b5fced
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
37 additions
and
59 deletions
+37
-59
action.py
hdlmake/action/action.py
+1
-2
core.py
hdlmake/action/core.py
+1
-2
tree.py
hdlmake/action/tree.py
+3
-6
configparser.py
hdlmake/manifest_parser/configparser.py
+6
-8
variables.py
hdlmake/manifest_parser/variables.py
+2
-4
content.py
hdlmake/module/content.py
+2
-3
core.py
hdlmake/module/core.py
+1
-2
module.py
hdlmake/module/module.py
+1
-2
srcfile.py
hdlmake/srcfile.py
+2
-3
ise.py
hdlmake/tools/ise.py
+1
-2
isim.py
hdlmake/tools/isim.py
+1
-2
makefile_writer.py
hdlmake/tools/makefile_writer.py
+4
-6
quartus.py
hdlmake/tools/quartus.py
+11
-15
vlog_parser.py
hdlmake/vlog_parser.py
+1
-2
No files found.
hdlmake/action/action.py
View file @
f6ba3e94
...
...
@@ -92,8 +92,7 @@ class Action(list):
self
.
config
[
"syn_top"
]
=
self
.
config
[
"top_module"
]
self
.
top_entity
=
self
.
config
.
get
(
"syn_top"
)
else
:
logging
.
error
(
"Unknown requested action:
%
s"
,
action
)
quit
(
1
)
raise
Exception
(
"Unknown requested action:
%
s"
,
action
)
def
new_module
(
self
,
parent
,
url
,
source
,
fetchto
):
"""Add new module to the pool.
...
...
hdlmake/action/core.py
View file @
f6ba3e94
...
...
@@ -51,12 +51,11 @@ class ActionCore(Action):
"""Check if every module in the pool is fetched"""
if
not
len
([
m
for
m
in
self
if
not
m
.
isfetched
])
==
0
:
logging
.
error
(
raise
Exception
(
"Fetching should be done before continuing.
\n
"
"The following modules remains unfetched:
\n
"
"
%
s"
,
"
\n
"
.
join
([
str
(
m
)
for
m
in
self
if
not
m
.
isfetched
]))
quit
(
1
)
def
makefile
(
self
):
"""Write the Makefile for the current design"""
self
.
_check_all_fetched
()
...
...
hdlmake/action/tree.py
View file @
f6ba3e94
...
...
@@ -44,8 +44,7 @@ class ActionTree(Action):
import
networkx
as
nx
from
networkx.readwrite
import
json_graph
except
ImportError
as
error_import
:
logging
.
error
(
error_import
)
quit
(
1
)
raise
Exception
(
error_import
)
if
self
.
options
.
mode
==
'dfs'
:
hierarchy
=
nx
.
dfs_tree
(
hierarchy
,
top_id
)
elif
self
.
options
.
mode
==
'bfs'
:
...
...
@@ -61,8 +60,7 @@ class ActionTree(Action):
try
:
import
networkx
as
nx
except
ImportError
as
error_import
:
logging
.
error
(
error_import
)
quit
(
1
)
raise
Exception
(
error_import
)
unfetched_modules
=
False
hierarchy
=
nx
.
DiGraph
()
...
...
@@ -116,8 +114,7 @@ class ActionTree(Action):
top_level_entity
)
else
:
logging
.
error
(
'Unknown tree mode:
%
s'
,
self
.
options
.
mode
)
quit
(
1
)
raise
Exception
(
'Unknown tree mode:
%
s'
,
self
.
options
.
mode
)
if
unfetched_modules
:
logging
.
warning
(
"Some of the modules have not been fetched!"
)
...
...
hdlmake/manifest_parser/configparser.py
View file @
f6ba3e94
...
...
@@ -308,15 +308,13 @@ types:[<type 'int'>]
for
line
in
printed
.
split
(
'
\n
'
):
print
(
"> "
+
line
)
except
SyntaxError
as
error_syntax
:
logging
.
error
(
"Invalid syntax in the manifest file "
+
self
.
config_file
+
":
\n
"
+
str
(
error_syntax
))
logging
.
error
(
content
)
quit
(
1
)
raise
Exception
(
"Invalid syntax in the manifest file "
+
self
.
config_file
+
":
\n
"
+
str
(
error_syntax
)
+
content
)
except
SystemExit
as
error_exit
:
logging
.
error
(
"Exit requested by the manifest file "
+
self
.
config_file
+
":
\n
"
+
str
(
error_exit
))
logging
.
error
(
content
)
quit
(
1
)
raise
Exception
(
"Exit requested by the manifest file "
+
self
.
config_file
+
":
\n
"
+
str
(
error_exit
)
+
content
)
except
:
logging
.
error
(
"Encountered unexpected error while parsing "
+
self
.
config_file
)
...
...
hdlmake/manifest_parser/variables.py
View file @
f6ba3e94
...
...
@@ -276,11 +276,10 @@ class ManifestParser(ConfigParser):
logging
.
debug
(
"Looking for manifest in "
+
path
)
dir_files
=
os
.
listdir
(
path
)
if
"manifest.py"
in
dir_files
and
"Manifest.py"
in
dir_files
:
logging
.
error
(
raise
Exception
(
"Both manifest.py and Manifest.py"
+
"found in the module directory:
%
s"
,
path
)
quit
(
1
)
for
filename
in
dir_files
:
if
filename
==
"manifest.py"
or
filename
==
"Manifest.py"
:
if
not
os
.
path
.
isdir
(
filename
):
...
...
@@ -296,8 +295,7 @@ class ManifestParser(ConfigParser):
return
None
manifest
=
_search_for_manifest
(
path
)
if
manifest
is
None
:
logging
.
error
(
"No manifest found in path:
%
s"
,
path
)
quit
(
1
)
raise
Exception
(
"No manifest found in path:
%
s"
,
path
)
else
:
logging
.
debug
(
"Parse manifest in:
%
s"
,
manifest
)
return
self
.
add_config_file
(
manifest
)
...
...
hdlmake/module/content.py
View file @
f6ba3e94
...
...
@@ -100,9 +100,8 @@ class ModuleContent(ModuleCore):
local_mods
=
[]
for
path
in
local_paths
:
if
path_mod
.
is_abs_path
(
path
):
logging
.
error
(
"Found an absolute path ("
+
path
+
") in a manifest("
+
self
.
path
+
")"
)
quit
(
1
)
raise
Exception
(
"Found an absolute path ("
+
path
+
") in a manifest("
+
self
.
path
+
")"
)
path
=
path_mod
.
rel2abs
(
path
,
self
.
path
)
local_mods
.
append
(
self
.
pool
.
new_module
(
parent
=
self
,
url
=
path
,
...
...
hdlmake/module/core.py
View file @
f6ba3e94
...
...
@@ -75,10 +75,9 @@ class ModuleConfig(object):
self
.
url
,
self
.
branch
,
self
.
revision
=
url
,
None
,
None
if
not
os
.
path
.
exists
(
url
):
logging
.
error
(
raise
Exception
(
"Path to the local module doesn't exist:
\n
"
+
url
+
"
\n
This module was instantiated in: "
+
str
(
self
.
parent
))
quit
(
1
)
self
.
path
=
path_mod
.
relpath
(
url
)
self
.
isfetched
=
True
...
...
hdlmake/module/module.py
View file @
f6ba3e94
...
...
@@ -166,10 +166,9 @@ PARSE START: %s
try
:
opt_map
=
manifest_parser
.
parse
(
extra_context
=
extra_context
)
except
NameError
as
name_error
:
logging
.
error
(
raise
Exception
(
"Error while parsing {0}:
\n
{1}: {2}."
.
format
(
self
.
path
,
type
(
name_error
),
name_error
))
quit
(
1
)
self
.
manifest_dict
=
opt_map
else
:
self
.
manifest_dict
=
{}
...
...
hdlmake/srcfile.py
View file @
f6ba3e94
...
...
@@ -436,7 +436,6 @@ def create_source_file(path, module, library=None,
elif
extension
in
MICROSEMI_FILE_DICT
:
new_file
=
MICROSEMI_FILE_DICT
[
extension
](
path
=
path
,
module
=
module
)
else
:
logging
.
error
(
"Cannot create source file
%
s, "
"unknown file extension
%
s"
,
path
,
extension
)
quit
(
1
)
raise
Exception
(
"Cannot create source file
%
s, "
"unknown file extension
%
s"
,
path
,
extension
)
return
new_file
hdlmake/tools/ise.py
View file @
f6ba3e94
...
...
@@ -139,10 +139,9 @@ $(TCL_CLOSE)'''
syn_family
=
FAMILY_NAMES
.
get
(
self
.
manifest_dict
[
"syn_device"
][
0
:
4
]
.
upper
())
if
syn_family
is
None
:
logging
.
error
(
raise
Exception
(
"syn_family is not defined in Manifest.py"
" and can not be guessed!"
)
quit
(
-
1
)
self
.
manifest_dict
[
"syn_family"
]
=
syn_family
super
(
ToolISE
,
self
)
.
_makefile_syn_top
()
...
...
hdlmake/tools/isim.py
View file @
f6ba3e94
...
...
@@ -75,8 +75,7 @@ class ToolISim(ToolSim):
xilinx_dir
=
str
(
os
.
path
.
join
(
self
.
manifest_dict
[
"sim_path"
],
".."
,
".."
))
else
:
logging
.
error
(
"Cannot calculate xilinx tools base directory"
)
quit
(
1
)
raise
Exception
(
"Cannot calculate xilinx tools base directory"
)
hdl_language
=
'vhdl'
# 'verilog'
if
shell
.
check_windows
():
os_prefix
=
'nt'
...
...
hdlmake/tools/makefile_writer.py
View file @
f6ba3e94
...
...
@@ -24,9 +24,8 @@ def load_syn_tool(tool_name):
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
)
logging
.
error
(
" Supported synthesis tools are
%
s"
,
available_tools
.
keys
())
quit
(
1
)
raise
Exception
(
"Unknown synthesis tool:
%
s"
+
tool_name
+
" Supported synthesis tools are
%
s"
+
available_tools
.
keys
())
def
load_sim_tool
(
tool_name
):
...
...
@@ -50,6 +49,5 @@ def load_sim_tool(tool_name):
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
)
logging
.
error
(
" Supported simulation tools are
%
s"
,
available_tools
.
keys
())
quit
(
1
)
raise
Exception
(
"Unknown simulation tool:
%
s"
+
tool_name
+
" Supported simulation tools are
%
s"
+
available_tools
.
keys
())
hdlmake/tools/quartus.py
View file @
f6ba3e94
...
...
@@ -202,9 +202,8 @@ class ToolQuartus(ToolSyn):
'value'
:
'$(TOP_MODULE)'
}))
for
user_property
in
self
.
manifest_dict
.
get
(
"syn_properties"
,
[]):
if
not
isinstance
(
user_property
,
dict
):
logging
.
error
(
"Quartus property should be defined as dict: "
+
str
(
user_property
))
quit
(
1
)
raise
Exception
(
"Quartus property should be defined as dict: "
+
str
(
user_property
))
command_list
.
append
(
self
.
_emit_property
(
self
.
SET_GLOBAL_ASSIGNMENT
,
user_property
))
for
inc
in
self
.
manifest_dict
.
get
(
"include_dirs"
,
[]):
...
...
@@ -221,10 +220,9 @@ class ToolQuartus(ToolSyn):
path
=
shell
.
tclpath
(
path_mod
.
compose
(
self
.
manifest_dict
[
"quartus_preflow"
],
os
.
getcwd
()))
if
not
os
.
path
.
exists
(
path
):
logging
.
error
(
"quartus_preflow file listed in "
+
os
.
getcwd
()
+
" doesn't exist: "
+
path
+
".
\n
Exiting."
)
quit
(
1
)
raise
Exception
(
"quartus_preflow file listed in "
+
os
.
getcwd
()
+
" doesn't exist: "
+
path
+
".
\n
Exiting."
)
preflow
=
'"'
+
'quartus_sh:'
+
path
+
'"'
command_list
.
append
(
self
.
_emit_property
(
self
.
SET_GLOBAL_ASSIGNMENT
,
{
'name'
:
'PRE_FLOW_SCRIPT_FILE'
,
...
...
@@ -234,10 +232,9 @@ class ToolQuartus(ToolSyn):
self
.
manifest_dict
[
"quartus_postmodule"
],
os
.
getcwd
()))
if
not
os
.
path
.
exists
(
path
):
logging
.
error
(
"quartus_postmodule file listed in "
+
os
.
getcwd
()
+
" doesn't exist: "
+
path
+
".
\n
Exiting."
)
quit
(
1
)
raise
Exception
(
"quartus_postmodule file listed in "
+
os
.
getcwd
()
+
" doesn't exist: "
+
path
+
".
\n
Exiting."
)
postmodule
=
'"'
+
'quartus_sh:'
+
path
+
'"'
command_list
.
append
(
self
.
_emit_property
(
self
.
SET_GLOBAL_ASSIGNMENT
,
{
'name'
:
'POST_MODULE_SCRIPT_FILE'
,
...
...
@@ -246,10 +243,9 @@ class ToolQuartus(ToolSyn):
path
=
shell
.
tclpath
(
path_mod
.
compose
(
self
.
manifest_dict
[
"quartus_postflow"
],
os
.
getcwd
()))
if
not
os
.
path
.
exists
(
path
):
logging
.
error
(
"quartus_postflow file listed in "
+
os
.
getcwd
()
+
" doesn't exist: "
+
path
+
".
\n
Exiting."
)
quit
(
1
)
raise
Exception
(
"quartus_postflow file listed in "
+
os
.
getcwd
()
+
" doesn't exist: "
+
path
+
".
\n
Exiting."
)
postflow
=
'"'
+
'quartus_sh:'
+
path
+
'"'
command_list
.
append
(
self
.
_emit_property
(
self
.
SET_GLOBAL_ASSIGNMENT
,
{
'name'
:
'POST_FLOW_SCRIPT_FILE'
,
...
...
hdlmake/vlog_parser.py
View file @
f6ba3e94
...
...
@@ -135,8 +135,7 @@ class VerilogPreprocessor(object):
else
:
params
=
[]
if
name
in
self
.
vpp_keywords
:
logging
.
error
(
"Attempt to `define a reserved preprocessor keyword"
)
quit
(
1
)
raise
Exception
(
"Attempt to `define a reserved preprocessor keyword"
)
mdef
=
self
.
VLDefine
(
name
,
params
,
expansion
)
self
.
vpp_macros
.
append
(
mdef
)
return
mdef
...
...
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