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

IR Drop Reports in the Signoff Stage #1255

Merged
merged 6 commits into from
Aug 9, 2022
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
17 changes: 14 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@ For various reasons, it's recommended to call working branches, even in your for
# Testing and Code Standards
Before you submit your changes, it's prudent to perform some kind of smoke test. `make test` tests a simple spm design to ensure nothing has gone horribly wrong.

You will also need to ensure that your Python code passes linting with two tools: `black` and `flake8`. The commands are simply `black .` and `flake8 .`. Please fix all warnings.

## Choice of Language
Try to write all major code in Python. Writing some Tcl is usually a necessity because this project's backbone is unfortunately written in Tcl, but just keep the Tcl to as close to a Python shim as possible.

Please do not write new shell scripts.
Please do not write new shell scripts, no matter how trivial.

### Tcl
1TBS-indented, four spaces, `lower_snake_case` for local/global variables and `UPPER_SNAKE_CASE` for environment variables. Unfortunately it is impossible to add any other guidelines or standards to the Tcl code considering it is Tcl code. Please exercise your best judgment.

### Python
Python code should run on Python 3.6+.

You will need to ensure that your Python code passes linting with the tools and plugins in [`requirements_lint.txt`](./requirements_lint.txt). The commands are simply `black .` and `flake8 .`. Please fix all warnings.

For new code, please follow [PEP-8 naming conventions](https://peps.python.org/pep-0008/#naming-conventions). The linters do not enforce them just yet because of the corpus of existing code that does not do that, but they will in the future.

Do all arithmetic either in integers or using the Python [`decimal`](https://docs.python.org/3.6/library/decimal.html) library. All (numerous) existing uses of IEEE-754 are bugs we are interested in fixing.

## Yosys, OpenROAD and Magic Scripts
There are some special guidelines for scripts in `scripts/yosys`, `scripts/openroad`, and `scripts/magic`:
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ You can use the following example as a smoke test:

To run OpenLane on multiple designs at the same time, check this [section](#regression-and-design-configurations-exploration).

Having trouble running the flow? check [FAQs](https://github.com/The-OpenROAD-Project/OpenLane/wiki)

## Command line arguments

The following are arguments that can be passed to `flow.tcl`
Expand Down
13 changes: 7 additions & 6 deletions configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ These variables are optional that can be specified in the design configuration f
| `VDD_NETS` | Specifies the power nets/pins to be used when creating the power grid for the design. |
| `GND_NETS` | Specifies the ground nets/pins to be used when creating the power grid for the design. |
| `SYNTH_USE_PG_PINS_DEFINES` | Specifies the power guard used in the verilog source code to specify the power and ground pins. This is used to automatically extract `VDD_NETS` and `GND_NET` variables from the verilog, with the assumption that they will be order `inout vdd1, inout gnd1, inout vdd2, inout gnd2, ...`. |
| `FP_PDN_IRDROP` | Enable calculation of power grid IR drop during PDN generation. <br> (Default: `1`)|
| `FP_IO_MIN_DISTANCE` | The minmimum distance between the IOs in microns. <br> (Default: `3`) |
| `FP_PDN_IRDROP` | **Removed: worthless** Enable calculation of power grid IR drop during PDN generation. <br> (Default: `1`)|

#### Deprecated I/O Layer variables
These variables worked initially, but they were too sky130 specific and will be removed. Currently, if you define them in your design, they'll be used, but it's recommended to update your configuration to use `FP_IO_HLAYER` and `FP_IO_VLAYER`, which are defined in the PDK.
Expand Down Expand Up @@ -220,10 +220,10 @@ These variables worked initially, but they were too sky130 specific and will be
|-|-|
| `MAGIC_PAD` | A flag to pad the views generated by magic (.mag, .lef, .gds) with one site. 1 = Enabled, 0 = Disabled <br> (Default: `0` )|
| `MAGIC_ZEROIZE_ORIGIN` | A flag to move the layout such that it's origin in the lef generated by magic is 0,0. 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `MAGIC_GENERATE_GDS` | A flag to generate gds view via magic . 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `MAGIC_GENERATE_LEF` | A flag to generate lef view via magic . 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `MAGIC_GENERATE_MAGLEF` | A flag to generate maglef view via magic . 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `MAGIC_WRITE_FULL_LEF` | A flag to specify whether or not the output LEF should include all shapes inside the macro or an abstracted view of the macro lef view via magic . 1 = Full View, 0 = Abstracted View <br> (Default: `0` )|
| `MAGIC_GENERATE_GDS` | A flag to generate gds view via magic. 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `MAGIC_GENERATE_LEF` | A flag to generate lef view via magic. 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `MAGIC_GENERATE_MAGLEF` | A flag to generate maglef view via magic. 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `MAGIC_WRITE_FULL_LEF` | A flag to specify whether or not the output LEF should include all shapes inside the macro or an abstracted view of the macro lef view via magic. 1 = Full View, 0 = Abstracted View <br> (Default: `0` )|
| `MAGIC_DRC_USE_GDS` | A flag to choose whether to run the magic DRC checks on GDS or not. If not, then the checks will be done on the DEF/LEF. 1 = GDS, 0 = DEF/LEF <br> (Default: `1` )|
| `MAGIC_EXT_USE_GDS` | A flag to choose whether to run the magic extractions on GDS or DEF/LEF. If GDS was used Device Level LVS will be run. Otherwise, blackbox LVS will be run. 1 = GDS, 0 = DEF/LEF <br> (Default: `0` )|
| `MAGIC_INCLUDE_GDS_POINTERS` | A flag to choose whether to include GDS pointers in the generated mag files or not. 1 = Enabled, 0 = Disabled <br> (Default: `0` )|
Expand All @@ -237,7 +237,7 @@ These variables worked initially, but they were too sky130 specific and will be
|-|-|
| `LVS_INSERT_POWER_PINS` | Enables power pins insertion before running lvs. 1 = Enabled, 0 = Disabled <br> (Default: `1` )|
| `LVS_CONNECT_BY_LABEL` | Enables connections by label in LVS by skipping `extract unique` in magic extractions. <br> Default: `0` |
| `YOSYS_REWRITE_VERILOG` | Enables yosys to rewrite the verilog before LVS producing a canonical verilog netlist with verbose wire declarations. This flag will be ignored if `LEC_ENABLE` is 1, and it will be rewritten anyways. 1 = Enabled, 0 = Disabled <br> (Default: `0` ) |
| `YOSYS_REWRITE_VERILOG` | Enables yosys to rewrite the verilog before LVS producing a canonical verilog netlist with verbose wire declarations. 1 = Enabled, 0 = Disabled <br> (Default: `0` ) |

### Flow control

Expand Down Expand Up @@ -267,6 +267,7 @@ These variables worked initially, but they were too sky130 specific and will be
| `RUN_SPEF_EXTRACTION` | Specifies whether or not to run SPEF extraction on the routed DEF. 1=enabled 0=disabled <br> Default: `1` |
| `GENERATE_FINAL_SUMMARY_REPORT` | Specifies whether or not to generate a final summary report after the run is completed. Check command `generate_final_summary_report`. 1=enabled 0=disabled <br> Default: `1` |
| `RUN_CVC` | Runs CVC on the output spice, which is a Circuit Validity Checker. Voltage aware ERC checker for CDL netlists. Thus, it controls the command `run_lef_cvc`. 1=Enabled, 0=Disabled. <br> Default: `1` |
| `RUN_IRDROP_REPORT` | Creates an IR Drop report using OpenROAD PSM. 1=Enabled, 0=Disabled. <br> Default: `0` |
| `MAGIC_CONVERT_DRC_TO_RDB` | **Removed: Will always run** Specifies whether or not generate a Calibre RDB out of the magic.drc report. Result is saved in `<run_path>/results/magic/`. 1=enabled 0=disabled <br> Default: `1`|

### Checkers
Expand Down
33 changes: 18 additions & 15 deletions configuration/general.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,19 @@ if { ![info exists ::env(TEST_MISMATCHES)] } {
set ::env(TEST_MISMATCHES) {all}
}

# Flow control defaults
set ::env(RUN_LVS) 1
# General Defaults
set ::env(CLOCK_PERIOD) "10.0"

set ::env(LEC_ENABLE) 0
set ::env(YOSYS_REWRITE_VERILOG) 0
# Flow Controls
set ::env(RUN_SIMPLE_CTS) 0

set ::env(FILL_INSERTION) 1
set ::env(TAP_DECAP_INSERTION) 1

set ::env(RUN_DRT) 1
set ::env(USE_ARC_ANTENNA_CHECK) 1
set ::env(RUN_SPEF_EXTRACTION) 1
set ::env(RUN_IRDROP_REPORT) 1

set ::env(PRIMARY_SIGNOFF_TOOL) magic

Expand All @@ -51,24 +59,19 @@ set ::env(MAGIC_INCLUDE_GDS_POINTERS) 0
set ::env(MAGIC_DISABLE_HIER_GDS) 1
set ::env(MAGIC_CONVERT_DRC_TO_RDB) 1

set ::env(RUN_KLAYOUT) 1
set ::env(RUN_KLAYOUT_DRC) 0
set ::env(KLAYOUT_XOR_GDS) 1
set ::env(KLAYOUT_XOR_XML) 1

set ::env(RUN_DRT) 1
set ::env(RUN_SIMPLE_CTS) 0
set ::env(CLOCK_PERIOD) "10.0"
set ::env(RUN_KLAYOUT) 1
set ::env(TAKE_LAYOUT_SCROT) 0
set ::env(RUN_KLAYOUT_DRC) 0
set ::env(KLAYOUT_DRC_KLAYOUT_GDS) 0
set ::env(RUN_KLAYOUT_XOR) 1
set ::env(USE_ARC_ANTENNA_CHECK) 1

set ::env(FILL_INSERTION) 1
set ::env(TAP_DECAP_INSERTION) 1

set ::env(RUN_SPEF_EXTRACTION) 1
set ::env(RUN_CVC) 1
set ::env(RUN_LVS) 1

set ::env(YOSYS_REWRITE_VERILOG) 0
set ::env(LEC_ENABLE) 0

set ::env(GENERATE_FINAL_SUMMARY_REPORT) 1

Expand Down
1 change: 0 additions & 1 deletion designs/spm/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"CLOCK_PERIOD": 10,
"CLOCK_PORT": "clk",
"CLOCK_NET": "ref::$CLOCK_PORT",
"FP_PDN_AUTO_ADJUST": 0,
"FP_PDN_VOFFSET": 7,
"FP_PDN_HOFFSET": 7,
"FP_PIN_ORDER_CFG": "dir::pin_order.cfg",
Expand Down
9 changes: 8 additions & 1 deletion flow.tcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env tclsh
# Copyright 2020-2021 Efabless Corporation
# Copyright 2020-2022 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -82,6 +82,12 @@ proc run_diode_insertion_2_5_step {args} {

}

proc run_irdrop_report_step {args} {
if { $::env(RUN_IRDROP_REPORT) } {
run_irdrop_report
}
}

proc run_lvs_step {{ lvs_enabled 1 }} {
if { ! [ info exists ::env(LVS_CURRENT_DEF) ] } {
set ::env(LVS_CURRENT_DEF) $::env(CURRENT_DEF)
Expand Down Expand Up @@ -190,6 +196,7 @@ proc run_non_interactive_mode {args} {
"parasitics_sta" "run_parasitics_sta_step" \
"eco" "run_eco_step" \
"diode_insertion" "run_diode_insertion_2_5_step" \
"irdrop" "run_irdrop_report_step" \
"gds_magic" "run_magic_step" \
"gds_klayout" "run_klayout_step" \
"lvs" "run_lvs_step $LVS_ENABLED " \
Expand Down
2 changes: 1 addition & 1 deletion run_issue_regressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def run_test_case(test_case):
# -------------------------------
try:
logfile = open(logpath, "w")
print(f"Running test case: {test_case_name} (logging to {logpath})")
print(f"Running test case: {test_case_name} (log: {logpath})")
interactive = []
interactive_file = os.path.join(test_case, "interactive.tcl")
if os.path.exists(interactive_file):
Expand Down
59 changes: 59 additions & 0 deletions scripts/odbpy/snap_to_grid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2022 Efabless Corporation
#
# 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.
import math
from decimal import Decimal

import click

from reader import OdbReader


def snap_value(value: Decimal, manufacturing_grid: Decimal) -> Decimal:
adjusted = math.floor(value / manufacturing_grid) * manufacturing_grid
if adjusted == Decimal(0):
adjusted = math.ceil(value / manufacturing_grid) * manufacturing_grid
return adjusted


@click.command()
@click.option(
"-o",
"--output",
required=True,
help="A text file to which final values are output.",
)
@click.option(
"-l",
"--input-lef",
required=True,
help="Input LEF file (for the manufacturing grid)",
)
@click.argument("input_values", type=Decimal, nargs=-1)
def cli(output, input_lef, input_values):
reader = OdbReader(input_lef, None)
manufacturing_grid = Decimal(reader.db.getTech().getManufacturingGrid()) / Decimal(
reader.db.getTech().getDbUnitsPerMicron()
)
with open(output, "w") as f:
print(
" ".join(
[str(snap_value(value, manufacturing_grid)) for value in input_values]
),
end="",
file=f,
)


if __name__ == "__main__":
cli()
37 changes: 37 additions & 0 deletions scripts/openroad/irdrop.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2022 Efabless Corporation
#
# 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.

if {[catch {read_lef $::env(MERGED_LEF)} errmsg]} {
puts stderr $errmsg
exit 1
}

if {[catch {read_def $::env(CURRENT_DEF)} errmsg]} {
puts stderr $errmsg
exit 1
}

foreach lib $::env(LIB_SYNTH_COMPLETE) {
read_liberty $lib
}

if { [info exists ::env(EXTRA_LIBS) ] } {
foreach lib $::env(EXTRA_LIBS) {
read_liberty $lib
}
}

source $::env(SCRIPTS_DIR)/openroad/set_rc.tcl

analyze_power_grid -net $::env(VDD_NET) -outfile $::env(_tmp_save_rpt)
donn marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 1 addition & 7 deletions scripts/openroad/pdn.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2021 Efabless Corporation
# Copyright 2020-2022 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,10 +50,4 @@ if { $::env(FP_PDN_CHECK_NODES) } {
check_power_grid -net $::env(GND_NET)
}

if { $::env(FP_PDN_IRDROP) } {
# set rc values
source $::env(SCRIPTS_DIR)/openroad/set_rc.tcl
analyze_power_grid -net $::env(VDD_NET) -outfile $::env(PGA_RPT_FILE)
}

write_def $::env(SAVE_DEF)
22 changes: 19 additions & 3 deletions scripts/tcl_commands/all.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -980,11 +980,11 @@ proc set_layer_tracks {args} {
}

proc run_or_antenna_check {args} {
TIMER::timer_start
increment_index
puts_info "Running OpenROAD Antenna Rule Checker..."

TIMER::timer_start
set log [index_file $::env(signoff_logs)/antenna.log]
puts_info "Running OpenROAD Antenna Rule Checker (log: [relpath . $log])..."

run_openroad_script $::env(SCRIPTS_DIR)/openroad/antenna_check.tcl -indexed_log $log

set antenna_violators_rpt [index_file $::env(signoff_reports)/antenna_violators.rpt]
Expand All @@ -1006,6 +1006,22 @@ proc run_antenna_check {args} {
}
}

proc run_irdrop_report {args} {
increment_index
TIMER::timer_start
set log [index_file $::env(signoff_logs)/irdrop.log]
puts_info "Creating IR Drop Report (log: [relpath . $log])..."

set rpt [index_file $::env(signoff_reports)/irdrop.rpt]

set ::env(_tmp_save_rpt) $rpt
run_openroad_script $::env(SCRIPTS_DIR)/openroad/irdrop.tcl -indexed_log $log
unset ::env(_tmp_save_rpt)

TIMER::timer_stop
exec echo "[TIMER::get_runtime]" | python3 $::env(SCRIPTS_DIR)/write_runtime.py "ir drop report - openroad"
}

proc or_gui {args} {
run_openroad_script -gui $::env(SCRIPTS_DIR)/openroad/gui.tcl
}
Expand Down
14 changes: 7 additions & 7 deletions scripts/tcl_commands/cts.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ proc run_cts {args} {
set ::env(CURRENT_STAGE) cts
increment_index
TIMER::timer_start

set cts_log [index_file $::env(cts_logs)/cts.log]
set cts_log_rel [relpath . $cts_log]
puts_info "Running Clock Tree Synthesis (logging to '$cts_log_rel')..."
set log [index_file $::env(cts_logs)/cts.log]
puts_info "Running Clock Tree Synthesis (log: [relpath . $log])..."

if { ! [info exists ::env(CLOCK_NET)] } {
set ::env(CLOCK_NET) $::env(CLOCK_PORT)
Expand All @@ -77,7 +75,7 @@ proc run_cts {args} {
trim_lib -input $::env(LIB_SYNTH_COMPLETE) -output $::env(LIB_CTS) -drc_exclude_only
}

run_openroad_script $::env(SCRIPTS_DIR)/openroad/cts.tcl -indexed_log $cts_log
run_openroad_script $::env(SCRIPTS_DIR)/openroad/cts.tcl -indexed_log $log

check_cts_clock_nets
set ::env(cts_reports) $report_tag_holder
Expand All @@ -101,10 +99,12 @@ proc run_resizer_timing {args} {
if { $::env(PL_RESIZER_TIMING_OPTIMIZATIONS) == 1} {
increment_index
TIMER::timer_start
puts_info "Running Placement Resizer Timing Optimizations..."
set log [index_file $::env(cts_logs)/resizer.log]
puts_info "Running Placement Resizer Timing Optimizations (log: [relpath . $log])..."

set ::env(SAVE_DEF) [index_file $::env(cts_tmpfiles)/resizer_timing.def]
set ::env(SAVE_SDC) [index_file $::env(cts_tmpfiles)/resizer_timing.sdc]
run_openroad_script $::env(SCRIPTS_DIR)/openroad/resizer_timing.tcl -indexed_log [index_file $::env(cts_logs)/resizer.log]
run_openroad_script $::env(SCRIPTS_DIR)/openroad/resizer_timing.tcl -indexed_log $log
set_def $::env(SAVE_DEF)
set ::env(CURRENT_SDC) $::env(SAVE_SDC)

Expand Down
5 changes: 3 additions & 2 deletions scripts/tcl_commands/cvc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ proc run_lef_cvc {args} {

increment_index
TIMER::timer_start
puts_info "Running CVC..."
set log [index_file $::env(signoff_logs)/erc_screen.log]
puts_info "Running CVC (log: [relpath . $log])..."

# merge cdl views of the optimization library and the base library if they are different
if { $::env(STD_CELL_LIBRARY_OPT) != $::env(STD_CELL_LIBRARY) } {
Expand All @@ -68,7 +69,7 @@ proc run_lef_cvc {args} {

# The main event
try_catch cvc $::env(CVC_SCRIPTS_DIR)/cvcrc \
|& tee $::env(TERMINAL_OUTPUT) [index_file $::env(signoff_logs)/erc_screen.log]
|& tee $::env(TERMINAL_OUTPUT) $log

TIMER::timer_stop

Expand Down
Loading