From: Jock Tanner Date: Mon, 6 Apr 2020 03:48:13 +0000 (+0000) Subject: Implement automatic AB. X-Git-Tag: partial-core-ls180-gdsii~151 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=52eb8fffac4bc8c4bfc9fa236e37b8553c4d51a1;p=soclayout.git Implement automatic AB. --- diff --git a/experiments7/doAlu16.py b/experiments7/doAlu16.py index 1c1b616..5116f67 100755 --- a/experiments7/doAlu16.py +++ b/experiments7/doAlu16.py @@ -47,7 +47,7 @@ class AddSub(Module): """ Main routine. """ with SessionManager(): - self.init_abutment_box() + self.compute_ab() self.create_pins() if self.editor: @@ -75,7 +75,7 @@ class ALU16(Module): return False with SessionManager(): - self.init_abutment_box() + self.init_ab() self.place_submodules() # TODO: replace with some form of lazy evaluation? @@ -99,7 +99,7 @@ class ALU16(Module): # then route (globally) # this connects up not just in the remaining (little) cells, # it connects *to add and sub and the outside world as well* - self.init_abutment_box() + self.init_ab() result = self.place_and_route() self.save() @@ -110,7 +110,7 @@ def ScriptMain(editor=None, **kwargs): coriolis_setup() add = AddSub( - 'add', editor, width=350.0, height=400.0, + 'add', editor, north_pins=[ {'net': 'a({})', 'x': 10.0, 'delta': 20.0, 'repeat': BIT_WIDTH}, {'net': 'b({})', 'x': 20.0, 'delta': 20.0, 'repeat': BIT_WIDTH}, @@ -125,7 +125,7 @@ def ScriptMain(editor=None, **kwargs): }, ) sub = AddSub( - 'sub', editor, width=350.0, height=400.0, + 'sub', editor, north_pins=[ {'net': 'a({})', 'x': 10.0, 'delta': 20.0, 'repeat': BIT_WIDTH}, {'net': 'b({})', 'x': 20.0, 'delta': 20.0, 'repeat': BIT_WIDTH}, diff --git a/experiments7/utils.py b/experiments7/utils.py index 60057f6..af4368d 100644 --- a/experiments7/utils.py +++ b/experiments7/utils.py @@ -135,6 +135,12 @@ class Module(object): """ return DbU.toLambda(dbu) + def compute_ab(self): + """ Compute default abutment box without placement. """ + etesian = Etesian.EtesianEngine.create(self.cell) + etesian.setDefaultAb() + etesian.destroy() + def place(self): """ Places the current cell. """ etesian = Etesian.EtesianEngine.create(self.cell) @@ -190,7 +196,11 @@ class Module(object): if isinstance(repeat, int): if repeat > 1 and delta == 0.0: - raise Warning('You are trying to place pins on each other.') + raise Warning( + '{}: you are trying to place pins on each other.'.format( + self.name + ) + ) iterator = range(repeat) else: iterator = repeat @@ -215,10 +225,14 @@ class Module(object): return x, y - def init_abutment_box(self): + def init_ab(self): """ Create the abutment box with object's initial values. """ - - self.ab = Box(0, 0, self.to_dbu(self.width), self.to_dbu(self.height)) + if self.width and self.height: + self.ab = Box( + 0, 0, self.to_dbu(self.width), self.to_dbu(self.height) + ) + else: + raise Warning('{}: Module size is not set.'.format(self.name)) def create_pins(self): """ Creates all pins set on Module object creation. """ @@ -317,6 +331,7 @@ class Module(object): raise NotImplementedError('You need to implement the `build` method.') + class Config: def __init__(self, priority=None):