dev.display: factor out from dev.user. NFC.
authorwhitequark <whitequark@whitequark.org>
Thu, 3 Oct 2019 03:02:44 +0000 (03:02 +0000)
committerwhitequark <whitequark@whitequark.org>
Thu, 3 Oct 2019 03:02:44 +0000 (03:02 +0000)
nmigen_boards/dev/display.py [new file with mode: 0644]
nmigen_boards/dev/user.py
nmigen_boards/mercury.py

diff --git a/nmigen_boards/dev/display.py b/nmigen_boards/dev/display.py
new file mode 100644 (file)
index 0000000..0431b58
--- /dev/null
@@ -0,0 +1,20 @@
+from nmigen.build import *
+
+
+__all__ = ["Display7SegResource"]
+
+
+def Display7SegResource(*args, a, b, c, d, e, f, g, dp=None, invert=False, attrs=None):
+    ios = []
+    ios.append(Subsignal("a", Pins(a, dir="o", invert=invert, assert_width=1)))
+    ios.append(Subsignal("b", Pins(b, dir="o", invert=invert, assert_width=1)))
+    ios.append(Subsignal("c", Pins(c, dir="o", invert=invert, assert_width=1)))
+    ios.append(Subsignal("d", Pins(d, dir="o", invert=invert, assert_width=1)))
+    ios.append(Subsignal("e", Pins(e, dir="o", invert=invert, assert_width=1)))
+    ios.append(Subsignal("f", Pins(f, dir="o", invert=invert, assert_width=1)))
+    ios.append(Subsignal("g", Pins(g, dir="o", invert=invert, assert_width=1)))
+    if dp is not None:
+        ios.append(Subsignal("dp", Pins(dp, dir="o", assert_width=1)))
+    if attrs is not None:
+        ios.append(attrs)
+    return Resource.family(*args, default_name="display_7seg", ios=ios)
index 336595eaa7b648a8938ff179fe37af4dc7c318cc..8faa736dc72b4e1e5dbd44aaea1501edc37534ce 100644 (file)
@@ -1,10 +1,7 @@
 from nmigen.build import *
 
 
-__all__ = [
-    "LEDResources", "RGBLEDResource", "ButtonResources", "SwitchResources",
-    "Display7SegResource",
-]
+__all__ = ["LEDResources", "RGBLEDResource", "ButtonResources", "SwitchResources"]
 
 
 def _SplitResources(*args, pins, invert=False, attrs=None, default_name, dir):
@@ -44,19 +41,3 @@ def ButtonResources(*args, **kwargs):
 
 def SwitchResources(*args, **kwargs):
     return _SplitResources(*args, **kwargs, default_name="switch", dir="i")
-
-
-def Display7SegResource(*args, a, b, c, d, e, f, g, dp=None, invert=False, attrs=None):
-    ios = []
-    ios.append(Subsignal("a", Pins(a, dir="o", invert=invert, assert_width=1)))
-    ios.append(Subsignal("b", Pins(b, dir="o", invert=invert, assert_width=1)))
-    ios.append(Subsignal("c", Pins(c, dir="o", invert=invert, assert_width=1)))
-    ios.append(Subsignal("d", Pins(d, dir="o", invert=invert, assert_width=1)))
-    ios.append(Subsignal("e", Pins(e, dir="o", invert=invert, assert_width=1)))
-    ios.append(Subsignal("f", Pins(f, dir="o", invert=invert, assert_width=1)))
-    ios.append(Subsignal("g", Pins(g, dir="o", invert=invert, assert_width=1)))
-    if dp is not None:
-        ios.append(Subsignal("dp", Pins(dp, dir="o", assert_width=1)))
-    if attrs is not None:
-        ios.append(attrs)
-    return Resource.family(*args, default_name="display_7seg", ios=ios)
index 5395fba24433587b731bfe8da6bcf9cab5cc320e..ea562491baeff0c6d695fbfa778ef6329ce78126 100644 (file)
@@ -4,7 +4,7 @@ import subprocess
 from nmigen.build import *
 from nmigen.vendor.xilinx_spartan_3_6 import *
 from .dev import *
-from .dev.user import Display7SegResource
+from .dev.display import Display7SegResource
 
 
 __all__ = ["MercuryPlatform"]