genlib.io: import TSTriple from Migen.
authorwhitequark <cz@m-labs.hk>
Fri, 14 Dec 2018 16:09:26 +0000 (16:09 +0000)
committerwhitequark <cz@m-labs.hk>
Fri, 14 Dec 2018 16:09:51 +0000 (16:09 +0000)
nmigen/genlib/io.py [new file with mode: 0644]

diff --git a/nmigen/genlib/io.py b/nmigen/genlib/io.py
new file mode 100644 (file)
index 0000000..b308b10
--- /dev/null
@@ -0,0 +1,21 @@
+from ..fhdl import *
+
+
+__all__ = ["TSTriple"]
+
+
+class TSTriple:
+    def __init__(self, shape=None, min=None, max=None, reset_o=0, reset_oe=0, reset_i=0,
+                 name=None):
+        self.o  = Signal(shape, min=min, max=max, reset=reset_o,
+                         name=None if name is None else name + "_o")
+        self.oe = Signal(reset=reset_oe,
+                         name=None if name is None else name + "_oe")
+        self.i  = Signal(shape, min=min, max=max, reset=reset_i,
+                         name=None if name is None else name + "_i")
+
+    def __len__(self):
+        return len(self.o)
+
+    def get_fragment(self, platform):
+        return Fragment()