cores/video/VideoTimingGenerator: Allow passing custom dict as default_video_timings.
Allow only listing the classical video timings in the core and let user provide the timings specific to other configurations.
This commit is contained in:
parent
da1092d9c0
commit
c4e8e44cd9
|
@ -152,14 +152,17 @@ 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"):
|
||||||
# Check / Get Video Timings.
|
# Check / Get Video Timings (can be str or dict)
|
||||||
try:
|
if isinstance(default_video_timings, str):
|
||||||
self.video_timings = vt = video_timings[default_video_timings]
|
try:
|
||||||
except KeyError:
|
self.video_timings = vt = video_timings[default_video_timings]
|
||||||
msg = [f"Video Timings {default_video_timings} not supported, availables:"]
|
except KeyError:
|
||||||
for video_timing in video_timings.keys():
|
msg = [f"Video Timings {default_video_timings} not supported, availables:"]
|
||||||
msg.append(f" - {video_timing} / {video_timings[video_timing]['pix_clk']/1e6:3.2f}MHz.")
|
for video_timing in video_timings.keys():
|
||||||
raise ValueError("\n".join(msg))
|
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.
|
# MMAP Control/Status Registers.
|
||||||
self._enable = CSRStorage(reset=1)
|
self._enable = CSRStorage(reset=1)
|
||||||
|
|
Loading…
Reference in New Issue