Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export def during place and route. #190

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion place_and_route/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
load("@rules_hdl//pdk:open_road_configuration.bzl", "assert_has_open_road_configuration")
load("//place_and_route:private/clock_tree_synthesis.bzl", "clock_tree_synthesis")
load("//place_and_route:private/detailed_routing.bzl", "detailed_routing")
load("//place_and_route:private/export_def.bzl", "export_def")
load("//place_and_route:private/floorplan.bzl", "init_floor_plan")
load("//place_and_route:private/global_placement.bzl", "global_placement")
load("//place_and_route:private/global_routing.bzl", "global_routing")
Expand All @@ -32,16 +33,21 @@ def _place_and_route_impl(ctx):
output_files = []

open_road_provider = init_floor_plan(ctx)
open_road_provider, output_def = export_def(ctx, open_road_provider, "pre_pnr")
output_files.append(output_def)
open_road_provider = place_pins(ctx, open_road_provider)
open_road_provider = pdn_gen(ctx, open_road_provider)
open_road_provider = global_placement(ctx, open_road_provider)
open_road_provider, output_def = export_def(ctx, open_road_provider, "global_placement")
output_files.append(output_def)
open_road_provider = resize(ctx, open_road_provider)
open_road_provider = clock_tree_synthesis(ctx, open_road_provider)
open_road_provider = global_routing(ctx, open_road_provider)
if not ctx.attr.skip_detailed_routing:
open_road_provider = detailed_routing(ctx, open_road_provider)
output_files.append(open_road_provider.routed_def)

open_road_provider, output_def = export_def(ctx, open_road_provider, "post_pnr")
output_files.append(output_def)
output_files.append(open_road_provider.output_db)
output_files.extend(open_road_provider.logs.to_list())

Expand Down
58 changes: 58 additions & 0 deletions place_and_route/private/export_def.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2023 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.

"""Export to def openROAD commands"""

load("//place_and_route:open_road.bzl", "OpenRoadInfo", "merge_open_road_info", "openroad_command")

def export_def(ctx, open_road_info, suffix):
"""Export to def.

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.
suffix: Suffix to use for thr def file.

"""

inputs = []

outputs = []
output_def = ctx.actions.declare_file("{}__{}.def".format(ctx.attr.name, suffix))
outputs.append(output_def)

open_road_commands = []
write_def_command = "write_def {}".format(output_def.path)
open_road_commands.append(write_def_command)

command_output = openroad_command(
ctx,
inputs = inputs,
outputs = outputs,
commands = open_road_commands,
input_db = open_road_info.output_db,
step_name = "export_def_" + suffix,
)

def_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, def_open_road_info), output_def
Loading