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
2ba26cdf
Commit
2ba26cdf
authored
Jul 23, 2016
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move some core Module stuff to a new class and refactor Module constructor
parent
18bb0278
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
43 deletions
+40
-43
module.py
hdlmake/module.py
+11
-43
module_core.py
hdlmake/module_core.py
+29
-0
No files found.
hdlmake/module.py
View file @
2ba26cdf
...
...
@@ -28,13 +28,14 @@ import logging
from
.manifest_parser
import
Manifest
,
ManifestParser
from
.util
import
path
as
path_mod
from
.
import
fetch
from
.module_core
import
ModuleCore
from
.module_synthesis
import
ModuleSynthesis
from
.module_simulation
import
ModuleSimulation
from
.module_content
import
ModuleContent
from
.module_altera
import
ModuleAltera
class
Module
(
ModuleSynthesis
,
ModuleSimulation
,
ModuleContent
,
ModuleAltera
):
class
Module
(
Module
Core
,
Module
Synthesis
,
ModuleSimulation
,
ModuleContent
,
ModuleAltera
):
@
property
def
source
(
self
):
return
self
.
_source
...
...
@@ -67,38 +68,16 @@ class Module(ModuleSynthesis, ModuleSimulation, ModuleContent, ModuleAltera):
self
.
manifest
=
None
self
.
manifest_dict
=
None
self
.
pool
=
pool
self
.
top_module
=
pool
.
get_top_module
()
self
.
source
=
source
self
.
parent
=
parent
self
.
isparsed
=
False
self
.
top_entity
=
None
self
.
revision
=
None
self
.
fetchto
=
fetchto
# Universal Manifest Properties
self
.
top_module
=
pool
.
get_top_module
()
self
.
library
=
"work"
self
.
target
=
None
self
.
action
=
None
# Manifest Force tool Property
self
.
force_tool
=
None
self
.
raw_url
=
url
if
source
!=
fetch
.
LOCAL
:
self
.
url
,
self
.
branch
,
self
.
revision
=
path_mod
.
url_parse
(
url
)
else
:
self
.
url
,
self
.
branch
,
self
.
revision
=
url
,
None
,
None
if
source
==
fetch
.
LOCAL
and
not
os
.
path
.
exists
(
url
):
logging
.
error
(
"Path to the local module doesn't exist:
\n
"
+
url
+
"
\n
This module was instantiated in: "
+
str
(
parent
))
quit
()
if
source
==
fetch
.
LOCAL
:
self
.
path
=
url
self
.
isfetched
=
True
else
:
if
os
.
path
.
exists
(
os
.
path
.
abspath
(
os
.
path
.
join
(
fetchto
,
self
.
basename
)))
and
os
.
listdir
(
os
.
path
.
abspath
(
os
.
path
.
join
(
fetchto
,
self
.
basename
))):
self
.
path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
fetchto
,
self
.
basename
))
self
.
isfetched
=
True
...
...
@@ -107,7 +86,15 @@ class Module(ModuleSynthesis, ModuleSimulation, ModuleContent, ModuleAltera):
self
.
path
=
None
self
.
isfetched
=
False
logging
.
debug
(
"Module
%
s (parent:
%
s) is NOT fetched."
%
(
url
,
parent
.
path
))
else
:
self
.
url
,
self
.
branch
,
self
.
revision
=
url
,
None
,
None
if
not
os
.
path
.
exists
(
url
):
logging
.
error
(
"Path to the local module doesn't exist:
\n
"
+
url
+
"
\n
This module was instantiated in: "
+
str
(
parent
))
quit
()
self
.
path
=
url
self
.
isfetched
=
True
def
__str__
(
self
):
...
...
@@ -244,25 +231,6 @@ class Module(ModuleSynthesis, ModuleSimulation, ModuleContent, ModuleAltera):
m
.
parse_manifest
()
def
_process_manifest_force_tool
(
self
):
if
self
.
manifest_dict
[
"force_tool"
]:
ft
=
self
.
manifest_dict
[
"force_tool"
]
self
.
force_tool
=
ft
.
split
(
' '
)
if
len
(
self
.
force_tool
)
!=
3
:
logging
.
warning
(
"Incorrect force_tool format
%
s. Ignoring"
%
self
.
force_tool
)
self
.
force_tool
=
None
def
_process_manifest_universal
(
self
):
if
"top_module"
in
self
.
manifest_dict
:
self
.
top_module
=
self
.
manifest_dict
[
"top_module"
]
# Libraries
self
.
library
=
self
.
manifest_dict
[
"library"
]
self
.
target
=
self
.
manifest_dict
[
"target"
]
.
lower
()
self
.
action
=
self
.
manifest_dict
[
"action"
]
.
lower
()
def
_make_list_of_paths
(
self
,
list_of_paths
):
paths
=
[]
for
filepath
in
list_of_paths
:
...
...
hdlmake/module_core.py
0 → 100644
View file @
2ba26cdf
class
ModuleCore
(
object
):
def
__init__
(
self
):
super
(
ModuleCore
,
self
)
.
__init__
()
# Universal Manifest Properties
self
.
library
=
"work"
self
.
target
=
None
self
.
action
=
None
# Manifest Force tool Property
self
.
force_tool
=
None
def
_process_manifest_force_tool
(
self
):
if
self
.
manifest_dict
[
"force_tool"
]:
ft
=
self
.
manifest_dict
[
"force_tool"
]
self
.
force_tool
=
ft
.
split
(
' '
)
if
len
(
self
.
force_tool
)
!=
3
:
logging
.
warning
(
"Incorrect force_tool format
%
s. Ignoring"
%
self
.
force_tool
)
self
.
force_tool
=
None
def
_process_manifest_universal
(
self
):
if
"top_module"
in
self
.
manifest_dict
:
self
.
top_module
=
self
.
manifest_dict
[
"top_module"
]
# Libraries
self
.
library
=
self
.
manifest_dict
[
"library"
]
self
.
target
=
self
.
manifest_dict
[
"target"
]
.
lower
()
self
.
action
=
self
.
manifest_dict
[
"action"
]
.
lower
()
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