diff --git a/litex/soc/cores/video.py b/litex/soc/cores/video.py index 9d2c7b9c2..405c8c153 100644 --- a/litex/soc/cores/video.py +++ b/litex/soc/cores/video.py @@ -152,14 +152,17 @@ video_data_layout = [ class VideoTimingGenerator(Module, AutoCSR): def __init__(self, default_video_timings="800x600@60Hz"): - # Check / Get Video Timings. - try: - self.video_timings = vt = video_timings[default_video_timings] - except KeyError: - msg = [f"Video Timings {default_video_timings} not supported, availables:"] - for video_timing in video_timings.keys(): - msg.append(f" - {video_timing} / {video_timings[video_timing]['pix_clk']/1e6:3.2f}MHz.") - raise ValueError("\n".join(msg)) + # Check / Get Video Timings (can be str or dict) + if isinstance(default_video_timings, str): + try: + self.video_timings = vt = video_timings[default_video_timings] + except KeyError: + msg = [f"Video Timings {default_video_timings} not supported, availables:"] + for video_timing in video_timings.keys(): + msg.append(f" - {video_timing} / {video_timings[video_timing]['pix_clk']/1e6:3.2f}MHz.") + raise ValueError("\n".join(msg)) + else: + self.video_timings = vt = default_video_timings # MMAP Control/Status Registers. self._enable = CSRStorage(reset=1)