generated from saji/ecp5-template
Compare commits
1 commit
dd47014029
...
8e046b442a
Author | SHA1 | Date | |
---|---|---|---|
saji | 8e046b442a |
|
@ -223,10 +223,40 @@ class Hub75Coordinator(wiring.Component):
|
||||||
|
|
||||||
def __init__(self, n_strings=1):
|
def __init__(self, n_strings=1):
|
||||||
self.n_strings = n_strings
|
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:
|
def elaborate(self, platform: Platform) -> Module:
|
||||||
m = 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
|
return m
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue