Load the appropriated tool when the pool is created

parent 484d5d34
......@@ -28,6 +28,7 @@ import os
import logging
import sys
from hdlmake.tools import load_syn_tool, load_sim_tool
from hdlmake import shell
from hdlmake.util.termcolor import colored
from hdlmake import new_dep_solver as dep_solver
......@@ -72,6 +73,16 @@ class Action(list):
source=fetch_mod.LOCAL,
fetchto=".")
self.config = self._get_config_dict()
action = self.config.get("action")
if action == None:
self.tool = None
elif action == "simulation":
self.tool = load_sim_tool(self.config.get("sim_tool"))
elif action == "synthesis":
self.tool = load_syn_tool(self.config.get("syn_tool"))
else:
logging.error("Unknown requested action: %s", action)
quit()
def new_module(self, parent, url, source, fetchto):
"""Add new module to the pool.
......
......@@ -28,7 +28,6 @@ import os
import sys
import os.path
from hdlmake.tools import load_syn_tool, load_sim_tool
import hdlmake.fetch as fetch
import hdlmake.new_dep_solver as dep_solver
from hdlmake.util import path as path_mod
......@@ -62,16 +61,7 @@ class ActionCore(Action):
def makefile(self):
"""Write the Makefile for the current design"""
self._check_all_fetched_or_quit()
action = self.config.get("action")
if action == "simulation":
sim_writer = load_sim_tool(self.config.get("sim_tool"))
sim_writer.simulation_makefile(self)
elif action == "synthesis":
syn_writer = load_syn_tool(self.config.get("syn_tool"))
syn_writer.synthesis_makefile(self)
else:
logging.error("Unknown requested action: %s", action)
quit()
self.tool.write_makefile(self)
def _fetch_all(self):
"""Fetch all the modules declared in the design"""
......
......@@ -30,7 +30,7 @@ class ToolSim(ToolMakefile):
super(ToolSim, self).__init__()
self._simulator_controls = {}
def simulation_makefile(self, pool):
def write_makefile(self, pool):
"""Execute the simulation action"""
_check_simulation_manifest(pool.config)
fset = pool.build_file_set(
......
......@@ -39,7 +39,7 @@ class ToolSyn(ToolMakefile):
def __init__(self):
super(ToolSyn, self).__init__()
def synthesis_makefile(self, pool):
def write_makefile(self, pool):
"""Generate a Makefile for the specific synthesis tool"""
_check_synthesis_manifest(pool.config)
fileset = pool.build_file_set(
......
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