Skip to content

Commit

Permalink
soc/cores/video/VideoFramebuffer: Add VTG/DMA synchronization when DM…
Browse files Browse the repository at this point in the history
…A is enabled to simplify use.
  • Loading branch information
enjoy-digital committed Oct 6, 2023
1 parent 98eb27d commit cd82187
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
cpu/neorv32 : Added Debug support and update core complex.
cpu/vexriscv_smp : Added hardware breakpoints support.
build/colognechip : Added initial support.
soc/cores/video : Added VTG/DMA synchronization stage to VideoFramebuffer.

[> Changed
----------
Expand Down
23 changes: 20 additions & 3 deletions litex/soc/cores/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,16 +692,33 @@ def __init__(self, dram_port, hres=800, vres=600, base=0x00000000, fifo_depth=65
]
video_pipe_source = self.cdc.source

# Video Generation.
self.comb += [
# Video Synchronization/Generation.
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),
If(vtg_sink.valid & vtg_sink.de,
video_pipe_source.connect(source, keep={"valid", "ready"}),
vtg_sink.ready.eq(source.valid & source.ready),

),
vtg_sink.connect(source, keep={"de", "hsync", "vsync"}),
]
)
if (depth == 32):
self.comb += [
source.r.eq(video_pipe_source.data[ 0: 8]),
Expand Down

0 comments on commit cd82187

Please sign in to comment.