--- nand.py- +++ nand.py @@ -226,8 +226,10 @@ def __init__(self, parent, n, name='nand_n', latency=10): Obj.__init__(self, parent, name) self.n = n + new_pin_n( n, self, 'inp' ) AND_N(self, n, 'and_n', latency) - new_pin_conn(self, self.and_n, 0) + conn2_n( n, (self, 'inp', 0), (self.and_n, 'inp', 0) ) + NOT(self, 'not_', latency) self.and_n.out.conn = self.not_.inp self.not_.out.conn = Pin(self, 'out') @@ -237,8 +239,10 @@ def __init__(self, parent, n, name='nor_n', latency=10): Obj.__init__(self, parent, name) self.n = n + new_pin_n( n, self, 'inp' ) OR_N(self, n, 'or_n', latency) - new_pin_conn(self, self.or_n, 0) + conn2_n( n, (self, 'inp', 0), (self.or_n, 'inp', 0) ) + NOT(self, 'not_', latency) self.or_n.out.conn = self.not_.inp self.not_.out.conn = Pin(self, 'out') @@ -911,13 +915,6 @@ x += step if direc != 'y' else 0 y += step if direc == 'y' else 0 return (x, y) - -def new_pin_conn(obj, in_obj, sta_i, n=-1, name='inp', direc='to_in_obj'): - if n < 0: - n = in_obj.n - new_pin_n(n, obj, name, sta_i) - direc_rev = (direc != 'to_in_obj') - conn2_n(n, (obj, name, sta_i), (in_obj, name, 0), direc_rev) def conn2_n( n, (from_obj, from_name, from_sta_i), (to_obj, to_name, to_sta_i), direc_rev=False ): # replaced args, only ...