From c182f4db5f90fe75ad1dad7f9f775415dab3f828 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 30 Mar 2021 09:15:17 +0200 Subject: [PATCH] cores/video: Add check of Video Timings and list available ones when not supported. --- litex/soc/cores/video.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/litex/soc/cores/video.py b/litex/soc/cores/video.py index 065cdb83a..af3031868 100644 --- a/litex/soc/cores/video.py +++ b/litex/soc/cores/video.py @@ -141,7 +141,15 @@ video_data_layout = [ class VideoTimingGenerator(Module, AutoCSR): def __init__(self, default_video_timings="800x600@60Hz"): - vt = video_timings[default_video_timings] + # Check / Get Video Timings. + try: + 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)) + # MMAP Control/Status Registers. self._enable = CSRStorage(reset=1)