lib.io: add a name argument to the Pin constructor.
authorJean-François Nguyen <jf@lambdaconcept.com>
Wed, 24 Apr 2019 21:58:01 +0000 (23:58 +0200)
committerwhitequark <cz@m-labs.hk>
Wed, 24 Apr 2019 22:02:20 +0000 (22:02 +0000)
nmigen/lib/io.py

index e8f67f1cd28261d31284b0dcf7c46d41dd5b7c37..f77dde6f11e090a7aaa4fd41a7573a5d34f9f7a3 100644 (file)
@@ -65,6 +65,8 @@ class Pin(Record):
         are present instead, where ``N in range(0, N)``. For example, if ``xdr=2``, the I/O buffer
         is DDR; the signal ``i0`` reflects the value at the rising edge, and the signal ``i1``
         reflects the value at the falling edge.
+    name : str
+        Name of the underlying record.
 
     Attributes
     ----------
@@ -84,9 +86,9 @@ class Pin(Record):
         I/O buffer output enable. Present if ``dir="io"``. Buffers generally cannot change
         direction more than once per cycle, so at most one output enable signal is present.
     """
-    def __init__(self, width, dir, xdr=1):
+    def __init__(self, width, dir, xdr=1, name=None):
         self.width = width
         self.dir   = dir
         self.xdr   = xdr
 
-        super().__init__(pin_layout(self.width, self.dir, self.xdr))
+        super().__init__(pin_layout(self.width, self.dir, self.xdr), name=name)