From: Jock Tanner Date: Thu, 26 Mar 2020 20:06:35 +0000 (+0000) Subject: Rename the main method. X-Git-Tag: partial-core-ls180-gdsii~154 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=71fecfb0524d3b2d5438b407f2e6d1a7acc7eb6c;p=soclayout.git Rename the main method. --- diff --git a/experiments7/doAlu16.py b/experiments7/doAlu16.py index 9da6180..ea376c7 100755 --- a/experiments7/doAlu16.py +++ b/experiments7/doAlu16.py @@ -6,7 +6,6 @@ import sys import CRL import Cfg from Hurricane import Box -from plugins import RSavePlugin from coriolis2.settings import af from utils import Module, SessionManager @@ -46,7 +45,7 @@ def coriolis_setup(): class AddSub(Module): - def do(self): + def build(self): """ Main routine. """ with SessionManager(): @@ -61,15 +60,20 @@ class AddSub(Module): with SessionManager(): self.create_pads() - RSavePlugin.ScriptMain(editor=self.editor, cell=self.cell) + self.save() return result class ALU16(Module): - def do(self): + def save(self): + self.name = self.name + '_r' + self.af.saveCell(self.cell, CRL.Catalog.State.Views) + super(ALU16, self).save() + + def build(self): - if not self.do_submodules(): + if not self.build_submodules(): return False with SessionManager(): @@ -100,10 +104,7 @@ class ALU16(Module): self.init_abutment_box() result = self.place_and_route() - self.name = self.name + '_r' - self.af.saveCell(self.cell, CRL.Catalog.State.Views) - RSavePlugin.ScriptMain(editor=self.editor, cell=self.cell) - + self.save() return result @@ -156,7 +157,7 @@ def ScriptMain(editor=None, **kwargs): {'net': 'rst', 'y': 140.0, 'layer': 'METAL2'}, ], ) - return alu16.do() + return alu16.build() if __name__ == '__main__': diff --git a/experiments7/utils.py b/experiments7/utils.py index 82f6879..13b7e1b 100644 --- a/experiments7/utils.py +++ b/experiments7/utils.py @@ -9,6 +9,7 @@ from Hurricane import ( DbU, DataBase, UpdateSession, Box, Transformation, Instance, Pad, Pin, NetExternalComponents, ) +from plugins import RSavePlugin class SessionManager(object): @@ -161,7 +162,7 @@ class Module(object): x=None, y=None, width=2.0, height=2.0, repeat=1, delta=0.0, external=True): """ - Creates a series of pins in a cell. + Creates a pin or a series of pins in a cell. :param net: Hurricane.Net object name or name template, taking a pin enumeration parameter, i. e. pin number, @@ -276,7 +277,7 @@ class Module(object): for net, layers in self.pads.items(): self.create_pads_for_net(net, layers) - def do_submodules(self): + def build_submodules(self): """ Execute submodules and gather their status. @@ -284,7 +285,7 @@ class Module(object): """ for submodule, x, y in self.submodules: - if not submodule.do(): + if not submodule.build(): return False return True @@ -306,7 +307,11 @@ class Module(object): )) instance.setPlacementStatus(Instance.PlacementStatus.FIXED) - def do(self): + def save(self): + """ Saves cell. """ + RSavePlugin.ScriptMain(editor=self.editor, cell=self.cell) + + def build(self): """ Main routine. """ - raise NotImplementedError('You need to implement the `do` method.') + raise NotImplementedError('You need to implement the `build` method.')