Some code style change and minor issues solved

parent cd97a8be
......@@ -22,6 +22,8 @@
"""The Action package provides the full set of provided user functionalities"""
from .action import Action
from .check import ActionCheck
from .core import ActionCore
from .tree import ActionTree
......@@ -30,4 +32,3 @@ from .synthesis import ActionSynthesis
from .simulation import ActionSimulation
from .qsys_hw_tcl_update import QsysHwTclUpdate
from .action import Action
......@@ -25,7 +25,6 @@
from __future__ import print_function
import os
import logging
import platform
from subprocess import PIPE, Popen
import sys
......
......@@ -53,8 +53,9 @@ class ActionCore(Action):
def clean(self):
"""Delete the local copy of the fetched modules"""
logging.info("Removing fetched modules..")
remove_list = [mod_aux for mod_aux in self if
mod_aux.source in [fetch.GIT, fetch.SVN] and mod_aux.isfetched]
remove_list = [mod_aux for mod_aux in self
if mod_aux.source in [fetch.GIT, fetch.SVN]
and mod_aux.isfetched]
remove_list.reverse() # we will remove modules in backward order
if len(remove_list):
for mod_aux in remove_list:
......
......@@ -33,9 +33,9 @@ from hdlmake.tools import (
ToolIVerilog, ToolISim, ToolModelsim,
ToolActiveHDL, ToolRiviera, ToolGHDL)
from .action import Action
class ActionSimulation(Action):
class ActionSimulation(
ToolIVerilog, ToolISim, ToolModelsim,
ToolActiveHDL, ToolRiviera, ToolGHDL):
"""This class contains the simulation specific methods"""
......
......@@ -25,7 +25,6 @@
from __future__ import print_function
import logging
import sys
import os
from hdlmake.srcfile import SourceFileFactory
from hdlmake.util import path
......@@ -34,9 +33,9 @@ from hdlmake.tools import (
ToolISE, ToolPlanAhead, ToolVivado,
ToolQuartus, ToolDiamond, ToolLibero)
from .action import Action
class ActionSynthesis(Action):
class ActionSynthesis(ToolISE, ToolPlanAhead, ToolVivado,
ToolQuartus, ToolDiamond, ToolLibero):
"""Class providing the public synthesis methods for the user"""
......@@ -67,7 +66,6 @@ class ActionSynthesis(Action):
from string import Template
from datetime import date
import getpass
today = date.today()
date_string = today.strftime("%Y%m%d")
template = Template("""library ieee;
......@@ -106,7 +104,6 @@ end sdb_meta_pkg;
package body sdb_meta_pkg is
end sdb_meta_pkg;""")
project_vhd = open("project.vhd", 'w')
date_std_logic_vector = []
import re
......@@ -118,7 +115,6 @@ end sdb_meta_pkg;""")
syn_tool_std_logic_vector = []
for digit in syn_tool_version:
syn_tool_std_logic_vector.append("{0:04b}".format(int(digit)))
template.substitute(
repo_url=self.top_module.url,
syn_module_name=self.top_module.manifest_dict["syn_top"],
......@@ -164,24 +160,18 @@ end sdb_meta_pkg;""")
tool_object = self._load_synthesis_tool()
tool_info = tool_object.TOOL_INFO
tool_ctrl = tool_object.TCL_CONTROLS
path_key = tool_info['id'] + '_path'
version_key = tool_info['id'] + '_version'
name = tool_info['name']
id_value = tool_info['id']
ext_value = tool_info['project_ext']
env = self.env
env.check_general()
env.check_tool(tool_object)
top_module = self.get_top_module()
if env[path_key]:
tool_path = env[path_key]
else:
tool_path = ""
if not self.env.options.force:
if self.env[path_key] is None:
logging.error("Can't generate the " + name + " project. "
......@@ -194,19 +184,8 @@ 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.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:
logging.info("No previous project: creating a new one...")
update = False
top_mod = self.get_top_module()
fileset = self.build_file_set(top_mod.manifest_dict["syn_top"])
sup_files = self.build_complete_file_set()
privative_files = []
for file_aux in sup_files:
......@@ -217,14 +196,12 @@ end sdb_meta_pkg;""")
logging.info("Detected %d supported files that are not parseable",
len(privative_files))
fileset.add(privative_files)
sff = SourceFileFactory()
if self.env.options.generate_project_vhd:
self._write_project_vhd(id_value, env[version_key])
fileset.add([sff.new(path=path.rel2abs("project.vhd"),
module=self.get_module_by_path("."))])
tool_object._print_incl_makefiles(top_module)
tool_object.makefile_includes(top_module)
tool_object.makefile_syn_top(top_module, tool_path)
tool_object.makefile_syn_tcl(top_module)
tool_object.makefile_syn_files(fileset)
......
......@@ -96,8 +96,8 @@ sim_post_cmd:
def makefile_sim_clean(self):
"""Generic method to write the simulation Makefile user clean target"""
self._print_tool_clean()
self._print_tool_mrproper()
self.makefile_clean()
self.makefile_mrproper()
def makefile_sim_phony(self, top_module):
"""Print simulation PHONY target list to the Makefile"""
......
......@@ -213,12 +213,12 @@ syn_post_bitstream_cmd:
def makefile_syn_clean(self):
"""Print the Makefile clean target for synthesis"""
self._print_tool_clean()
self.makefile_clean()
self.writeln("\t\t" + path_mod.del_command() +
" synthesize translate map par bitstream")
self.writeln("\t\t" + path_mod.del_command() +
" tcl_synthesize tcl_translate tcl_map tcl_par tcl_bitstream")
self._print_tool_mrproper()
self.makefile_mrproper()
def makefile_syn_phony(self):
"""Print synthesis PHONY target list to the Makefile"""
......
......@@ -26,13 +26,14 @@
import os
from hdlmake.util import path as path_mod
from hdlmake.action import Action
class ToolMakefile(object):
class ToolMakefile(Action):
"""Class that provides the Makefile writing methods and status"""
def __init__(self, filename=None):
super(ToolMakefile, self).__init__()
self._file = None
self._initialized = False
self._tool_info = {}
......@@ -49,13 +50,13 @@ class ToolMakefile(object):
if self._file:
self._file.close()
def _print_incl_makefiles(self, top_module):
def makefile_includes(self, top_module):
"""Add the included makefiles that need to be previously loaded"""
for file_aux in top_module.incl_makefiles:
if os.path.exists(file_aux):
self.write("include %s\n" % file_aux)
def _print_tool_clean(self):
def makefile_clean(self):
"""Print the Makefile target for cleaning intermediate files"""
self.writeln("#target for cleaning intermediate files")
self.writeln("clean:")
......@@ -63,7 +64,7 @@ class ToolMakefile(object):
" $(LIBS) " + ' '.join(self._clean_targets["clean"])
self.writeln(tmp)
def _print_tool_mrproper(self):
def makefile_mrproper(self):
"""Print the Makefile target for cleaning final files"""
self.writeln("#target for cleaning final files")
self.writeln("mrproper: clean")
......
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