From c6a81b5a7683b80210aa10450c9d87b9c03b577c Mon Sep 17 00:00:00 2001 From: saji Date: Thu, 19 Sep 2024 14:32:02 -0500 Subject: [PATCH] initial coordinator --- src/groovylight/bitslicer.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/groovylight/bitslicer.py b/src/groovylight/bitslicer.py index 01d31e5..c122182 100644 --- a/src/groovylight/bitslicer.py +++ b/src/groovylight/bitslicer.py @@ -223,10 +223,40 @@ class Hub75Coordinator(wiring.Component): def __init__(self, n_strings=1): self.n_strings = n_strings - super().__init__() + super().__init__( + { + "ctrl": Out(Hub75Ctrl), + "data": data.ArrayLayout(Hub75Data, n_strings), + # TODO: fetching routine? maybe it's passed through. + } + ) def elaborate(self, platform: Platform) -> Module: m = Module() + # swapline is which buffer we are using vs sending out. + swapline = Signal(1) + + # for each string, spawn a swapbuffer + stringdriver and connect. + # don't worry about fetching for now. + self.strings = strings = [] + self.buffers = bufs = [] + donearr = [] + startStrings = Signal(1) + stringsDone = Signal(1) + for i in range(self.n_strings): + sb = SwapBuffer(depth=128, shape=data.ArrayLayout(Rgb666Layout, 2)) + bufs += sb + stringdriver = Hub75StringDriver(128) + strings += stringdriver + wiring.connect(m, sb.read_port, stringdriver.bram_port) + m.d.comb += [ + self.data[i].eq(stringdriver.display_out), + stringdriver.start.eq(startStrings), + sb.selector.eq(swapline), + ] + m.submodules += [sb, stringdriver] + donearr += stringdriver.done + m.d.comb += stringsDone.eq(Cat(*donearr).all()) return m