Skip to content

Commit

Permalink
Merge pull request #303 from hdl/repair
Browse files Browse the repository at this point in the history
Split out resize place and route step to repair and resize
  • Loading branch information
QuantamHD committed Mar 27, 2024
2 parents 29db060 + eaf8958 commit 8928f23
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 21 deletions.
2 changes: 2 additions & 0 deletions place_and_route/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ load("//place_and_route:private/global_placement.bzl", "global_placement")
load("//place_and_route:private/global_routing.bzl", "global_routing")
load("//place_and_route:private/pdn_gen.bzl", "pdn_gen")
load("//place_and_route:private/place_pins.bzl", "place_pins")
load("//place_and_route:private/repair.bzl", "repair")
load("//place_and_route:private/resize.bzl", "resize")
load("//synthesis:build_defs.bzl", "SynthesisInfo")

Expand All @@ -32,6 +33,7 @@ PLACE_AND_ROUTE_STEPS = [
("place_pins", place_pins, ""),
("pdn_gen", pdn_gen, ""),
("global_placement", global_placement, "global_placement"),
("repair", repair, ""),
("resize", resize, ""),
("clock_tree_synthesis", clock_tree_synthesis, ""),
("global_routing", global_routing, "post_pnr"),
Expand Down
69 changes: 69 additions & 0 deletions place_and_route/private/repair.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Repair openROAD commands"""

load("//pdk:open_road_configuration.bzl", "get_open_road_configuration")
load("//place_and_route:open_road.bzl", "OpenRoadInfo", "format_openroad_do_not_use_list", "merge_open_road_info", "openroad_command", "timing_setup_commands")
load("//synthesis:build_defs.bzl", "SynthesisInfo")

def repair(ctx, open_road_info):
"""Performs several repair operations on a placed design.
Returns:
OpenRoadInfo: the openROAD info provider containing required input files and
and commands run.
Args:
ctx: Bazel rule ctx
open_road_info: OpenRoadInfo provider from a previous step.
"""
open_road_configuration = get_open_road_configuration(ctx.attr.synthesized_rtl[SynthesisInfo])

timing_setup_command_struct = timing_setup_commands(ctx)

inputs = timing_setup_command_struct.inputs

open_road_commands = timing_setup_command_struct.commands + [
format_openroad_do_not_use_list(open_road_configuration.do_not_use_cell_list),
"estimate_parasitics -placement",
"remove_buffers",
"buffer_ports",
"repair_design",
"repair_tie_fanout -separation {separation} \"{high_cell}\"".format(
separation = open_road_configuration.tie_separation,
high_cell = open_road_configuration.tie_high_port,
),
"repair_tie_fanout -separation {separation} \"{low_cell}\"".format(
separation = open_road_configuration.tie_separation,
low_cell = open_road_configuration.tie_low_port,
),
]

command_output = openroad_command(
ctx,
commands = open_road_commands,
input_db = open_road_info.output_db,
inputs = inputs,
step_name = "repair",
)

current_action_open_road_info = OpenRoadInfo(
commands = open_road_commands,
input_files = depset(inputs),
output_db = command_output.db,
logs = depset([command_output.log_file]),
)

return merge_open_road_info(open_road_info, current_action_open_road_info)
24 changes: 3 additions & 21 deletions place_and_route/private/resize.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

"""Resize openROAD commands"""

load("@rules_hdl//pdk:open_road_configuration.bzl", "get_open_road_configuration")
load("//place_and_route:open_road.bzl", "OpenRoadInfo", "format_openroad_do_not_use_list", "merge_open_road_info", "openroad_command", "placement_padding_commands", "timing_setup_commands")
load("//synthesis:build_defs.bzl", "SynthesisInfo")
load("//place_and_route:open_road.bzl", "OpenRoadInfo", "merge_open_road_info", "openroad_command", "placement_padding_commands")

def resize(ctx, open_road_info):
"""Performs resizing operation of the standard cells.
Expand All @@ -29,27 +27,11 @@ def resize(ctx, open_road_info):
open_road_info: OpenRoadInfo provider from a previous step.
"""
open_road_configuration = get_open_road_configuration(ctx.attr.synthesized_rtl[SynthesisInfo])

timing_setup_command_struct = timing_setup_commands(ctx)
placement_padding_struct = placement_padding_commands(ctx)

inputs = timing_setup_command_struct.inputs + placement_padding_struct.inputs
inputs = placement_padding_struct.inputs

open_road_commands = timing_setup_command_struct.commands + [
format_openroad_do_not_use_list(open_road_configuration.do_not_use_cell_list),
"estimate_parasitics -placement",
"buffer_ports",
"repair_design",
"repair_tie_fanout -separation {separation} \"{high_cell}\"".format(
separation = open_road_configuration.tie_separation,
high_cell = open_road_configuration.tie_high_port,
),
"repair_tie_fanout -separation {separation} \"{low_cell}\"".format(
separation = open_road_configuration.tie_separation,
low_cell = open_road_configuration.tie_low_port,
),
] + placement_padding_struct.commands + [
open_road_commands = placement_padding_struct.commands + [
"detailed_placement",
"improve_placement" if ctx.attr.enable_improve_placement else "",
"optimize_mirroring",
Expand Down

0 comments on commit 8928f23

Please sign in to comment.