soc/cores/video/VideoFramebuffer: Add VTG/DMA synchronization when DMA is enabled to simplify use.

This commit is contained in:
Florent Kermarrec 2023-10-06 10:10:22 +02:00
parent 98eb27df52
commit cd8218779e
2 changed files with 21 additions and 3 deletions

View File

@ -9,6 +9,7 @@
cpu/neorv32 : Added Debug support and update core complex. cpu/neorv32 : Added Debug support and update core complex.
cpu/vexriscv_smp : Added hardware breakpoints support. cpu/vexriscv_smp : Added hardware breakpoints support.
build/colognechip : Added initial support. build/colognechip : Added initial support.
soc/cores/video : Added VTG/DMA synchronization stage to VideoFramebuffer.
[> Changed [> Changed
---------- ----------

View File

@ -692,8 +692,25 @@ class VideoFrameBuffer(LiteXModule):
] ]
video_pipe_source = self.cdc.source video_pipe_source = self.cdc.source
# Video Generation. # Video Synchronization/Generation.
self.comb += [ fsm = FSM(reset_state="VTG-SYNC")
fsm = ClockDomainsRenamer(clock_domain)(fsm)
fsm = ResetInserter()(fsm)
self.submodules += fsm
self.specials += MultiReg(self.dma.fsm.reset, fsm.reset, clock_domain)
fsm.act("VTG-SYNC",
vtg_sink.ready.eq(1),
If(vtg_sink.valid & vtg_sink.last,
NextState("DMA-SYNC")
)
)
fsm.act("DMA-SYNC",
video_pipe_source.ready.eq(1),
If(video_pipe_source.valid & video_pipe_source.last,
NextState("RUN")
)
)
fsm.act("RUN",
vtg_sink.ready.eq(1), vtg_sink.ready.eq(1),
If(vtg_sink.valid & vtg_sink.de, If(vtg_sink.valid & vtg_sink.de,
video_pipe_source.connect(source, keep={"valid", "ready"}), video_pipe_source.connect(source, keep={"valid", "ready"}),
@ -701,7 +718,7 @@ class VideoFrameBuffer(LiteXModule):
), ),
vtg_sink.connect(source, keep={"de", "hsync", "vsync"}), vtg_sink.connect(source, keep={"de", "hsync", "vsync"}),
] )
if (depth == 32): if (depth == 32):
self.comb += [ self.comb += [
source.r.eq(video_pipe_source.data[ 0: 8]), source.r.eq(video_pipe_source.data[ 0: 8]),