Skip to content

Commit 475ee87

Browse files
committed
Fix to do everything modern CSR way
1 parent da9f5a7 commit 475ee87

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

amaranth_orchard/base/gpio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class DI(csr.Register, access="r"):
5151
def __init__(self, width):
5252
super().__init__({"pins": csr.Field(csr.action.R, unsigned(width))})
5353

54-
"""Simple GPIO peripheral.
55-
56-
All pins default to input at power up.
57-
"""
5854
def __init__(self, *, pins):
55+
"""Simple GPIO peripheral.
56+
57+
All pins default to input at power up.
58+
"""
5959
if len(pins.o) > 32:
6060
raise ValueError(f"Pin width must be lesser than or equal to 32, not {len(pins.o)}")
6161

amaranth_orchard/memory/spimemio.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(self, mem_name=("mem",), cfg_name=("cfg",), *, flash):
6262
size_words = (self.size * 8) // 32
6363

6464
super().__init__({
65+
"qspi": Out(QSPIPins.Signature()),
6566
"ctrl_bus": In(csr.Signature(addr_width=exact_log2(4), data_width=8)),
6667
"data_bus": In(wishbone.Signature(addr_width=exact_log2(size_words), data_width=32,
6768
granularity=8)),
@@ -91,17 +92,17 @@ def elaborate(self, platform):
9192
"o_ready": spi_ready,
9293
"i_addr": Cat(Const(0, 2), self.data_bus.adr), # Hack to force a 1MB offset
9394
"o_rdata": self.data_bus.dat_r,
94-
"o_flash_csb": self.flash.csn.o,
95-
"o_flash_clk": self.flash.clk.o,
95+
"o_flash_csb": self.qspi.csn.o,
96+
"o_flash_clk": self.qspi.clk.o,
9697
"i_cfgreg_we": ctrl_bridge.cfgreg_we,
9798
"i_cfgreg_di": ctrl_bridge.cfgreg_di,
9899
"o_cfgreg_do": ctrl_bridge.cfgreg_do,
99100
} | {
100-
f"o_flash_io{n}_oe": getattr(self.flash, f"d{n}").oe for n in range(4)
101+
f"o_flash_io{n}_oe": getattr(self.qspi, f"d{n}").oe for n in range(4)
101102
} | {
102-
f"o_flash_io{n}_o": getattr(self.flash, f"d{n}").o for n in range(4)
103+
f"o_flash_io{n}_o": getattr(self.qspi, f"d{n}").o for n in range(4)
103104
} | {
104-
f"o_flash_io{n}_i": getattr(self.flash, f"d{n}").i for n in range(4)
105+
f"o_flash_io{n}_i": getattr(self.qspi, f"d{n}").i for n in range(4)
105106
}
106107

107108
m.submodules.spimemio = Instance("spimemio", **verilog_map)

0 commit comments

Comments
 (0)