caravel/mag/.magicrc

110 lines
3.7 KiB
Plaintext
Executable File

# SPDX-FileCopyrightText: 2020 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.
#
# SPDX-License-Identifier: Apache-2.0
# Allow override of PDK path from environment variable PDKPATH. Failing
# that, fall back on definitions of PDK_ROOT and PDK. If either of those
# fails, substitute a default. If PDKPATH has been specified, then get
# PDK_VARIANT from the tail of PDKPATH.
if {[catch {set PDKPATH $env(PDKPATH)}]} {
if {[catch {set PDK_ROOT $env(PDK_ROOT)}]} {
set PDK_ROOT /usr/share/pdk
}
if {[catch {set PDK_VARIANT $env(PDK)}]} {
set PDK_VARIANT sky130A
}
set PDKPATH ${PDK_ROOT}/${PDK_VARIANT}
} else {
set PDK_VARIANT [file tail ${PDKPATH}]
}
puts stdout "Sourcing design .magicrc for technology $PDK_VARIANT ..."
# Put grid on 0.005 pitch. This is important, as some commands don't
# rescale the grid automatically (such as lef read?).
set scalefac [tech lambda]
if {[lindex $scalefac 1] < 2} {
scalegrid 1 2
}
drc off
drc euclidean on
# loading technology
tech load $PDKPATH/libs.tech/magic/${PDK_VARIANT}.tech
# load device generator
source $PDKPATH/libs.tech/magic/${PDK_VARIANT}.tcl
# load bind keys (optional)
# source $PDKPATH/libs.tech/magic/${PDK_VARIANT}-BindKeys
# set units to lambda grid
snap lambda
# set sky130 standard power, ground, and substrate names
set VDD VPWR
set GND VGND
set SUB VSUBS
# Allow override of type of magic library views used, "mag" or "maglef",
# from environment variable MAGTYPE
if {[catch {set MAGTYPE $env(MAGTYPE)}]} {
set MAGTYPE maglef
}
path search [concat "../$MAGTYPE" [path search]]
# add path to reference cells
if {[file isdir ${PDKPATH}/libs.ref/${MAGTYPE}]} {
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_pr
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_io
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_sc_hd
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_sc_hdll
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_sc_hs
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_sc_hvl
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_sc_lp
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_sc_ls
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_fd_sc_ms
addpath ${PDKPATH}/libs.ref/${MAGTYPE}/sky130_osu_sc
addpath ${PDKPATH}/libs.ref/mag/sky130_ml_xx_hd
} else {
addpath ${PDKPATH}/libs.ref/sky130_fd_pr/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_io/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_sc_hd/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_sc_hdll/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_sc_hs/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_sc_hvl/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_sc_lp/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_sc_ls/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_fd_sc_ms/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_osu_sc/${MAGTYPE}
addpath ${PDKPATH}/libs.ref/sky130_ml_xx_hd/mag
}
addpath hexdigits
addpath ../subcells/simple_por/mag
# add path to GDS cells
# add path to IP from catalog. This procedure defined in the PDK script.
catch {magic::query_mylib_ip}
# add path to local IP from user design space. Defined in the PDK script.
catch {magic::query_my_projects}