integration/soc/video: Allow passing timings as str or tuple (name, dict).

When passed as str, the timing dict will be extracted from litex.soc.cores.video.video_timings.
When passed as tuple, custom dict will be directly passed to VTG.
This commit is contained in:
Florent Kermarrec 2021-04-28 16:58:11 +02:00
parent c4e8e44cd9
commit bb355a773a
1 changed files with 5 additions and 3 deletions

View File

@ -1673,7 +1673,7 @@ class LiteXSoC(SoC):
# Video Timing Generator.
self.check_if_exists(f"{name}_vtg")
vtg = VideoTimingGenerator(default_video_timings=timings)
vtg = VideoTimingGenerator(default_video_timings=timings if isinstance(timings, str) else timings[1])
vtg = ClockDomainsRenamer(clock_domain)(vtg)
setattr(self.submodules, f"{name}_vtg", vtg)
@ -1695,11 +1695,12 @@ class LiteXSoC(SoC):
# Video Timing Generator.
self.check_if_exists(f"{name}_vtg")
vtg = VideoTimingGenerator(default_video_timings=timings)
vtg = VideoTimingGenerator(default_video_timings=timings if isinstance(timings, str) else timings[1])
vtg = ClockDomainsRenamer(clock_domain)(vtg)
setattr(self.submodules, f"{name}_vtg", vtg)
# Video Terminal.
timings = timings if isinstance(timings, str) else timings[0]
vt = VideoTerminal(
hres = int(timings.split("@")[0].split("x")[0]),
vres = int(timings.split("@")[0].split("x")[1]),
@ -1728,11 +1729,12 @@ class LiteXSoC(SoC):
from litex.soc.cores.video import VideoTimingGenerator, VideoFrameBuffer
# Video Timing Generator.
vtg = VideoTimingGenerator(default_video_timings=timings)
vtg = VideoTimingGenerator(default_video_timings=timings if isinstance(timings, str) else timings[1])
vtg = ClockDomainsRenamer(clock_domain)(vtg)
setattr(self.submodules, f"{name}_vtg", vtg)
# Video FrameBuffer.
timings = timings if isinstance(timings, str) else timings[0]
base = self.mem_map.get(name, 0x40c00000)
hres = int(timings.split("@")[0].split("x")[0])
vres = int(timings.split("@")[0].split("x")[1])