Module is now independent from synthesis

parent 0a176158
......@@ -135,11 +135,11 @@ def _action_runner(modules_pool):
GenerateSimulationMakefile,
]
elif top_mod.action == "synthesis":
if not top_mod.syn_tool:
if not top_mod.manifest_dict["syn_tool"]:
logging.error("`syn_tool' manifest variable has to be specified. "
"Otherwise hdlmake doesn't know how to synthesize the project.")
quit()
top_mod.top_entity = top_mod.syn_top
top_mod.top_entity = top_mod.manifest_dict["syn_top"]
action = [
GenerateSynthesisProject,
GenerateSynthesisMakefile,
......
......@@ -37,7 +37,7 @@ class GenerateRemoteSynthesisMakefile(Action):
logging.error("action must be equal to \"synthesis\"")
sys.exit("Exiting")
if not self.top_module.syn_project:
if not self.top_module.manifest_dict["syn_project"]:
logging.error("syn_project must be set in the manifest.")
sys.exit("Exiting")
......@@ -45,7 +45,7 @@ class GenerateRemoteSynthesisMakefile(Action):
def run(self):
self._check_all_fetched_or_quit()
self._check_manifest()
tool_name = self.modules_pool.get_top_module().syn_tool
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:
......@@ -67,9 +67,9 @@ class GenerateRemoteSynthesisMakefile(Action):
files = self.modules_pool.build_file_set()
sff = SourceFileFactory()
files.add(sff.new(top_mod.syn_project, module=self.top_module))
files.add(sff.new(top_mod.manifest_dict["syn_project"], module=self.top_module))
tool_object.generate_remote_synthesis_makefile(files=files, name=top_mod.syn_project[:-5],
tool_object.generate_remote_synthesis_makefile(files=files, name=top_mod.manifest_dict["syn_project"][:-5],
cwd=top_mod.url, user=self.env["rsynth_user"],
server=self.env["rsynth_server"])
logging.info("Remote synthesis makefile generated.")
......
......@@ -31,10 +31,10 @@ class GenerateSynthesisMakefile(Action):
def _check_manifest(self):
# NOTE: top_module is not used in synthesis!!
if not self.modules_pool.get_top_module().syn_top:
if not self.modules_pool.get_top_module().manifest_dict["syn_top"]:
logging.error("syn_top variable must be set in the top manifest.")
sys.exit("Exiting")
if not self.modules_pool.get_top_module().syn_tool:
if not self.modules_pool.get_top_module().manifest_dict["syn_tool"]:
logging.error("syn_tool variable must be set in the top manifest.")
sys.exit("Exiting")
......@@ -42,7 +42,7 @@ class GenerateSynthesisMakefile(Action):
def run(self):
self._check_all_fetched_or_quit()
self._check_manifest()
tool_name = self.modules_pool.get_top_module().syn_tool
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:
......
......@@ -34,7 +34,7 @@ from .action import Action
class GenerateSynthesisProject(Action):
def _check_manifest(self):
if not self.modules_pool.get_top_module().syn_tool:
if not self.modules_pool.get_top_module().manifest_dict["syn_tool"]:
logging.error("syn_tool variable must be set in the top manifest.")
sys.exit("Exiting")
if not self.modules_pool.get_top_module().manifest_dict["syn_device"]:
......@@ -46,7 +46,7 @@ class GenerateSynthesisProject(Action):
if not self.modules_pool.get_top_module().manifest_dict["syn_package"]:
logging.error("syn_package variable must be set in the top manifest.")
sys.exit("Exiting")
if not self.modules_pool.get_top_module().syn_top:
if not self.modules_pool.get_top_module().manifest_dict["syn_top"]:
logging.error("syn_top variable must be set in the top manifest.")
sys.exit("Exiting")
......@@ -54,7 +54,7 @@ class GenerateSynthesisProject(Action):
def run(self):
self._check_all_fetched_or_quit()
self._check_manifest()
tool_name = self.modules_pool.get_top_module().syn_tool
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:
......@@ -121,7 +121,7 @@ end sdb_meta_pkg;""")
syn_tool_std_logic_vector.append("{0:04b}".format(int(digit)))
filled_template = template.substitute(repo_url=self.top_module.url,
syn_module_name=self.top_module.syn_top,
syn_module_name=self.top_module.manifest_dict["syn_top"],
syn_commit_id=self.top_module.revision,
syn_tool_name=tool.upper(),
syn_tool_version="0000"*(8-len(syn_tool_std_logic_vector))+''.join(syn_tool_std_logic_vector),
......@@ -162,7 +162,7 @@ end sdb_meta_pkg;""")
sys.exit("Exiting")
logging.info("Generating project for " + name + " v. %s" % env[version_key])
if os.path.exists(self.top_module.syn_project) or os.path.exists(self.top_module.syn_project + "." + ext_value):
if os.path.exists(self.top_module.manifest_dict["syn_project"]) or os.path.exists(self.top_module.manifest_dict["syn_project"] + "." + ext_value):
logging.info("Existing project detected: updating...")
update=True
else:
......
......@@ -9,7 +9,6 @@ from hdlmake.util import path as path_mod
class ModuleContent(ModuleCore):
"""Class providing the HDLMake module content"""
def __init__(self):
self.top_entity = None
# Manifest Files Properties
self.files = None
# Manifest Modules Properties
......@@ -18,12 +17,14 @@ class ModuleContent(ModuleCore):
self.svn = []
self.fetch_pre_cmd = None
self.fetch_post_cmd = None
self.incl_makefiles = []
super(ModuleContent, self).__init__()
def process_manifest(self):
"""Process the content section of the manifest_dic"""
self._process_manifest_files()
self._process_manifest_modules()
self._process_manifest_makefiles()
super(ModuleContent, self).process_manifest()
def _process_manifest_files(self):
......@@ -102,3 +103,16 @@ class ModuleContent(ModuleCore):
else:
self.git = []
def _process_manifest_makefiles(self):
"""Get the extra makefiles defined in the HDLMake module"""
# Included Makefiles
included_makefiles_aux = []
if isinstance(self.manifest_dict["incl_makefiles"], basestring):
included_makefiles_aux.append(self.manifest_dict["incl_makefiles"])
else: # list
included_makefiles_aux = self.manifest_dict["incl_makefiles"][:]
makefiles_paths = self._make_list_of_paths(included_makefiles_aux)
self.incl_makefiles.extend(makefiles_paths)
......@@ -67,6 +67,7 @@ class Module(ModuleSynthesis,
"""Calculate and initialize the origin attributes: path, source..."""
assert module_args.url is not None
assert module_args.source is not None
self.top_entity = None
super(Module, self).__init__()
self.init_config(module_args)
self.set_pool(pool)
......
"""This Python module is where the synthesis stuff is processed and stored"""
from .core import ModuleCore
class ModuleSynthesis(ModuleCore):
"""This class provides the container for the synthesis sub-module"""
def __init__(self):
# Device constructor
self.syn_project = None
self.syn_top = None
self.syn_tool = None
self.syn_ise_version = None
# Manifest Included Makefiles
self.incl_makefiles = []
super(ModuleSynthesis, self).__init__()
def process_manifest(self):
"""Process the synthesis section of the manifest dict"""
self._process_manifest_synthesis()
self._process_included_makefiles()
super(ModuleSynthesis, self).process_manifest()
def _process_manifest_synthesis(self):
"""Init generic synthesis properties"""
# Synthesis tool
self.syn_tool = self.manifest_dict["syn_tool"]
# Project parameters
self.syn_project = self.manifest_dict["syn_project"]
self.syn_top = self.manifest_dict["syn_top"]
# This is a Xilinx ISE specific value
if self.manifest_dict["syn_ise_version"] is not None:
version = self.manifest_dict["syn_ise_version"]
self.syn_ise_version = str(version)
def _process_included_makefiles(self):
"""Get the extra makefiles defined in the HDLMake module"""
# Included Makefiles
included_makefiles_aux = []
if isinstance(self.manifest_dict["incl_makefiles"], basestring):
included_makefiles_aux.append(self.manifest_dict["incl_makefiles"])
else: # list
included_makefiles_aux = self.manifest_dict["incl_makefiles"][:]
makefiles_paths = self._make_list_of_paths(included_makefiles_aux)
self.incl_makefiles.extend(makefiles_paths)
......@@ -113,8 +113,8 @@ mrproper:
bin_name = 'pnmainc'
else:
bin_name = 'diamondc'
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.syn_top,
project_name=top_mod.syn_project,
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.manifest_dict["syn_top"],
project_name=top_mod.manifest_dict["syn_project"],
diamond_path=tool_path,
check_tool=check_tool,
syn_pre_cmd=syn_pre_cmd,
......@@ -132,7 +132,7 @@ mrproper:
def generate_synthesis_project(self, update=False, tool_version='', top_mod=None, fileset=None):
self.files = []
self.filename = top_mod.syn_project
self.filename = top_mod.manifest_dict["syn_project"]
self.header = None
self.tclname = 'temporal.tcl'
if update is True:
......@@ -141,7 +141,7 @@ mrproper:
self.create_project(top_mod.manifest_dict["syn_device"],
top_mod.manifest_dict["syn_grade"],
top_mod.manifest_dict["syn_package"],
top_mod.syn_top)
top_mod.manifest_dict["syn_top"])
self.add_files(fileset)
self.emit(update=update)
self.execute()
......
......@@ -346,8 +346,8 @@ mrproper:
else:
check_tool = ''
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.syn_top,
project_name=top_mod.syn_project,
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.manifest_dict["syn_top"],
project_name=top_mod.manifest_dict["syn_project"],
ise_path=tool_path,
check_tool=check_tool,
syn_pre_cmd=top_mod.manifest_dict["syn_pre_cmd"],
......@@ -413,7 +413,7 @@ mrproper:
if update is True:
try:
self.load_xml(top_mod.syn_project)
self.load_xml(top_mod.manifest_dict["syn_project"])
except:
logging.error("Error while reading the project file.\n"
"Are you sure that syn_project indicates a correct ISE project file?")
......@@ -422,7 +422,7 @@ mrproper:
self.add_initial_properties()
logging.info("Writing down .xise project file")
self.emit_xml(self.top_mod.syn_project)
self.emit_xml(self.top_mod.manifest_dict["syn_project"])
def add_files(self, files):
......@@ -461,8 +461,8 @@ mrproper:
self.add_property("Device Family", tm.manifest_dict["syn_family"])
self.add_property("Speed Grade", tm.manifest_dict["syn_grade"])
self.add_property("Package", tm.manifest_dict["syn_package"])
self.add_property("Implementation Top", "Architecture|"+tm.syn_top)
self.add_property("Implementation Top Instance Path", "/"+tm.syn_top)
self.add_property("Implementation Top", "Architecture|"+tm.manifest_dict["syn_top"])
self.add_property("Implementation Top Instance Path", "/"+tm.manifest_dict["syn_top"])
def _parse_props(self):
for xmlp in self.xml_project.getElementsByTagName("properties")[0].getElementsByTagName("property"):
......@@ -559,7 +559,7 @@ mrproper:
from hdlmake.srcfile import CDCFile
for b in [f for f in self.files if isinstance(f, CDCFile)]:
bp = self.xml_doc.createElement("binding")
bp.setAttribute("xil_pn:location", self.top_mod.syn_top)
bp.setAttribute("xil_pn:location", self.top_mod.manifest_dict["syn_top"])
bp.setAttribute("xil_pn:name", b.rel_path())
node.appendChild(bp)
......
......@@ -112,8 +112,8 @@ mrproper:
else:
check_tool = ''
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.syn_top,
project_name=top_mod.syn_project,
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.manifest_dict["syn_top"],
project_name=top_mod.manifest_dict["syn_project"],
libero_path=tool_path,
check_tool=check_tool,
syn_pre_cmd=syn_pre_cmd,
......@@ -131,11 +131,11 @@ mrproper:
def generate_synthesis_project(self, update=False, tool_version='', top_mod=None, fileset=None):
self.files = []
self.filename = top_mod.syn_project
self.filename = top_mod.manifest_dict["syn_project"]
self.syn_device = top_mod.manifest_dict["syn_device"]
self.syn_grade = top_mod.manifest_dict["syn_grade"]
self.syn_package = top_mod.manifest_dict["syn_package"]
self.syn_top = top_mod.syn_top
self.syn_top = top_mod.manifest_dict["syn_top"]
self.header = None
self.tclname = 'temporal.tcl'
......
......@@ -120,8 +120,8 @@ mrproper:
else:
check_tool = ''
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.syn_top,
project_name=top_mod.syn_project,
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.manifest_dict["syn_top"],
project_name=top_mod.manifest_dict["syn_project"],
planahead_path=tool_path,
check_tool=check_tool,
syn_pre_cmd=syn_pre_cmd,
......@@ -140,7 +140,7 @@ mrproper:
def generate_synthesis_project(self, update=False, tool_version='', top_mod=None, fileset=None):
self.properties = []
self.files = []
self.filename = top_mod.syn_project
self.filename = top_mod.manifest_dict["syn_project"]
self.header = None
self.tclname = 'temporal.tcl'
if update is True:
......@@ -152,7 +152,7 @@ mrproper:
self.add_initial_properties(top_mod.manifest_dict["syn_device"],
top_mod.manifest_dict["syn_grade"],
top_mod.manifest_dict["syn_package"],
top_mod.syn_top)
top_mod.manifest_dict["syn_top"])
self.add_files(fileset)
self.emit()
self.execute()
......
......@@ -123,8 +123,8 @@ mrproper:
else:
check_tool = ''
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.syn_top,
project_name=top_mod.syn_project,
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.manifest_dict["syn_top"],
project_name=top_mod.manifest_dict["syn_project"],
quartus_path=tool_path,
check_tool=check_tool,
syn_pre_cmd=syn_pre_cmd,
......@@ -144,7 +144,7 @@ mrproper:
def generate_synthesis_project(self, update=False, tool_version='', top_mod=None, fileset=None):
self.properties = []
self.files = []
self.filename = top_mod.syn_project
self.filename = top_mod.manifest_dict["syn_project"]
self.preflow = top_mod.quartus_preflow
self.postmodule = top_mod.quartus_postmodule
self.postflow = top_mod.quartus_postflow
......@@ -156,7 +156,7 @@ mrproper:
top_mod.manifest_dict["syn_family"],
top_mod.manifest_dict["syn_grade"],
top_mod.manifest_dict["syn_package"],
top_mod.syn_top)
top_mod.manifest_dict["syn_top"])
self.add_files(fileset)
self.emit()
......
......@@ -117,8 +117,8 @@ mrproper:
else:
check_tool = ''
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.syn_top,
project_name=top_mod.syn_project,
makefile_text = makefile_tmplt.substitute(syn_top=top_mod.manifest_dict["syn_top"],
project_name=top_mod.manifest_dict["syn_project"],
planahead_path=tool_path,
check_tool=check_tool,
syn_pre_cmd=syn_pre_cmd,
......@@ -137,7 +137,7 @@ mrproper:
def generate_synthesis_project(self, update=False, tool_version='', top_mod=None, fileset=None):
self.properties = []
self.files = []
self.filename = top_mod.syn_project
self.filename = top_mod.manifest_dict["syn_project"]
self.header = None
self.tclname = 'temporal.tcl'
if update is True:
......@@ -149,7 +149,7 @@ mrproper:
self.add_initial_properties(top_mod.manifest_dict["syn_device"],
top_mod.manifest_dict["syn_grade"],
top_mod.manifest_dict["syn_package"],
top_mod.syn_top)
top_mod.manifest_dict["syn_top"])
self.add_files(fileset)
self.emit()
self.execute()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment