From: Luke Kenneth Casson Leighton Date: Tue, 21 Apr 2020 14:32:58 +0000 (+0000) Subject: logic/if tidyup X-Git-Tag: partial-core-ls180-gdsii~135 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=90c5353cacbe96ab816adf70ab114d5ef598d3a2;p=soclayout.git logic/if tidyup --- diff --git a/experiments7/doAlu16.py b/experiments7/doAlu16.py index 0eda61c..d6fa746 100755 --- a/experiments7/doAlu16.py +++ b/experiments7/doAlu16.py @@ -80,21 +80,22 @@ class ALU16(Module): :param plug_name: name of the plug to use to guess the bit index, :return: boolean, True if the instance has been matched. """ - matched = False + if not inst.getMasterCell().getName().startswith(op): + return False re_net_index = re.compile(r'[^(]+\((?P[\d]+)\)$') - if inst.getMasterCell().getName().startswith(op): - for plug in inst.getPlugs(): - if plug.getMasterNet().getName() == plug_name: - m = re_net_index.match(plug.getNet().getName()) - if m: - bit_slice = datapath_insts[int(m.group('index'))] - for column in bit_slice: - if column[0] == op: - column[1] = inst - matched = True - break - break - return matched + for plug in inst.getPlugs(): + if plug.getMasterNet().getName() != plug_name: + continue + m = re_net_index.match(plug.getNet().getName()) + if not m: + continue + bit_slice = datapath_insts[int(m.group('index'))] + for column in bit_slice: + if column[0] == op: + column[1] = inst + return True + break + return False def place_datapath(self, datapath_insts, x_orig, y_orig, fold): channel_sff1 = self.to_dbu(0) @@ -125,9 +126,10 @@ class ALU16(Module): datapath_insts.append([['nmx2', None], ['no2', None], ['sff1', None]]) for inst in self.cell.getInstances(): - if ALU16.match_instance(datapath_insts, 'nmx2', 'i0', inst): continue - if ALU16.match_instance(datapath_insts, 'no2', 'nq', inst): continue - if ALU16.match_instance(datapath_insts, 'sff1', 'i', inst): continue + if (ALU16.match_instance(datapath_insts, 'nmx2', 'i0', inst) or + ALU16.match_instance(datapath_insts, 'no2', 'nq', inst) or + ALU16.match_instance(datapath_insts, 'sff1', 'i', inst)): + continue # place to right of add add, sub = self.submodules