Skip to content

Commit a6e660a

Browse files
committed
output a regular clock too for LA.
1 parent 7c1899e commit a6e660a

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

ili9341spi/rtl/__init__.py

+21-31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from amaranth import Module, Mux, Signal
1+
from amaranth import ClockSignal, Module, Mux, Signal
22
from amaranth.build import Attrs, Pins, PinsN, Resource, Subsignal
33
from amaranth.lib import wiring
44
from amaranth.lib.cdc import FFSynchronizer
@@ -16,41 +16,25 @@
1616
__all__ = ["Top"]
1717

1818

19-
icebreaker_spi_lcd = Resource(
20-
"spi_lcd",
21-
0,
22-
Subsignal(
23-
"clk", Pins("3", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")
24-
),
25-
Subsignal(
26-
"copi", Pins("4", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")
27-
),
28-
Subsignal(
29-
"res", PinsN("7", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")
30-
),
31-
Subsignal(
32-
"dc", PinsN("8", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")
33-
),
34-
Subsignal(
35-
"blk", Pins("9", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")
36-
),
37-
Subsignal(
38-
"cipo", Pins("10", dir="i", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")
39-
),
19+
icebreaker_spi_lcd = Resource("spi_lcd", 0,
20+
Subsignal("clk", Pins("3", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")),
21+
Subsignal("copi", Pins("4", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")),
22+
Subsignal("res", PinsN("7", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")),
23+
Subsignal("dc", PinsN("8", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")),
24+
Subsignal("blk", Pins("9", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")),
25+
Subsignal("cipo", Pins("10", dir="i", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")),
4026
)
4127

4228

4329
class Top(wiring.Component):
4430
def __init__(self, platform):
4531
if isinstance(platform, cxxrtl):
46-
super().__init__(
47-
{
48-
"lcd": Out(Lcd.PinSignature),
49-
"lcd_res": Out(1),
50-
"uart_rx": In(1),
51-
"uart_tx": Out(1),
52-
}
53-
)
32+
super().__init__({
33+
"lcd": Out(Lcd.PinSignature),
34+
"lcd_res": Out(1),
35+
"uart_rx": In(1),
36+
"uart_tx": Out(1),
37+
})
5438
else:
5539
super().__init__({})
5640

@@ -102,7 +86,8 @@ def elaborate(self, platform):
10286
"\n", ""
10387
)
10488

105-
m.submodules.now_cells = now_cells = Memory(shape=1, depth=GOL_CELLCNT, init=[c != "." for c in start])
89+
m.submodules.now_cells = now_cells = \
90+
Memory(shape=1, depth=GOL_CELLCNT, init=[c != "." for c in start])
10691
now_cells_rd = now_cells.read_port()
10792
now_cells_wr = now_cells.write_port()
10893
now_cells_addr = Signal.like(now_cells_rd.addr)
@@ -305,6 +290,11 @@ def cell_ix_at(x, y):
305290
ili.cipo.eq(plat_spi.cipo.i),
306291
]
307292

293+
platform.add_resources([Resource("pmod_clk_out", 0,
294+
Subsignal("clk", Pins("1", dir="o", conn=("pmod", 0)), Attrs(IO_STANDARD="SB_LVCMOS")),
295+
)])
296+
m.d.comb += platform.request("pmod_clk_out").clk.o.eq(ClockSignal("sync"))
297+
308298
plat_uart = platform.request("uart")
309299
m.d.comb += plat_uart.tx.o.eq(serial.tx.o)
310300
m.submodules += FFSynchronizer(plat_uart.rx.i, serial.rx.i, init=1)

ili9341spi/targets.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99

1010
class icebreaker(ICEBreakerPlatform):
11-
if not os.getenv("GITHUB_ACTIONS"):
11+
if False: # XXX: testing DDR SPI and this would make us run probably-too-fast for the LCD>
12+
# if not os.getenv("GITHUB_ACTIONS"):
1213
# XXX: This meets timing when I build locally, but not on CI?!
1314
# https://github.com/kivikakk/ili9341spi/actions/runs/9535281535/job/26280812013?pr=1
1415
default_clk = "SB_HFOSC"

0 commit comments

Comments
 (0)