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

pdk: open_road_configuration: Get KLayout technology file and metal fill configuration from internal PDK setup #173

Merged
merged 2 commits into from
Jul 27, 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
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
load("//pdk:open_road_configuration.bzl", "open_road_pdk_configuration")

exports_files(["pdk.patch"])
exports_files([
"pdk.patch",
"fill.json", # Imported from OpenROAD-flow-scripts on 24.07.2023 at 6ec980e1d49a1a8dcdd1e25ed81255b4bb8285c8 from: https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/blob/6ec980e1d49a1a8dcdd1e25ed81255b4bb8285c8/flow/platforms/sky130hd/fill.json
"sky130hd.lyt", # Imported from OpenROAD-flow-scripts on 24.07.2023 at 6ec980e1d49a1a8dcdd1e25ed81255b4bb8285c8 from: https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/blob/6ec980e1d49a1a8dcdd1e25ed81255b4bb8285c8/flow/platforms/sky130hd/sky130hd.lyt
])

open_road_pdk_configuration(
name = "open_road_sky130_fd_sc_hd",
cell_site = "unithd",
cts_buffer_cell = "sky130_fd_sc_hd__clkbuf_1",
density_fill_config = "fill.json",
do_not_use_cell_list = [
"sky130_fd_sc_hd__probe_p_*",
"sky130_fd_sc_hd__probec_p_*",
Expand All @@ -24,6 +29,7 @@ open_road_pdk_configuration(
"met5": "0.5",
},
global_routing_signal_layers = "met1-met5",
klayout_tech_file = "sky130hd.lyt",
pdn_config = "pdn_config.pdn",
pin_horizontal_metal_layer = "met3",
pin_vertical_metal_layer = "met2",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<macro-resolution-mode>default</macro-resolution-mode>
<separate-groups>false</separate-groups>
<map-file/>
<lef-files>klayout_tech.lef</lef-files>
<lef-files>merged.lef</lef-files>
</lefdef>
<dxf>
<dbu>0.001</dbu>
Expand Down
1 change: 1 addition & 0 deletions dependency_support/org_theopenroadproject_asap7/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ exports_files([
"tracks.tcl",
"rc_script.tcl",
"pdn_config.pdn",
"asap7.lyt", # Imported from OpenROAD-flow-scripts on 24.07.2023 at 6ec980e1d49a1a8dcdd1e25ed81255b4bb8285c8 from: https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts/blob/6ec980e1d49a1a8dcdd1e25ed81255b4bb8285c8/flow/platforms/asap7/KLayout/asap7.lyt
])
135 changes: 135 additions & 0 deletions dependency_support/org_theopenroadproject_asap7/asap7.lyt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<technology>
<name>ASAP 7</name>
<description>ASAP 7 nm Technology</description>
<dbu>0.00025</dbu>
<base-path>./platforms/asap7/KLayout/</base-path>
<original-base-path>.klayout/tech/asap7/</original-base-path>
<layer-properties_file>asap7.lyp</layer-properties_file>
<add-other-layers>true</add-other-layers>
<reader-options>
<gds2>
<box-mode>1</box-mode>
<allow-big-records>true</allow-big-records>
<allow-multi-xy-records>true</allow-multi-xy-records>
</gds2>
<common>
<create-other-layers>true</create-other-layers>
<layer-map>layer_map()</layer-map>
<enable-properties>true</enable-properties>
<enable-text-objects>true</enable-text-objects>
</common>
<lefdef>
<read-all-layers>true</read-all-layers>
<layer-map>layer_map('BOUNDARY : 100/0';'M1 : 19/0';'M1.LABEL : 19/2';'M1.PIN : 19/251';'M2 : 20/0';'M2.LABEL : 20/2';'M2.PIN : 20/251';'M3 : 30/0';'M3.LABEL : 30/2';'M3.PIN : 30/251';'M4 : 40/0';'M4.LABEL : 40/2';'M4.PIN : 40/251';'M5 : 50/0';'M5.LABEL : 50/2';'M5.PIN : 50/251';'M6 : 60/0';'M6.LABEL : 60/2';'M6.PIN : 60/251';'M7 : 70/0';'M7.LABEL : 70/2';'M7.PIN : 70/251';'M8 : 80/0';'M8.LABEL : 80/2';'M8.PIN : 80/251';'M9 : 90/0';'M9.LABEL : 90/2';'M9.PIN : 90/251';'V0 : 18/0';'V0.LABEL : 29/0';'V1 : 21/0';'V2 : 25/0';'V3 : 35/0';'V4 : 45/0';'V5 : 55/0';'V6 : 65/0';'V7 : 75/0';'V8 : 85/0';'V9 : 95/0';'GATE : 7/0';'COMP : 101/0';'DIEAREA : 235/0')</layer-map>
<dbu>0.00025</dbu>
<produce-net-names>true</produce-net-names>
<net-property-name>#1</net-property-name>
<produce-inst-names>true</produce-inst-names>
<inst-property-name>#1</inst-property-name>
<produce-cell-outlines>true</produce-cell-outlines>
<cell-outline-layer>DIEAREA</cell-outline-layer>
<produce-placement-blockages>true</produce-placement-blockages>
<placement-blockage-layer>PLACEMENT_BLK</placement-blockage-layer>
<produce-regions>true</produce-regions>
<region-layer>REGIONS</region-layer>
<produce-via-geometry>true</produce-via-geometry>
<via-geometry-suffix/>
<via-geometry-datatype>0</via-geometry-datatype>
<produce-pins>true</produce-pins>
<pins-suffix>.PIN</pins-suffix>
<pins-datatype>251</pins-datatype>
<produce-obstructions>false</produce-obstructions>
<produce-blockages>false</produce-blockages>
<produce-labels>true</produce-labels>
<labels-suffix>.LABEL</labels-suffix>
<labels-datatype>2</labels-datatype>
<produce-routing>true</produce-routing>
<routing-suffix/>
<routing-datatype>0</routing-datatype>
<lef-files>./platforms/asap7/lef/asap7_tech_1x_201209.lef</lef-files>
</lefdef>
<dxf>
<dbu>0.00025</dbu>
<unit>1</unit>
<text-scaling>100</text-scaling>
<circle-points>100</circle-points>
<circle-accuracy>0</circle-accuracy>
<contour-accuracy>0</contour-accuracy>
<polyline-mode>0</polyline-mode>
<render-texts-as-polygons>false</render-texts-as-polygons>
<keep-other-cells>false</keep-other-cells>
<keep-layer-names>false</keep-layer-names>
<create-other-layers>true</create-other-layers>
<layer-map>layer_map()</layer-map>
</dxf>
<cif>
<wire-mode>0</wire-mode>
<dbu>0.00025</dbu>
<layer-map>layer_map()</layer-map>
<create-other-layers>true</create-other-layers>
<keep-layer-names>false</keep-layer-names>
</cif>
</reader-options>
<writer-options>
<gds2>
<write-timestamps>true</write-timestamps>
<write-cell-properties>false</write-cell-properties>
<write-file-properties>false</write-file-properties>
<no-zero-length-paths>false</no-zero-length-paths>
<multi-xy-records>false</multi-xy-records>
<max-vertex-count>8000</max-vertex-count>
<max-cellname-length>32000</max-cellname-length>
<libname>LIB</libname>
</gds2>
<oasis>
<compression-level>2</compression-level>
<write-cblocks>false</write-cblocks>
<strict-mode>false</strict-mode>
<write-std-properties>1</write-std-properties>
<subst-char>*</subst-char>
<permissive>false</permissive>
</oasis>
<cif>
<polygon-mode>0</polygon-mode>
</cif>
<cif>
<dummy-calls>false</dummy-calls>
<blank-separator>false</blank-separator>
</cif>
</writer-options>
<connectivity>
<connection>DrainSource,V0,M1</connection>
<connection>poly,V0,M1</connection>
<connection>M1,V1,M2</connection>
<connection>M2,V2,M3</connection>
<connection>M3,V3,M4</connection>
<connection>M4,V4,M5</connection>
<connection>M5,V5,M6</connection>
<connection>M6,V6,M7</connection>
<connection>M7,V7,M8</connection>
<connection>M8,V8,M9</connection>
<connection>M9,V9,Pad</connection>
<symbols>DrainSource='1/0 - 9/0'</symbols>
<symbols>poly='9/0'</symbols>
<symbols>contact='18/0'</symbols>
<symbols>M1='19/0'</symbols>
<symbols>V1='21/0'</symbols>
<symbols>M2='20/0'</symbols>
<symbols>V2='25/0'</symbols>
<symbols>M3='30/0'</symbols>
<symbols>V3='35/0'</symbols>
<symbols>M4='40/0'</symbols>
<symbols>V4='45/0'</symbols>
<symbols>M5='50/0'</symbols>
<symbols>V5='55/0'</symbols>
<symbols>M6='60/0'</symbols>
<symbols>V6='65/0'</symbols>
<symbols>M7='70/0'</symbols>
<symbols>V7='75/0'</symbols>
<symbols>M8='80/0'</symbols>
<symbols>V8='85/0'</symbols>
<symbols>M9='90/0'</symbols>
<symbols>V9='95/0'</symbols>
</connectivity>
</technology>
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ open_road_pdk_configuration(
"M7": "0.5",
},
global_routing_signal_layers = "M2-M7",
klayout_tech_file = "@rules_hdl//dependency_support/org_theopenroadproject_asap7:asap7.lyt",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: no fill config by default in ASAP7?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the flow examples in OpenROAD-flow-scripts - no, there is no density_fill stage in the flow targeting ASAP7 so there is no need for specifying the config file

pdn_config = "@rules_hdl//dependency_support/org_theopenroadproject_asap7:pdn_config.pdn",
pin_horizontal_metal_layer = "M4",
pin_vertical_metal_layer = "M5",
Expand Down
15 changes: 12 additions & 3 deletions gds_write/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@

load("//place_and_route:open_road.bzl", "OpenRoadInfo")
load("//synthesis:build_defs.bzl", "SynthesisInfo")
load("@rules_hdl//pdk:open_road_configuration.bzl", "assert_has_open_road_configuration", "get_open_road_configuration")

def _gds_write_impl(ctx):
# Throws an error if there is no OpenROAD configuration
assert_has_open_road_configuration(ctx.attr.implemented_rtl[SynthesisInfo])
open_road_configuration = get_open_road_configuration(ctx.attr.implemented_rtl[SynthesisInfo])

final_gds = ctx.actions.declare_file("{}.gds".format(ctx.attr.name))

# KLayout technology file
Expand Down Expand Up @@ -48,6 +53,10 @@ def _gds_write_impl(ctx):
if ctx.attr.gds_allow_empty:
gds_allow_empty_args = " --gds-allow-empty {}".format(ctx.attr.gds_allow_empty)

klayout_lyt = open_road_configuration.klayout_tech_file.files.to_list()[0]
if ctx.file.klayout_lyt:
klayout_lyt = ctx.file.klayout_lyt

ctx.actions.run_shell(
outputs = [
final_gds,
Expand All @@ -59,7 +68,7 @@ def _gds_write_impl(ctx):
platform_gds +
[
ctx.attr.implemented_rtl[OpenRoadInfo].routed_def,
ctx.file.klayout_lyt,
klayout_lyt,
tech_lef,
],
),
Expand All @@ -68,7 +77,7 @@ def _gds_write_impl(ctx):
" --input-def {}".format(ctx.attr.implemented_rtl[OpenRoadInfo].routed_def.path) +
lef_args +
gds_args +
" --tech-file {}".format(ctx.file.klayout_lyt.path) +
" --tech-file {}".format(klayout_lyt.path) +
gds_allow_empty_args +
" --out {}".format(final_gds.path),
tools = depset([ctx.executable._gds_write]),
Expand All @@ -80,7 +89,7 @@ gds_write = rule(
implementation = _gds_write_impl,
attrs = {
"implemented_rtl": attr.label(mandatory = True, providers = [OpenRoadInfo, SynthesisInfo]),
"klayout_lyt": attr.label(mandatory = True, allow_single_file = True),
"klayout_lyt": attr.label(allow_single_file = True),
"input_lef": attr.label_list(allow_files = True),
"input_gds": attr.label_list(allow_files = True),
"gds_allow_empty": attr.string(),
Expand Down
6 changes: 6 additions & 0 deletions pdk/open_road_configuration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ OpenRoadPdkInfo = provider(
"tapcell_tcl": "TCL file that sets tapcell options. This overrides other tapcell attributes in this rule.",
"placement_padding_tcl": "TCL Script for handling the placement padding of cells",
"detailed_routing_configuration": "optional detailed routing configuration",
"density_fill_config": "optional path to file with metal fill configuration",
"klayout_tech_file": "KLayout technology file for GDS write",
},
)

Expand Down Expand Up @@ -76,6 +78,8 @@ def _open_road_pdk_configuration_impl(ctx):
tapcell_tcl = ctx.file.tapcell_tcl,
placement_padding_tcl = ctx.file.placement_padding_tcl,
detailed_routing_configuration = ctx.attr.detailed_routing_configuration,
density_fill_config = ctx.attr.density_fill_config,
klayout_tech_file = ctx.attr.klayout_tech_file,
),
]

Expand Down Expand Up @@ -106,6 +110,8 @@ open_road_pdk_configuration = rule(
"tapcell_tcl": attr.label(allow_single_file = True, doc = "TCL file that sets tapcell options. This overrides other tapcell attributes in this rule."),
"placement_padding_tcl": attr.label(allow_single_file = True, doc = "TCL Script for handling the placement padding of cells"),
"detailed_routing_configuration": attr.label(providers = [DetailedRoutingInfo]),
"density_fill_config": attr.label(allow_single_file = True),
"klayout_tech_file": attr.label(mandatory = True, allow_single_file = True),
},
)

Expand Down
10 changes: 8 additions & 2 deletions place_and_route/private/detailed_routing.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ def detailed_routing(ctx, open_road_info):

open_road_commands = timing_setup_command_struct.commands
open_road_commands.append("detailed_route -output_drc {} {}".format(output_drc.path, detailed_routing_args))
density_fill_config = None
if open_road_configuration.density_fill_config:
density_fill_config = open_road_configuration.density_fill_config.files.to_list()[0]
if ctx.file.density_fill_config:
density_fill_config = ctx.file.density_fill_config

if density_fill_config:
open_road_commands.append("set db [ord::get_db]")
open_road_commands.append("set chip [$db getChip]")
open_road_commands.append("set block [$chip getBlock]")
Expand All @@ -66,8 +72,8 @@ def detailed_routing(ctx, open_road_info):
open_road_commands.append("foreach obstruction $obstructions {\n" +
" odb::dbObstruction_destroy $obstruction" +
"\n}")
open_road_commands.append("density_fill -rules {}".format(ctx.file.density_fill_config.path))
inputs.append(ctx.file.density_fill_config)
open_road_commands.append("density_fill -rules {}".format(density_fill_config.path))
inputs.append(density_fill_config)
open_road_commands.append("write_def {}".format(routed_def.path))

execution_requirements = {}
Expand Down
2 changes: 0 additions & 2 deletions synthesis/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ place_and_route(
name = "counter_place_and_route",
clock_period = "10",
core_padding_microns = 20,
density_fill_config = "fill.json",
die_height_microns = 200,
die_width_microns = 200,
placement_density = "0.7",
Expand All @@ -47,7 +46,6 @@ place_and_route(
gds_write(
name = "counter_asic",
implemented_rtl = ":counter_place_and_route",
klayout_lyt = "klayout.lyt",
)

run_opensta(
Expand Down
Loading