def PinsN(*args, **kwargs):
- pins = Pins(*args, **kwargs)
- pins.invert = True
- return pins
+ return Pins(*args, invert=True, **kwargs)
class DiffPairs:
- def __init__(self, p, n, *, dir="io", conn=None, assert_width=None):
+ def __init__(self, p, n, *, dir="io", invert=False, conn=None, assert_width=None):
self.p = Pins(p, dir=dir, conn=conn, assert_width=assert_width)
self.n = Pins(n, dir=dir, conn=conn, assert_width=assert_width)
.format(self.p, self.n))
self.dir = dir
- self.invert = False
+ self.invert = bool(invert)
def __len__(self):
return len(self.p.names)
def DiffPairsN(*args, **kwargs):
- diff_pairs = DiffPairs(*args, **kwargs)
- diff_pairs.invert = True
- return diff_pairs
+ return DiffPairs(*args, invert=True, **kwargs)
class Attrs(OrderedDict):
self.assertEqual(dp.n.names, ["B0"])
self.assertEqual(dp.invert, True)
+ def test_invert_arg(self):
+ dp = DiffPairs(p="A0", n="B0", invert=True)
+ self.assertEqual(dp.invert, True)
+
def test_conn(self):
dp = DiffPairs(p="0 1 2", n="3 4 5", conn=("pmod", 0))
self.assertEqual(list(dp), [