Skip to content

Commit

Permalink
Add Very Early support for GF180MCU + open_pdks Tweaks (The-OpenROA…
Browse files Browse the repository at this point in the history
…D-Project#1251)

+ Add gf180mcuC configs for {APU, PPU, SPM}
~ Clean up some leftover variables
~ STD_CELL_LIBRARY now an optional environment variable- open_pdks config files are now responsible for setting the default
~ `to_tcl.py` updated to reflect that ^
~ Add ability to just set `METAL_LAYER_NAMES` in open_pdks
~ `open_pdks` -> 44a43c23c81b45b8e774ae7a84899a5a778b6b0b
  • Loading branch information
donn authored Aug 18, 2022
1 parent c0be543 commit 57f3f21
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/gh.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def export_env_alt(key, value):
"branch": os.getenv("BRANCH_NAME"),
"image": os.getenv("OPENLANE_IMAGE_NAME"),
"root": os.getenv("GITHUB_WORKSPACE"),
"pdk": os.getenv("PDK_ROOT"),
"pdk_root": os.getenv("PDK_ROOT"),
"pdk": os.getenv("PDK"),
"tool": os.getenv("TOOL"),
"event": SimpleNamespace(**{"name": os.getenv("GITHUB_EVENT_NAME")}),
"export_env": export_env,
Expand Down
6 changes: 4 additions & 2 deletions .github/scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
"-v",
f"{os.path.realpath(gh.root)}/designs:/openlane/install",
"-v",
f"{gh.pdk}:{gh.pdk}",
f"{gh.pdk_root}:{gh.pdk_root}",
"-u",
f"{user}:{group}",
"-e",
f"PDK_ROOT={gh.pdk}",
f"PDK_ROOT={gh.pdk_root}",
"-e",
f"PDK={gh.pdk}",
gh.image,
"bash",
"-c",
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/openlane_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ jobs:
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
- name: Set PDK Variant
run: |
echo "PDK=sky130A" >> $GITHUB_ENV
- name: Get Pyyaml
run: python3 -m pip install pyyaml

Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ export PDK_ROOT := $(shell $(PYTHON_BIN) -c "import os; print(os.path.realpath('
PDK_OPTS = -v $(PDK_ROOT):$(PDK_ROOT) -e PDK_ROOT=$(PDK_ROOT)

export PDK ?= sky130A
export STD_CELL_LIBRARY ?= sky130_fd_sc_hd

PDK_OPTS += -e PDK=$(PDK) -e STD_CELL_LIBRARY=$(STD_CELL_LIBRARY)

PDK_OPTS += -e PDK=$(PDK)

ifneq ($(STD_CELL_LIBRARY),)
export STD_CELL_LIBRARY ?= sky130_fd_sc_hd
PDK_OPTS += -e STD_CELL_LIBRARY=$(STD_CELL_LIBRARY)
endif

# ./designs is mounted over ./install so env.tcl is not found inside the Docker
# container if the user had previously installed it.
Expand Down
16 changes: 10 additions & 6 deletions configuration/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Variables information
This page describes user-configurable variables and their default values.

## Load Order
The default configuration files in this folder are loaded in the order described in `load_order.txt`.

## Required variables

|Variable|Description|
Expand Down Expand Up @@ -114,9 +118,9 @@ These variables worked initially, but they were too sky130 specific and will be

### Placement

| Variable | Description |
|---------------|---------------------------------------------------------------|
| `PL_TARGET_DENSITY` | The desired placement density of cells. It reflects how spread the cells would be on the core area. 1 = closely dense. 0 = widely spread <br> (Default: `($::env(FP_CORE_UTIL) + 5.0) / 100.0`)|
|Variable|Description|
|-|-|
| `PL_TARGET_DENSITY` | The desired placement density of cells. It reflects how spread the cells would be on the core area. 1 = closely dense. 0 = widely spread <br> (Default: `($::env(FP_CORE_UTIL) +5 ) / 100.0`)|
| `PL_TIME_DRIVEN` | Specifies whether the placer should use time driven placement. 0 = false, 1 = true <br> (Default: `1`)|
| `PL_LIB` | Specifies the library for time driven placement <br> (Default: `LIB_TYPICAL`)|
| `PL_BASIC_PLACEMENT` | Specifies whether the placer should run basic placement or not (by running initial placement, increasing the minimum overflow to 0.9, and limiting the number of iterations to 20). 0 = false, 1 = true <br> (Default: `0`) |
Expand Down Expand Up @@ -211,10 +215,10 @@ These variables worked initially, but they were too sky130 specific and will be

|Variable|Description|
|-|-|
| `SPEF_EXTRACTOR` | Specifies which spef extractor to use. Values: `openrcx` or (removed: `def2spef`). <br> (Default: `openrcx`) |
| `SPEF_EXTRACTOR` | Specifies which spef extractor to use. Values: `openrcx` or (**removed:** `def2spef`). <br> (Default: `openrcx`) |
| `RCX_MERGE_VIA_WIRE_RES` | Specifies whether to merge the via resistance with the wire resistance or separate it from the wire resistance. 1 = Merge via resistance, 0 = Separate via resistance <br> (Default: `1`)|
| `SPEF_WIRE_MODEL` | Specifies the wire model used in SPEF extraction. Options are `L` or `Pi` <br> (Default: `L`) |
| `SPEF_EDGE_CAP_FACTOR` | Specifies the edge capacitance factor used in SPEF extraction. Ranges from 0 to 1 <br> (Default: `1`) |
| `SPEF_WIRE_MODEL` | **Removed:** Specifies the wire model used in SPEF extraction. Options are `L` or `Pi` <br> (Default: `L`) |
| `SPEF_EDGE_CAP_FACTOR` | **Removed:** Specifies the edge capacitance factor used in SPEF extraction. Ranges from 0 to 1 <br> (Default: `1`) |

### Magic
|Variable|Description|
Expand Down
13 changes: 6 additions & 7 deletions configuration/extraction.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Options are rcx/def2spef
set ::env(SPEF_EXTRACTOR) "openrcx"

# OpenRCX default condigurations
# OpenRCX Config Variables
set ::env(RCX_CORNER_COUNT) 1
set ::env(RCX_MAX_RESISTANCE) 50
set ::env(RCX_COUPLING_THRESHOLD) 0.1
set ::env(RCX_CC_MODEL) 10
set ::env(RCX_CONTEXT_DEPTH) 5
set ::env(RCX_MERGE_VIA_WIRE_RES) 1

# DEF2SPEF default configurations
set ::env(SPEF_WIRE_MODEL) "L"
set ::env(SPEF_EDGE_CAP_FACTOR) 1


9 changes: 0 additions & 9 deletions configuration/general.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@
# 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.

# default pdk/scl
if { ![info exists ::env(PDK)] } {
set ::env(PDK) "sky130A"
}
if { ![info exists ::env(STD_CELL_LIBRARY)] } {
set ::env(STD_CELL_LIBRARY) "sky130_fd_sc_hd"
}

set ::env(USE_GPIO_PADS) 0

if { ![info exists ::env(QUIT_ON_MISMATCHES)] } {
Expand Down
2 changes: 1 addition & 1 deletion dependencies/tool_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
in_install: false
- name: open_pdks
repo: https://github.com/efabless/open_pdks
commit: e8294524e5f67c533c5d0c3afa0bcc5b2a5fa066
commit: 44a43c23c81b45b8e774ae7a84899a5a778b6b0b
build: ""
in_install: false
pdk: true
7 changes: 7 additions & 0 deletions designs/APU/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"CLOCK_NET": "clk",
"FP_CORE_UTIL": 35,
"CLOCK_PERIOD": 17,
"pdk::gf180mcuC": {
"DIODE_INSERTION_STRATEGY": "0",
"PL_RESIZER_HOLD_SLACK_MARGIN": 0.25,
"FP_CORE_UTIL": 25,
"PL_RESIZER_HOLD_MAX_BUFFER_PERCENT": 60,
"CLOCK_PERIOD": 75
},
"pdk::sky130*": {
"SYNTH_MAX_FANOUT": 6
}
Expand Down
7 changes: 6 additions & 1 deletion designs/PPU/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
"VERILOG_FILES": "dir::src/PPU.v",
"CLOCK_PORT": "clk",
"CLOCK_NET": "clk",
"pdk::gf180mcuC": {
"FP_CORE_UTIL": 40,
"SYNTH_MAX_FANOUT": 8,
"CLOCK_PERIOD": 18.0
},
"pdk::sky130*": {
"FP_CORE_UTIL": 20,
"SYNTH_MAX_FANOUT": 8,
"FP_CORE_UTIL": 20,
"PL_TARGET_DENSITY": 0.25,
"CLOCK_PERIOD": 18.0
}
Expand Down
6 changes: 6 additions & 0 deletions designs/spm/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,11 @@
"scl::sky130_fd_sc_ms": {
"CLOCK_PERIOD": 10
}
},
"pdk::gf180mcuC": {
"CLOCK_PERIOD": 24.0,
"FP_CORE_UTIL": 40,
"SYNTH_MAX_FANOUT": 4,
"PL_TARGET_DENSITY": 0.45
}
}
2 changes: 1 addition & 1 deletion docs/source/pdk_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This section defines the neccessary variables for PDK configuration file. Note t
| `FP_PDN_CORE_RING_VOFFSET` | Defines the offset for the vertical layer used to create the core ring in the PDN. <br> (Example: `20`) | |
| `FP_PDN_CORE_RING_HOFFSET` | Defines the offset for the horizontal layer used to create the core ring in the PDN. <br> (Example: `20`) | |
| `WIRE_RC_LAYER` | The metal layer used in estimate parastics `set_wire_rc`. <br> (Example: `met1`) ||
| `GLB_RT_LAYER_ADJUSTMENTS` | Layer-specific reductions in the routing capacity of the edges between the cells in the global routing graph, delimited by commas. Values range from 0 to 1. <br> (Example: `0.99,0,0,0,0,0`)
| `GRT_LAYER_ADJUSTMENTS` | Layer-specific reductions in the routing capacity of the edges between the cells in the global routing graph, delimited by commas. Values range from 0 to 1. <br> (Example: `0.99,0,0,0,0,0`)
| `FP_IO_HLAYER` | The metal layer on which to place the io pins horizontally (top and bottom of the die). <br>(Example: `met3`)|
| `FP_IO_VLAYER` | The metal layer on which to place the io pins vertically (sides of the die) <br> (Example: `met2`)|
| `RT_MIN_LAYER` | The lowest metal layer to route on. <br>(Example: `met1`)|
Expand Down
8 changes: 6 additions & 2 deletions scripts/config/to_tcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def process_config_dict_recursive(config_in: Dict[str, Any], state: State):
process_config_dict_recursive(value, state)
elif key.startswith(SCL_PREFIX):
scl_match = key[len(SCL_PREFIX) :]
if fnmatch.fnmatch(state.vars[SCL_VAR], scl_match):
if state.vars[SCL_VAR] is not None and fnmatch.fnmatch(
state.vars[SCL_VAR], scl_match
):
process_config_dict_recursive(value, state)
else:
raise InvalidConfig(
Expand Down Expand Up @@ -302,6 +304,8 @@ def process_config_dict(config_in: dict, pdk: str, scl: str, design_dir: str):
def write_key_value_pairs(file_in: TextIOWrapper, key_value_pairs: Dict[str, str]):
character_rx = re.compile(r"([{}])")
for key, value in key_value_pairs.items():
if value is None:
continue
if isinstance(value, str):
value = character_rx.sub(r"\\\1", value)
print(f"set ::env({key}) {{{value}}}", file=file_in)
Expand All @@ -318,7 +322,7 @@ def cli():
@click.option(
"-s",
"--scl",
required=True,
default=None,
help="The name of the standard cell library",
)
@click.option(
Expand Down
7 changes: 6 additions & 1 deletion scripts/odbpy/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ def __init__(self, lef_in, def_in):
if isinstance(lef_in, list) or isinstance(lef_in, tuple):
self.lef = []
for lef in lef_in:
self.lef.append(odb.read_lef(self.db, lef))
lef_read_result = odb.read_lef(self.db, lef)
if lef_read_result is None:
raise Exception(f"read_lef returned None for '{lef}'")
self.lef.append(lef_read_result)
self.sites = [lef.getSites() for lef in self.lef]
else:
self.lef = odb.read_lef(self.db, lef_in)
if self.lef is None:
raise Exception(f"read_lef returned None for '{lef_in}'")
self.sites = self.lef.getSites()
self.tech = self.db.getTech()

Expand Down
2 changes: 1 addition & 1 deletion scripts/openroad/layer_adjustments.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

set_global_routing_layer_adjustment * $::env(GRT_ADJUSTMENT)

set array [split $::env(GLB_RT_LAYER_ADJUSTMENTS) ","]
set array [split $::env(GRT_LAYER_ADJUSTMENTS) ","]

set i 0
foreach adjustment $array {
Expand Down
54 changes: 34 additions & 20 deletions scripts/tcl_commands/all.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ proc prep_lefs {args} {
if { $arg_values(-corner) == "nom" } {
puts_verbose "Extracting the number of available metal layers from $arg_values(-tech_lef)..."

try_catch openroad -python\
$::env(SCRIPTS_DIR)/odbpy/lefutil.py get_metal_layers\
-o $::env(TMP_DIR)/layers.list\
$arg_values(-tech_lef)

set ::env(TECH_METAL_LAYERS) [cat $::env(TMP_DIR)/layers.list]
if { [info exists ::env(METAL_LAYER_NAMES)] } {
set ::env(TECH_METAL_LAYERS) $::env(METAL_LAYER_NAMES)
} else {
try_catch openroad -python\
$::env(SCRIPTS_DIR)/odbpy/lefutil.py get_metal_layers\
-o $::env(TMP_DIR)/layers.list\
$arg_values(-tech_lef)
set ::env(TECH_METAL_LAYERS) [cat $::env(TMP_DIR)/layers.list]
}
set ::env(MAX_METAL_LAYER) [llength $::env(TECH_METAL_LAYERS)]

puts_verbose "The available metal layers ($::env(MAX_METAL_LAYER)) are $::env(TECH_METAL_LAYERS)."
Expand Down Expand Up @@ -268,16 +271,17 @@ proc source_config {args} {
if { $ext == ".tcl" } {
# for trusted end-users only
exec cp $config_file $config_in_path
source $config_file
} elseif { $ext == ".json" } {
set cmd "python3 $::env(SCRIPTS_DIR)/config/to_tcl.py from-json\
--pdk $::env(PDK) --scl $::env(STD_CELL_LIBRARY)\
--output $config_in_path\
--design-dir $::env(DESIGN_DIR)\
$config_file
"

if { [catch {exec {*}$cmd} errmsg] } {
set scl NULL
set arg_list [list]
lappend arg_list --pdk $::env(PDK)
if { [info exists ::env(STD_CELL_LIBRARY)] } {
lappend arg_list --scl $::env(STD_CELL_LIBRARY)
}
lappend arg_list --output $config_in_path
lappend arg_list --design-dir $::env(DESIGN_DIR)

if { [catch {exec python3 $::env(SCRIPTS_DIR)/config/to_tcl.py from-json $config_file {*}$arg_list} errmsg] } {
puts_err $errmsg
exit -1
}
Expand All @@ -286,7 +290,15 @@ proc source_config {args} {
puts_err "$config_file error: unsupported extension '$ext'"
return -code error
}
source $config_in_path


if { ![info exists ::env(STD_CELL_LIBRARY)] } {
set ::env(STD_CELL_LIBRARY) {}
source $config_in_path
unset ::env(STD_CELL_LIBRARY)
} else {
source $config_in_path
}
}

proc load_overrides {overrides} {
Expand Down Expand Up @@ -438,6 +450,10 @@ proc prep {args} {
set ::env(PDKPATH) $::env(PDK_ROOT)/$::env(PDK)
}

# Source PDK and SCL specific configurations
set pdk_config $::env(PDK_ROOT)/$::env(PDK)/libs.tech/openlane/config.tcl
source $pdk_config

if { ! [info exists ::env(STD_CELL_LIBRARY)] } {
puts_err "STD_CELL_LIBRARY is not specified."
return -code error
Expand All @@ -456,14 +472,11 @@ proc prep {args} {
set ::env(PDN_CFG) $::env(SCRIPTS_DIR)/openroad/pdn_cfg.tcl
}

# Source PDK and SCL specific configurations
set pdk_config $::env(PDK_ROOT)/$::env(PDK)/libs.tech/openlane/config.tcl
set scl_config $::env(PDK_ROOT)/$::env(PDK)/libs.tech/openlane/$::env(STD_CELL_LIBRARY)/config.tcl
source $pdk_config
source $scl_config

# Re-source/re-override to make sure it overrides any configurations from the previous two sources
source $run_path/config_in.tcl
source_config -run_path $run_path $::env(DESIGN_CONFIG)
if { [info exists arg_values(-override_env)] } {
load_overrides $arg_values(-override_env)
}
Expand All @@ -488,6 +501,7 @@ proc prep {args} {
handle_deprecated_config GLB_RT_OBS GRT_OBS;
handle_deprecated_config GLB_RT_ADJUSTMENT GRT_ADJUSTMENT;
handle_deprecated_config GLB_RT_MACRO_EXTENSION GRT_MACRO_EXTENSION;
handle_deprecated_config GLB_RT_LAYER_ADJUSTMENTS GRT_LAYER_ADJUSTMENTS;

handle_deprecated_config RUN_ROUTING_DETAILED RUN_DRT; # Why the hell is this even an option?

Expand Down
6 changes: 4 additions & 2 deletions scripts/tcl_commands/klayout.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@ proc run_klayout_gds_xor {args} {
-o [index_file $::env(signoff_reports)/xor.rpt]
}
} else {
puts_warn "$arg_values(-layout2) wasn't found. Skipping GDS XOR."
set layout2_rel [relpath . $arg_values(-layout2)]
puts_warn "'$layout2_rel' wasn't found. Skipping GDS XOR."
}
} else {
puts_warn "$arg_values(-layout1) wasn't found. Skipping GDS XOR."
set layout1_rel [relpath . $arg_values(-layout1)]
puts_warn "'$layout1_rel' wasn't found. Skipping GDS XOR."
}
TIMER::timer_stop
exec echo "[TIMER::get_runtime]" | python3 $::env(SCRIPTS_DIR)/write_runtime.py "xor - klayout"
Expand Down

0 comments on commit 57f3f21

Please sign in to comment.