Skip to content

Commit

Permalink
Allow for specifying both an SDC file and clocks
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesinouye committed Mar 28, 2024
1 parent 8928f23 commit 2031374
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions place_and_route/open_road.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -108,33 +108,31 @@ def clock_commands(ctx):
Returns:
Struct with params inputs and commands. Both return values are lists.
"""
sdc = ctx.file.sdc

if sdc:
return struct(inputs = [sdc], commands = ["read_sdc {}".format(sdc.path)])
inputs = []
commands = [
"create_clock [get_ports {clock_name}] -period {period}".format(
clock_name = clock_name,
period = period,
)
for clock_name, period in ctx.attr.clocks.items()
]

# If no name is passed, the clock is assumed to be named "clk".
# If ctx.attr.clock_period is set, assume the clock name is "clk".
if ctx.attr.clock_period:
return struct(
inputs = [],
commands = [
"create_clock [get_ports clk] -period {period}".format(
period = ctx.attr.clock_period,
),
],
)
commands.append("create_clock [get_ports clk] -period {}".format(ctx.attr.clock_period))

sdc = ctx.file.sdc
if sdc:
inputs.append(sdc)
commands.append("read_sdc {}".format(sdc.path))

return struct(
inputs = [],
commands = [
"create_clock [get_ports {clock_name}] -period {period}".format(
period = ctx.attr.clocks[clock_name],
clock_name = clock_name,
)
for clock_name in ctx.attr.clocks
],
inputs = inputs,
commands = commands,
)


def format_openroad_do_not_use_list(do_not_use_list):
if do_not_use_list:
return "set_dont_use {{ {cell_patterns} }}".format(
Expand Down

0 comments on commit 2031374

Please sign in to comment.