Skip to content

Commit 085ae76

Browse files
committed
Updating bazel build rules to support detailed
PiperOrigin-RevId: 494038560
1 parent b12f09c commit 085ae76

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

pdk/open_road_configuration.bzl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ OpenRoadPdkInfo = provider(
4040
"rc_script_configuration": "RC script for the various metal layers",
4141
"tapcell_tcl": "TCL file that sets tapcell options. This overrides other tapcell attributes in this rule.",
4242
"placement_padding_tcl": "TCL Script for handling the placement padding of cells",
43+
"detailed_routing_configuration": "optional detailed routing configuration",
4344
},
4445
)
4546

47+
DetailedRoutingInfo = provider(
48+
"Detailed routing info params for OpenROAD",
49+
fields = ["bottom_routing_layer", "top_routing_layer", "via_in_pin_bottom_layer", "via_in_pin_top_layer", "enable_via_gen"],
50+
)
51+
4652
def _open_road_pdk_configuration_impl(ctx):
4753
return [
4854
OpenRoadPdkInfo(
@@ -69,6 +75,7 @@ def _open_road_pdk_configuration_impl(ctx):
6975
rc_script_configuration = ctx.file.rc_script_configuration,
7076
tapcell_tcl = ctx.file.tapcell_tcl,
7177
placement_padding_tcl = ctx.file.placement_padding_tcl,
78+
detailed_routing_configuration = ctx.attr.detailed_routing_configuration,
7279
),
7380
]
7481

@@ -98,7 +105,29 @@ open_road_pdk_configuration = rule(
98105
"rc_script_configuration": attr.label(allow_single_file = True),
99106
"tapcell_tcl": attr.label(allow_single_file = True, doc = "TCL file that sets tapcell options. This overrides other tapcell attributes in this rule."),
100107
"placement_padding_tcl": attr.label(allow_single_file = True, doc = "TCL Script for handling the placement padding of cells"),
108+
"detailed_routing_configuration": attr.label(providers = [DetailedRoutingInfo]),
109+
},
110+
)
111+
112+
def detailed_routing_configuration_impl(ctx):
113+
return [DetailedRoutingInfo(
114+
bottom_routing_layer = ctx.attr.bottom_routing_layer,
115+
top_routing_layer = ctx.attr.top_routing_layer,
116+
via_in_pin_bottom_layer = ctx.attr.via_in_pin_bottom_layer,
117+
via_in_pin_top_layer = ctx.attr.via_in_pin_top_layer,
118+
enable_via_gen = ctx.attr.enable_via_gen,
119+
)]
120+
121+
detailed_routing_configuration = rule(
122+
implementation = detailed_routing_configuration_impl,
123+
attrs = {
124+
"bottom_routing_layer": attr.string(mandatory = True, doc = "Minimum routing layer name"),
125+
"top_routing_layer": attr.string(mandatory = True, doc = "Maximum routing layer name"),
126+
"via_in_pin_bottom_layer": attr.string(doc = "via in pin bottom layer"),
127+
"via_in_pin_top_layer": attr.string(doc = "via in pin top layer"),
128+
"enable_via_gen": attr.bool(default = True),
101129
},
130+
provides = [DetailedRoutingInfo],
102131
)
103132

104133
def assert_has_open_road_configuration(synthesis_info):

place_and_route/open_road.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ def openroad_command(ctx, commands, input_db = None, step_name = None, inputs =
234234
arguments = [
235235
"-no_init",
236236
"-no_splash",
237+
"-threads",
238+
"max",
237239
"-exit",
238240
"-log",
239241
log_file.path,

place_and_route/private/clock_tree_synthesis.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def clock_tree_synthesis(ctx, open_road_info):
4141
format_openroad_do_not_use_list(open_road_configuration.do_not_use_cell_list),
4242
"estimate_parasitics -placement",
4343
"repair_clock_inverters",
44-
"clock_tree_synthesis -root_buf \"{cts_buffer}\" -buf_list \"{cts_buffer}\" -sink_clustering_enable".format(
44+
"clock_tree_synthesis -root_buf \"{cts_buffer}\" -buf_list \"{cts_buffer}\" -sink_clustering_enable -post_cts_disable".format(
4545
cts_buffer = open_road_configuration.cts_buffer_cell,
4646
),
4747
"set_propagated_clock [all_clocks]",

place_and_route/private/detailed_routing.bzl

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"""Detailed Routing openROAD commands"""
1616

1717
load("//place_and_route:open_road.bzl", "OpenRoadInfo", "merge_open_road_info", "openroad_command", "timing_setup_commands")
18+
load("@rules_hdl//pdk:open_road_configuration.bzl", "DetailedRoutingInfo", "get_open_road_configuration")
19+
load("//synthesis:build_defs.bzl", "SynthesisInfo")
1820

1921
def detailed_routing(ctx, open_road_info):
2022
"""Performs detailed routing.
@@ -34,8 +36,27 @@ def detailed_routing(ctx, open_road_info):
3436
output_drc = ctx.actions.declare_file("{}_output_drc".format(ctx.attr.name))
3537
routed_def = ctx.actions.declare_file("{}_detail_routed.def".format(ctx.attr.name))
3638

39+
open_road_configuration = get_open_road_configuration(ctx.attr.synthesized_rtl[SynthesisInfo])
40+
41+
detailed_routing_configs = None
42+
if open_road_configuration.detailed_routing_configuration:
43+
detailed_routing_configs = open_road_configuration.detailed_routing_configuration[DetailedRoutingInfo]
44+
45+
detailed_routing_args = ""
46+
if detailed_routing_configs:
47+
if detailed_routing_configs.bottom_routing_layer:
48+
detailed_routing_args += " -bottom_routing_layer " + detailed_routing_configs.bottom_routing_layer
49+
if detailed_routing_configs.top_routing_layer:
50+
detailed_routing_args += " -top_routing_layer " + detailed_routing_configs.top_routing_layer
51+
if detailed_routing_configs.via_in_pin_bottom_layer:
52+
detailed_routing_args += " -via_in_pin_bottom_layer " + detailed_routing_configs.via_in_pin_bottom_layer
53+
if detailed_routing_configs.via_in_pin_top_layer:
54+
detailed_routing_args += " -via_in_pin_top_layer " + detailed_routing_configs.via_in_pin_top_layer
55+
if detailed_routing_configs.enable_via_gen:
56+
detailed_routing_args += " -disable_via_gen "
57+
3758
open_road_commands = timing_setup_command_struct.commands + [
38-
"detailed_route -output_drc {}".format(output_drc.path),
59+
"detailed_route -output_drc {} {}".format(output_drc.path, detailed_routing_args),
3960
"write_def {}".format(
4061
routed_def.path,
4162
),

0 commit comments

Comments
 (0)