-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathglobal_routing.bzl
97 lines (86 loc) · 4.07 KB
/
global_routing.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 2021 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.
"""Global Routing openROAD commands"""
load("//pdk:open_road_configuration.bzl", "get_open_road_configuration")
load("//place_and_route:open_road.bzl", "OpenRoadInfo", "merge_open_road_info", "openroad_command")
load("//place_and_route:private/report_area.bzl", "generate_area_results")
load("//place_and_route:private/report_power.bzl", "generate_power_results")
load("//synthesis:defs.bzl", "SynthesisInfo")
def _global_routing_layer_adjustments(adjustments):
adjustment_command = "{"
for layer, value in adjustments.items():
adjustment_command += "{{{metal_layer} {adjustment}}}".format(
metal_layer = layer,
adjustment = value,
)
adjustment_command += " "
adjustment_command += "}"
return adjustment_command
def global_routing(ctx, open_road_info):
"""Performs clock tree synthesis.
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])
general_routing_power_results = ctx.actions.declare_file("{}_general_routing_power_results.textproto".format(ctx.attr.name))
general_routing_area_results = ctx.actions.declare_file("{}_general_routing_area_results.textproto".format(ctx.attr.name))
open_road_commands = [
"""
foreach layer_adjustment {global_routing_layer_adjustments} {{
lassign $layer_adjustment layer adjustment
set_global_routing_layer_adjustment $layer $adjustment
}}
""".format(
global_routing_layer_adjustments = _global_routing_layer_adjustments(open_road_configuration.global_routing_layer_adjustments),
),
"set_routing_layers -signal \"{global_routing_layers}\" -clock \"{global_routing_clock_layers}\"".format(
global_routing_layers = open_road_configuration.global_routing_signal_layers,
global_routing_clock_layers = open_road_configuration.global_routing_clock_layers,
),
"global_route -congestion_iterations 100",
"estimate_parasitics -global_routing",
"report_checks -path_delay min_max -format full_clock_expanded -fields {input_pin slew capacitance} -digits 3",
"report_wns",
"report_tns",
"report_check_types -max_slew -max_capacitance -max_fanout -violators",
"report_floating_nets -verbose",
"report_units",
"set_power_activity -input -activity {} -duty 0.5".format(ctx.attr.power_switching_activity),
]
open_road_commands.extend(generate_power_results(ctx, general_routing_power_results))
open_road_commands.extend(generate_area_results(general_routing_area_results))
command_output = openroad_command(
ctx,
commands = open_road_commands,
input_db = open_road_info.output_db,
inputs = [],
outputs = [
general_routing_power_results,
general_routing_area_results,
],
step_name = "global_routing",
)
current_action_open_road_info = OpenRoadInfo(
commands = open_road_commands,
input_files = depset(),
output_db = command_output.db,
logs = depset([command_output.log_file]),
general_routing_power_results = general_routing_power_results,
general_routing_area_results = general_routing_area_results,
)
return merge_open_road_info(open_road_info, current_action_open_road_info)