Module is now independent from Altera

parent 50f030e3
...@@ -146,7 +146,7 @@ def _action_runner(modules_pool): ...@@ -146,7 +146,7 @@ def _action_runner(modules_pool):
GenerateRemoteSynthesisMakefile GenerateRemoteSynthesisMakefile
] ]
elif top_mod.action == "qsys_hw_tcl_update": elif top_mod.action == "qsys_hw_tcl_update":
if not top_mod.hw_tcl_filename: if not top_mod.manifest_dict["hw_tcl_filename"]:
logging.error("'hw_tcl_filename' manifest variable has to be specified. " logging.error("'hw_tcl_filename' manifest variable has to be specified. "
"Otherwise hdlmake doesn't know which file to update.") "Otherwise hdlmake doesn't know which file to update.")
quit() quit()
......
...@@ -41,7 +41,7 @@ class QsysHwTclUpdate(Action): ...@@ -41,7 +41,7 @@ class QsysHwTclUpdate(Action):
file_tcl[-1] += " TOP_LEVEL_FILE" file_tcl[-1] += " TOP_LEVEL_FILE"
file_tcl.append("\n") file_tcl.append("\n")
hw_tcl_filename = self.modules_pool.get_top_module().hw_tcl_filename; hw_tcl_filename = self.modules_pool.get_top_module().manifest_dict["hw_tcl_filename"]
infile = open(hw_tcl_filename,"r") infile = open(hw_tcl_filename,"r")
inserted = True inserted = True
......
...@@ -2,6 +2,5 @@ ...@@ -2,6 +2,5 @@
from .core import ModuleCore from .core import ModuleCore
from .content import ModuleContent from .content import ModuleContent
from .altera import ModuleAltera
from .module import Module, ModuleArgs from .module import Module, ModuleArgs
"""This is a interim module providing Intel/Altera stuff"""
import os
import logging
from .core import ModuleCore
from hdlmake.util import path as path_mod
class ModuleAltera(ModuleCore):
"""Class providing the TCL files that Altera Quartus requires"""
def __init__(self):
# Manifest Altera Properties
self.quartus_preflow = None
self.quartus_postmodule = None
self.quartus_postflow = None
self.hw_tcl_filename = None
super(ModuleAltera, self).__init__()
def process_manifest(self):
"""Method that process the Altera section of the manifest_dict"""
self._process_manifest_altera()
super(ModuleAltera, self).process_manifest()
def _process_manifest_altera(self):
"""Method that checks if the TCL files declared by the module
manifest dictionary exists and if so create them and
initialize the appropriated variables in the Module instance"""
from hdlmake.srcfile import TCLFile
if self.manifest_dict["quartus_preflow"] != None:
path = path_mod.rel2abs(
self.manifest_dict["quartus_preflow"], self.path)
if not os.path.exists(path):
logging.error("quartus_preflow file listed in " + self.path +
" doesn't exist: " + path + ".\nExiting.")
quit()
self.quartus_preflow = TCLFile(path)
if self.manifest_dict["quartus_postmodule"] != None:
path = path_mod.rel2abs(self.manifest_dict["quartus_postmodule"],
self.path)
if not os.path.exists(path):
logging.error("quartus_postmodule file listed in " + self.path +
" doesn't exist: " + path + ".\nExiting.")
quit()
self.quartus_postmodule = TCLFile(path)
if self.manifest_dict["quartus_postflow"] != None:
path = path_mod.rel2abs(self.manifest_dict["quartus_postflow"],
self.path)
if not os.path.exists(path):
logging.error("quartus_postflow file listed in " + self.path +
" doesn't exist: " + path + ".\nExiting.")
quit()
self.quartus_postflow = TCLFile(path)
if "hw_tcl_filename" in self.manifest_dict:
self.hw_tcl_filename = self.manifest_dict["hw_tcl_filename"]
...@@ -33,7 +33,7 @@ import logging ...@@ -33,7 +33,7 @@ import logging
from hdlmake.util import path as path_mod from hdlmake.util import path as path_mod
from hdlmake.manifest_parser import ManifestParser from hdlmake.manifest_parser import ManifestParser
from hdlmake.module import ModuleContent, ModuleAltera from hdlmake.module import ModuleContent
class ModuleArgs(object): class ModuleArgs(object):
...@@ -56,7 +56,7 @@ class ModuleArgs(object): ...@@ -56,7 +56,7 @@ class ModuleArgs(object):
return self.parent, self.url, self.source, self.fetchto return self.parent, self.url, self.source, self.fetchto
class Module(ModuleContent, ModuleAltera): class Module(ModuleContent):
""" """
This is the class providing the HDLMake module, the basic element This is the class providing the HDLMake module, the basic element
providing the modular behavior allowing for structured designs. providing the modular behavior allowing for structured designs.
......
...@@ -141,11 +141,45 @@ mrproper: ...@@ -141,11 +141,45 @@ mrproper:
def _set_tcl_files(self, mod):
"""Method that checks if the TCL files declared by the module
manifest dictionary exists and if so create them and
initialize the appropriated variables in the Module instance"""
from hdlmake.srcfile import TCLFile
if mod.manifest_dict["quartus_preflow"] != None:
path = path_mod.compose(
mod.manifest_dict["quartus_preflow"], mod.path)
if not os.path.exists(path):
logging.error("quartus_preflow file listed in " + mod.path +
" doesn't exist: " + path + ".\nExiting.")
quit()
self.preflow = TCLFile(path)
if mod.manifest_dict["quartus_postmodule"] != None:
path = path_mod.compose(
mod.manifest_dict["quartus_postmodule"], mod.path)
if not os.path.exists(path):
logging.error("quartus_postmodule file listed in " + mod.path +
" doesn't exist: " + path + ".\nExiting.")
quit()
self.postmodule = TCLFile(path)
if mod.manifest_dict["quartus_postflow"] != None:
path = path_mod.compose(
mod.manifest_dict["quartus_postflow"], mod.path)
if not os.path.exists(path):
logging.error("quartus_postflow file listed in " + mod.path +
" doesn't exist: " + path + ".\nExiting.")
quit()
self.postflow = TCLFile(path)
def generate_synthesis_project(self, update=False, tool_version='', top_mod=None, fileset=None): def generate_synthesis_project(self, update=False, tool_version='', top_mod=None, fileset=None):
self.properties = [] self.properties = []
self.files = [] self.files = []
self.filename = top_mod.manifest_dict["syn_project"] self.filename = top_mod.manifest_dict["syn_project"]
self.preflow = top_mod.quartus_preflow self._set_tcl_files(top_mod)
self.postmodule = top_mod.quartus_postmodule self.postmodule = top_mod.quartus_postmodule
self.postflow = top_mod.quartus_postflow self.postflow = top_mod.quartus_postflow
......
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