From 6ca514d796c1431ff4edfd3860888017d2ad10dc Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Tue, 26 Mar 2024 01:01:31 +0000 Subject: [PATCH 1/5] Split out resize place and route step to repair and resize --- place_and_route/build_defs.bzl | 2 + place_and_route/private/repair.bzl | 69 ++++++++++++++++++++++++++++++ place_and_route/private/resize.bzl | 18 +------- 3 files changed, 73 insertions(+), 16 deletions(-) create mode 100644 place_and_route/private/repair.bzl diff --git a/place_and_route/build_defs.bzl b/place_and_route/build_defs.bzl index c2dbe736..3d8899b6 100644 --- a/place_and_route/build_defs.bzl +++ b/place_and_route/build_defs.bzl @@ -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") @@ -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"), diff --git a/place_and_route/private/repair.bzl b/place_and_route/private/repair.bzl new file mode 100644 index 00000000..acd730f8 --- /dev/null +++ b/place_and_route/private/repair.bzl @@ -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) diff --git a/place_and_route/private/resize.bzl b/place_and_route/private/resize.bzl index d7fe4b37..038ab6d4 100644 --- a/place_and_route/private/resize.bzl +++ b/place_and_route/private/resize.bzl @@ -31,25 +31,11 @@ def resize(ctx, open_road_info): """ 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", From dea1e6ada9da4b59e81cdc245d977d2b1ac57a29 Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Tue, 26 Mar 2024 01:04:37 +0000 Subject: [PATCH 2/5] Remove unused bazel imports --- place_and_route/private/resize.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/place_and_route/private/resize.bzl b/place_and_route/private/resize.bzl index 038ab6d4..a7d209ae 100644 --- a/place_and_route/private/resize.bzl +++ b/place_and_route/private/resize.bzl @@ -15,7 +15,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("//place_and_route:open_road.bzl", "OpenRoadInfo", "merge_open_road_info", "openroad_command", "placement_padding_commands") load("//synthesis:build_defs.bzl", "SynthesisInfo") def resize(ctx, open_road_info): From fdb7d38f964a40284181b995b80cc283403b4ee8 Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Tue, 26 Mar 2024 01:05:58 +0000 Subject: [PATCH 3/5] Remove unused bazel imports --- place_and_route/private/resize.bzl | 2 -- 1 file changed, 2 deletions(-) diff --git a/place_and_route/private/resize.bzl b/place_and_route/private/resize.bzl index a7d209ae..af3bf8e0 100644 --- a/place_and_route/private/resize.bzl +++ b/place_and_route/private/resize.bzl @@ -29,8 +29,6 @@ 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]) - placement_padding_struct = placement_padding_commands(ctx) inputs = placement_padding_struct.inputs From d81531f0d856e0a49b0d24ab106368fc7db24244 Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Tue, 26 Mar 2024 01:07:19 +0000 Subject: [PATCH 4/5] Remove unused bazel imports --- place_and_route/private/resize.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/place_and_route/private/resize.bzl b/place_and_route/private/resize.bzl index af3bf8e0..1baba54e 100644 --- a/place_and_route/private/resize.bzl +++ b/place_and_route/private/resize.bzl @@ -14,7 +14,6 @@ """Resize openROAD commands""" -load("@rules_hdl//pdk:open_road_configuration.bzl", "get_open_road_configuration") load("//place_and_route:open_road.bzl", "OpenRoadInfo", "merge_open_road_info", "openroad_command", "placement_padding_commands") load("//synthesis:build_defs.bzl", "SynthesisInfo") From eaf895852418aea2ed811f4d20644ea07415c429 Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Tue, 26 Mar 2024 01:08:09 +0000 Subject: [PATCH 5/5] Remove unused bazel imports --- place_and_route/private/resize.bzl | 1 - 1 file changed, 1 deletion(-) diff --git a/place_and_route/private/resize.bzl b/place_and_route/private/resize.bzl index 1baba54e..200f394e 100644 --- a/place_and_route/private/resize.bzl +++ b/place_and_route/private/resize.bzl @@ -15,7 +15,6 @@ """Resize openROAD commands""" load("//place_and_route:open_road.bzl", "OpenRoadInfo", "merge_open_road_info", "openroad_command", "placement_padding_commands") -load("//synthesis:build_defs.bzl", "SynthesisInfo") def resize(ctx, open_road_info): """Performs resizing operation of the standard cells.