aboutsummaryrefslogtreecommitdiff
path: root/nmigen_boards/dev
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2019-06-12 15:06:18 +0000
committerwhitequark <whitequark@whitequark.org>2019-06-12 15:06:18 +0000
commit755ae9381bfa744ce326d59d972d06ad0dce4681 (patch)
tree6600cd872311ba9a117bfbb8001c45820a911943 /nmigen_boards/dev
parentbb52dfb9575c4aabf8e7dd9ddd780bf342ee0a71 (diff)
Use the new active-low PinsN platform feature.
Diffstat (limited to 'nmigen_boards/dev')
-rw-r--r--nmigen_boards/dev/flash.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/nmigen_boards/dev/flash.py b/nmigen_boards/dev/flash.py
index a4b5e33..0311789 100644
--- a/nmigen_boards/dev/flash.py
+++ b/nmigen_boards/dev/flash.py
@@ -4,33 +4,30 @@ from nmigen.build import *
__all__ = ["SPIFlashResources"]
-def SPIFlashResources(number, *, cs_n, clk, mosi, miso, wp_n=None, hold_n=None, attrs=None):
+def SPIFlashResources(number, *, cs, clk, mosi, miso, wp=None, hold=None, attrs=None):
resources = []
io_all = []
if attrs is not None:
io_all.append(attrs)
- io_all.append(Subsignal("cs_n", Pins(cs_n, dir="o")))
- io_all.append(Subsignal("clk", Pins(clk, dir="o")))
+ io_all.append(Subsignal("cs", PinsN(cs, dir="o")))
+ io_all.append(Subsignal("clk", Pins(clk, dir="o")))
io_1x = list(io_all)
io_1x.append(Subsignal("mosi", Pins(mosi, dir="o")))
io_1x.append(Subsignal("miso", Pins(miso, dir="i")))
- if wp_n is not None and hold_n is not None:
- # Tristate these pins by default, and rely on a pullup on the board or within the flash.
- # An alternative would be to define them as outputs with reset value of 1, but that's
- # not currently possible in nMigen.
- io_1x.append(Subsignal("wp_n", Pins(wp_n, dir="oe")))
- io_1x.append(Subsignal("hold_n", Pins(hold_n, dir="oe")))
+ if wp is not None and hold is not None:
+ io_1x.append(Subsignal("wp", PinsN(wp, dir="o")))
+ io_1x.append(Subsignal("hold", PinsN(hold, dir="o")))
resources.append(Resource("spiflash", number, *io_1x))
io_2x = list(io_all)
io_2x.append(Subsignal("dq", Pins(" ".join([mosi, miso]), dir="io")))
resources.append(Resource("spiflash2x", number, *io_2x))
- if wp_n is not None and hold_n is not None:
+ if wp is not None and hold is not None:
io_4x = list(io_all)
- io_4x.append(Subsignal("dq", Pins(" ".join([mosi, miso, wp_n, hold_n]), dir="io")))
+ io_4x.append(Subsignal("dq", Pins(" ".join([mosi, miso, wp, hold]), dir="io")))
resources.append(Resource("spiflash4x", number, *io_4x))
return resources