Adding core method for loading a tool
Useful for testing and tool bringup
@@ -472,7 +472,7 @@ class Chip:
self.error = 1
##########################################################################
- def load_target(self, name=None):
+ def load_target(self, name):
"""
Loads a project module and runs the setup() function.
@@ -481,6 +481,7 @@ class Chip:
Args:
name (str): Module name
+ flow (str): Target flow to
Examples:
>>> chip.load_target('freepdk45_demo')
@@ -569,6 +570,42 @@ class Chip:
self.logger.error(f'Module {name} not found.')
sys.exit(1)
+ ##########################################################################
+ def load_tool(self, name, standalone=False):
+ """
+ Loads a tool module and runs the setup() function.
+
+ The function searches the $SCPATH for tools/<name>/<name>.py and runs
+ the setup function in that module if found.
+
+ Args:
+ name (str): Module name
+ flow
+
+ Examples:
+ >>> chip.lad_tool('openroad')
+ Loads the 'openroad' tool settings
+
+ """
+
+ # Set up a one step flow if flow is defined.
+ flow = self.get('flow')
+ step = self.get('arg', 'step')
+ if standalone:
+ self.set('flowgraph', flow, step, '0', 'tool', name)
+ self.set('flowgraph', flow, step, '0', 'weight', 'errors', 0)
+ self.set('flowgraph', flow, step, '0', 'weight', 'warnings', 0)
+ self.set('flowgraph', flow, step, '0', 'weight', 'runtime', 0)
+ if step != 'import':
+ self.set('flowgraph', flow, 'import', '0', 'tool', 'join')
+
+ #load the tool
+ func = self.find_function(name, 'setup', 'tools')
+ if func is not None:
+ func(self)
+ else:
+ self.logger.error(f'Module {name} not found.')
+ sys.exit(1)
###########################################################################
@@ -1678,6 +1715,9 @@ class Chip:
if not steplist:
steplist = self.list_steps()
+ if len(steplist) < 2:
+ return True
+
for step in steplist:
for index in self.getkeys('flowgraph', flow, step):
# For each task, check input requirements.
