Skip to content

Commit

Permalink
fix design clock validation
Browse files Browse the repository at this point in the history
  • Loading branch information
kammoh committed Jun 9, 2024
1 parent 0da934d commit 148ddba
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/xeda/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,24 @@ def rtl_settings_validate(cls, values): # pylint: disable=no-self-argument
clock_port = values.get("clock_port")
clocks = values.get("clocks")

def conv_clock(clock):
if isinstance(clock, dict):
clock = Clock(**clock)
elif isinstance(clock, str):
clock = Clock(port=clock_port)
return clock

if clocks is None:
clocks = {}
elif isinstance(clocks, list):
clocks = {clk.name or clk.port: clk for clk in map(conv_clock, clocks) if clk}
if not clock:
if clock_port:
clock = Clock(port=clock_port)
elif len(clocks) == 1:
clock = list(clocks.values())[0]
if clock:
if isinstance(clock, dict):
clock = Clock(**clock)
clock = conv_clock(clock)
if not clock_port:
clock_port = clock.port
if not clocks:
Expand Down

0 comments on commit 148ddba

Please sign in to comment.