cores/video: Add check of Video Timings and list available ones when not supported.

This commit is contained in:
Florent Kermarrec 2021-03-30 09:15:17 +02:00
parent 2ed5f14e9e
commit c182f4db5f
1 changed files with 9 additions and 1 deletions

View File

@ -141,7 +141,15 @@ video_data_layout = [
class VideoTimingGenerator(Module, AutoCSR): class VideoTimingGenerator(Module, AutoCSR):
def __init__(self, default_video_timings="800x600@60Hz"): 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. # MMAP Control/Status Registers.
self._enable = CSRStorage(reset=1) self._enable = CSRStorage(reset=1)