def drawAnd(term, x, y, coords, d): mults = sorted(list(set(term.split('&')))) n = [] for i in range(len(mults)): if mults[i][0] == '!': n.append(i + 1) gate = d.add(l.andgate(inputs=len(mults), inputnots=n), d='right', xy=[x, y]) st = 1 dict = {} print(mults) for elem in mults: dict[elem] = 'gate.in' + str(st) st += 1 for elem in mults: if elem[0] == '!': g_x = coords[elem[1:]].start[0] else: g_x = coords[elem].start[0] d.add(e.LINE, xy=eval(dict[elem]), tox=g_x, d='left') d.add(e.DOT)
def drawAnd(self, coords): y_coord = self.get_y(coords) nots = self.get_nots(coords) gate = self.d.add(l.andgate( inputs=len(coords), inputnots=nots), xy=[self.x, y_coord], d='right') count = 1 dict = {} for elem in coords: dict[elem] = 'gate.in' + str(count) count += 1 self.drawConnect(coords, dict, gate) return gate.out
def drawAnd(coords, x, y, d): gate = d.add( l.andgate(inputs=len(coords)), xy=[ x, (list(coords.values())[0][1] + list(coords.values())[-1][1]) / 2 ], d='right') count = 1 dict = {} for elem in coords: dict[elem] = 'gate.in' + str(count) count += 1 for elem in coords: d.add(e.LINE, xy=eval(dict[elem]), tox=coords[elem][0], d='left') d.add(e.DOT) return gate.out
def implicant_to_gate(self): return logic.andgate(inputs=self.nr_inputs())
def implicant_to_gate(self): return logic.andgate(inputs=self.nr_inputs(), inputnots=self.get_idxs_of_negated())