Merge pull request #31 from agorararmard/mkk-scripts
Mkk scripts
diff --git a/scripts/core_scripts/README.md b/scripts/core_scripts/README.md
new file mode 100644
index 0000000..daa5515
--- /dev/null
+++ b/scripts/core_scripts/README.md
@@ -0,0 +1,3 @@
+# What is this?
+
+Core scripts are doing the actual work, scripts under ../scripts are the ones that should be used.
\ No newline at end of file
diff --git a/scripts/core_scripts/magic-drc.sh b/scripts/core_scripts/magic-drc.sh
new file mode 100644
index 0000000..d2d6549
--- /dev/null
+++ b/scripts/core_scripts/magic-drc.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./magic-drc.sh <target_path> <design_name> <pdk-root> <target-type> <pdk-name> <output_path>
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export TARGET_TYPE=$4
+export PDK=$5
+export OUT_DIR=$6
+export TCL_CALL_PATH=${7:-$(pwd)}
+
+echo "Running Magic..."
+export MAGIC_MAGICRC=$PDK_ROOT/$PDK/libs.tech/magic/sky130A.magicrc
+
+magic \
+ -noconsole \
+ -dnull \
+ -rcfile $MAGIC_MAGICRC \
+ $TCL_CALL_PATH/magic-drc.tcl \
+ </dev/null \
+ |& tee $OUT_DIR/magic_drc.log
+
+TEST=$OUT_DIR/$DESIGN_NAME.magic.drc
+
+crashSignal=$(find $TEST)
+if ! [[ $crashSignal ]]; then echo "DRC Check FAILED"; exit -1; fi
+
+
+Test_Magic_violations=$(grep "COUNT: " $TEST -s | tail -1 | sed -r 's/[^0-9]*//g')
+if ! [[ $Test_Magic_violations ]]; then Test_Magic_violations=-1; fi
+if [ $Test_Magic_violations -ne -1 ]; then Test_Magic_violations=$(((Test_Magic_violations+3)/4)); fi
+
+echo "Test # of DRC Violations:"
+echo $Test_Magic_violations
+
+if [ 0 -ne $Test_Magic_violations ]; then echo "DRC Check FAILED"; exit -1; fi
+
+echo "DRC Check Passed"
+exit 0
diff --git a/scripts/core_scripts/magic-drc.tcl b/scripts/core_scripts/magic-drc.tcl
new file mode 100755
index 0000000..3db318e
--- /dev/null
+++ b/scripts/core_scripts/magic-drc.tcl
@@ -0,0 +1,73 @@
+# Copyright 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.
+
+if { $::env(TARGET_TYPE) == "gds"} {
+ gds read $::env(TARGET_DIR)/$::env(DESIGN_NAME).gds
+} else {
+ if { $::env(TARGET_TYPE) == "mag" } {
+ load $::env(TARGET_DIR)/$::env(DESIGN_NAME).mag
+ } else {
+ def read $::env(TARGET_DIR)/$::env(DESIGN_NAME).def
+ }
+}
+
+set fout [open $::env(OUT_DIR)/$::env(DESIGN_NAME).magic.drc w]
+set oscale [cif scale out]
+set cell_name $::env(DESIGN_NAME)
+magic::suspendall
+puts stdout "\[INFO\]: Loading $cell_name\n"
+flush stdout
+load $cell_name
+select top cell
+drc euclidean on
+drc style drc(full)
+drc check
+set drcresult [drc listall why]
+
+
+set count 0
+puts $fout "$cell_name"
+puts $fout "----------------------------------------"
+foreach {errtype coordlist} $drcresult {
+ puts $fout $errtype
+ puts $fout "----------------------------------------"
+ foreach coord $coordlist {
+ set bllx [expr {$oscale * [lindex $coord 0]}]
+ set blly [expr {$oscale * [lindex $coord 1]}]
+ set burx [expr {$oscale * [lindex $coord 2]}]
+ set bury [expr {$oscale * [lindex $coord 3]}]
+ set coords [format " %.3f %.3f %.3f %.3f" $bllx $blly $burx $bury]
+ puts $fout "$coords"
+ set count [expr {$count + 1} ]
+ }
+ puts $fout "----------------------------------------"
+}
+
+puts $fout "\[INFO\]: COUNT: $count"
+puts $fout "\[INFO\]: Should be divided by 3 or 4"
+
+puts $fout ""
+close $fout
+
+puts stdout "\[INFO\]: COUNT: $count"
+puts stdout "\[INFO\]: Should be divided by 3 or 4"
+puts stdout "\[INFO\]: DRC Checking DONE ($::env(OUT_DIR)/$::env(DESIGN_NAME).magic.drc)"
+flush stdout
+
+puts stdout "\[INFO\]: Saving mag view with DRC errors($::env(OUT_DIR)/$::env(DESIGN_NAME).magic.drc.mag)"
+# WARNING: changes the name of the cell; keep as last step
+save $::env(OUT_DIR)/$::env(DESIGN_NAME).magic.drc.mag
+puts stdout "\[INFO\]: Saved"
+
+exit 0
diff --git a/scripts/core_scripts/magic-ext.sh b/scripts/core_scripts/magic-ext.sh
new file mode 100644
index 0000000..bd51abd
--- /dev/null
+++ b/scripts/core_scripts/magic-ext.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./magic-ext.sh <target_path> <design_name> <pdk-root> <target-type> <pdk-name> <output_path>
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export TARGET_TYPE=$4
+export PDK=$5
+export OUT_DIR=$6
+export TCL_CALL_PATH=${7:-$(pwd)}
+
+echo "Running Magic..."
+export MAGIC_MAGICRC=$PDK_ROOT/$PDK/libs.tech/magic/sky130A.magicrc
+
+magic \
+ -noconsole \
+ -dnull \
+ -rcfile $MAGIC_MAGICRC \
+ $TCL_CALL_PATH/magic-ext.tcl \
+ </dev/null \
+ |& tee $OUT_DIR/magic_ext.log
diff --git a/scripts/core_scripts/magic-ext.tcl b/scripts/core_scripts/magic-ext.tcl
new file mode 100644
index 0000000..a67ba3b
--- /dev/null
+++ b/scripts/core_scripts/magic-ext.tcl
@@ -0,0 +1,43 @@
+#!/usr/bin/tclsh
+# Copyright 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.
+
+
+puts "Performing Spice Extractions..."
+
+if { ![file isdirectory $::env(OUT_DIR)] } {
+ exec mkdir $::env(OUT_DIR)/
+}
+
+
+if { $::env(TARGET_TYPE) == "gds"} {
+ gds read $::env(TARGET_DIR)/$::env(DESIGN_NAME).gds
+} else {
+ if { $::env(TARGET_TYPE) == "mag" } {
+ load $::env(TARGET_DIR)/$::env(DESIGN_NAME).mag
+ } else {
+ def read $::env(TARGET_DIR)/$::env(DESIGN_NAME).def
+ }
+}
+
+load $::env(DESIGN_NAME) -dereference
+cd $::env(OUT_DIR)/
+extract do local
+# extract warn all
+extract
+ext2spice lvs
+ext2spice $::env(DESIGN_NAME).ext
+feedback save $::env(OUT_DIR)/magic_extraction_feedback.txt
+
+puts "Done!"
\ No newline at end of file
diff --git a/scripts/drc-def-sky130A.sh b/scripts/drc-def-sky130A.sh
new file mode 100644
index 0000000..5e009ec
--- /dev/null
+++ b/scripts/drc-def-sky130A.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./drc-def-sky130A.sh <target_path> <design_name> <pdk-root> [<output_path> default is <target_path>/results/]
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export OUT_DIR=${4:-$TARGET_DIR/results/}
+export TCL_CALL_PATH=$(pwd)/core_scripts
+
+if ! [[ -d "$OUT_DIR" ]]
+then
+ mkdir $OUT_DIR
+fi
+bash ./core_scripts/magic-drc.sh $TARGET_DIR $DESIGN_NAME $PDK_ROOT "def" "sky130A" $OUT_DIR $TCL_CALL_PATH
diff --git a/scripts/drc-gds-sky130A.sh b/scripts/drc-gds-sky130A.sh
new file mode 100644
index 0000000..aff4cec
--- /dev/null
+++ b/scripts/drc-gds-sky130A.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./drc-gds-sky130A.sh <target_path> <design_name> <pdk-root> [<output_path> default is <target_path>/results/]
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export OUT_DIR=${4:-$TARGET_DIR/results/}
+export TCL_CALL_PATH=$(pwd)/core_scripts
+
+if ! [[ -d "$OUT_DIR" ]]
+then
+ mkdir $OUT_DIR
+fi
+
+bash ./core_scripts/magic-drc.sh $TARGET_DIR $DESIGN_NAME $PDK_ROOT "gds" "sky130A" $OUT_DIR $TCL_CALL_PATH
diff --git a/scripts/drc-mag-sky130A.sh b/scripts/drc-mag-sky130A.sh
new file mode 100644
index 0000000..9fedad3
--- /dev/null
+++ b/scripts/drc-mag-sky130A.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./drc-mag-sky130A.sh <target_path> <design_name> <pdk-root> [<output_path> default is <target_path>/results/]
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export OUT_DIR=${4:-$TARGET_DIR/results/}
+export TCL_CALL_PATH=$(pwd)/core_scripts
+
+if ! [[ -d "$OUT_DIR" ]]
+then
+ mkdir $OUT_DIR
+fi
+bash ./core_scripts/magic-drc.sh $TARGET_DIR $DESIGN_NAME $PDK_ROOT "mag" "sky130A" $OUT_DIR $TCL_CALL_PATH
diff --git a/scripts/README.md b/scripts/dumped_scripts/README.md
similarity index 100%
rename from scripts/README.md
rename to scripts/dumped_scripts/README.md
diff --git a/scripts/addmpwseal.tcl b/scripts/dumped_scripts/addmpwseal.tcl
similarity index 100%
rename from scripts/addmpwseal.tcl
rename to scripts/dumped_scripts/addmpwseal.tcl
diff --git a/scripts/create-project.sh b/scripts/dumped_scripts/create-project.sh
similarity index 100%
rename from scripts/create-project.sh
rename to scripts/dumped_scripts/create-project.sh
diff --git a/scripts/dot.magicrc b/scripts/dumped_scripts/dot.magicrc
similarity index 100%
rename from scripts/dot.magicrc
rename to scripts/dumped_scripts/dot.magicrc
diff --git a/scripts/drc-mag.sh b/scripts/dumped_scripts/drc-mag.sh
similarity index 100%
rename from scripts/drc-mag.sh
rename to scripts/dumped_scripts/drc-mag.sh
diff --git a/scripts/drc-maglef.sh b/scripts/dumped_scripts/drc-maglef.sh
similarity index 100%
rename from scripts/drc-maglef.sh
rename to scripts/dumped_scripts/drc-maglef.sh
diff --git a/scripts/drc.sh b/scripts/dumped_scripts/drc.sh
similarity index 100%
rename from scripts/drc.sh
rename to scripts/dumped_scripts/drc.sh
diff --git a/scripts/edit.tcl b/scripts/dumped_scripts/edit.tcl
similarity index 100%
rename from scripts/edit.tcl
rename to scripts/dumped_scripts/edit.tcl
diff --git a/scripts/ext-gds.sh b/scripts/dumped_scripts/ext-gds.sh
similarity index 100%
rename from scripts/ext-gds.sh
rename to scripts/dumped_scripts/ext-gds.sh
diff --git a/scripts/ext-mag.sh b/scripts/dumped_scripts/ext-mag.sh
similarity index 100%
rename from scripts/ext-mag.sh
rename to scripts/dumped_scripts/ext-mag.sh
diff --git a/scripts/ext.sh b/scripts/dumped_scripts/ext.sh
similarity index 100%
rename from scripts/ext.sh
rename to scripts/dumped_scripts/ext.sh
diff --git a/scripts/extract.tcl b/scripts/dumped_scripts/extract.tcl
similarity index 100%
rename from scripts/extract.tcl
rename to scripts/dumped_scripts/extract.tcl
diff --git a/scripts/lvs.sh b/scripts/dumped_scripts/lvs.sh
similarity index 100%
rename from scripts/lvs.sh
rename to scripts/dumped_scripts/lvs.sh
diff --git a/scripts/mag2gds.tcl b/scripts/dumped_scripts/mag2gds.tcl
similarity index 100%
rename from scripts/mag2gds.tcl
rename to scripts/dumped_scripts/mag2gds.tcl
diff --git a/scripts/magic_drc.tcl b/scripts/dumped_scripts/magic_drc.tcl
similarity index 100%
rename from scripts/magic_drc.tcl
rename to scripts/dumped_scripts/magic_drc.tcl
diff --git a/scripts/pfg.sh b/scripts/dumped_scripts/pfg.sh
similarity index 100%
rename from scripts/pfg.sh
rename to scripts/dumped_scripts/pfg.sh
diff --git a/scripts/run_openram_tc_1kb.sh b/scripts/dumped_scripts/run_openram_tc_1kb.sh
similarity index 100%
rename from scripts/run_openram_tc_1kb.sh
rename to scripts/dumped_scripts/run_openram_tc_1kb.sh
diff --git a/scripts/setup.tcl b/scripts/dumped_scripts/setup.tcl
similarity index 100%
rename from scripts/setup.tcl
rename to scripts/dumped_scripts/setup.tcl
diff --git a/scripts/wrap.tcl b/scripts/dumped_scripts/wrap.tcl
similarity index 100%
rename from scripts/wrap.tcl
rename to scripts/dumped_scripts/wrap.tcl
diff --git a/scripts/wrap2.tcl b/scripts/dumped_scripts/wrap2.tcl
similarity index 100%
rename from scripts/wrap2.tcl
rename to scripts/dumped_scripts/wrap2.tcl
diff --git a/scripts/dumped_scripts/xor.drc b/scripts/dumped_scripts/xor.drc
new file mode 100644
index 0000000..14896ee
--- /dev/null
+++ b/scripts/dumped_scripts/xor.drc
@@ -0,0 +1,42 @@
+# A general XOR script
+# (https://www.klayout.de/forum/discussion/100/xor-vs-diff-tool)
+# This script uses KLayout's DRC language to implement a generic
+# XOR between two layouts. The name of the layouts is given
+# in $a and $b.
+
+# For layout-to-layout XOR with multiple cores, run this script with
+# ./klayout -r xor.drc -rd thr=NUM_CORES -rd top_cell=TOP_CELL_NAME -rd a=a.gds -rd b=b.gds -rd ol=xor.gds -zz
+# (replace NUM_CORES by the desired number of cores to utilize
+
+# enable timing output
+verbose
+
+# set up input a
+a = source($a, $top_cell)
+
+# set up input b
+b = source($b, $top_cell)
+
+$o && report("XOR #{$a} vs. #{$b}", $o)
+$ol && target($ol, $co || "XOR")
+
+$thr && threads($thr) || threads(2)
+
+# collect all common layers
+layers = {}
+[ a.layout, b.layout ].each do |ly|
+ ly.layer_indices.each do |li|
+ i = ly.get_info(li)
+ layers[i.to_s] = i
+ end
+end
+
+# perform the XOR's
+layers.keys.sort.each do |l|
+ i = layers[l]
+ info("--- Running XOR for #{l} ---")
+ x = a.input(l) ^ b.input(l)
+ info("XOR differences: #{x.data.size}")
+ $o && x.output(l, "XOR results for layer #{l}")
+ $ol && x.output(i.layer, i.datatype, i.name)
+end
diff --git a/scripts/dumped_scripts/xor.sh b/scripts/dumped_scripts/xor.sh
new file mode 100755
index 0000000..aca6c48
--- /dev/null
+++ b/scripts/dumped_scripts/xor.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+: ${1?"Usage: $0 file1.gds file2.gds <top_level_module_name>"}
+: ${2?"Usage: $0 file1.gds file2.gds <top_level_module_name>"}
+: ${3?"Usage: $0 file1.gds file2.gds <top_level_module_name>"}
+
+klayout -r $(dirname $0)/xor.drc -rd top_cell=$3 -rd a=$1 -rd b=$2 -rd thr=$(nproc) -rd ol=xor.gds -zz
diff --git a/scripts/ext-def-sky130A.sh b/scripts/ext-def-sky130A.sh
new file mode 100644
index 0000000..0977ccf
--- /dev/null
+++ b/scripts/ext-def-sky130A.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./ext-def-sky130A.sh <target_path> <design_name> <pdk-root> [<output_path> default is <target_path>/results/]
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export OUT_DIR=${4:-$TARGET_DIR/results/}
+export TCL_CALL_PATH=$(pwd)/core_scripts
+
+if ! [[ -d "$OUT_DIR" ]]
+then
+ mkdir $OUT_DIR
+fi
+
+bash ./core_scripts/magic-ext.sh $TARGET_DIR $DESIGN_NAME $PDK_ROOT "def" "sky130A" $OUT_DIR $TCL_CALL_PATH
diff --git a/scripts/ext-gds-sky130A.sh b/scripts/ext-gds-sky130A.sh
new file mode 100644
index 0000000..d7ddb64
--- /dev/null
+++ b/scripts/ext-gds-sky130A.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./ext-gds-sky130A.sh <target_path> <design_name> <pdk-root> [<output_path> default is <target_path>/results/]
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export OUT_DIR=${4:-$TARGET_DIR/results/}
+export TCL_CALL_PATH=$(pwd)/core_scripts
+
+if ! [[ -d "$OUT_DIR" ]]
+then
+ mkdir $OUT_DIR
+fi
+
+bash ./core_scripts/magic-ext.sh $TARGET_DIR $DESIGN_NAME $PDK_ROOT "gds" "sky130A" $OUT_DIR $TCL_CALL_PATH
diff --git a/scripts/ext-mag-sky130A.sh b/scripts/ext-mag-sky130A.sh
new file mode 100644
index 0000000..16f110f
--- /dev/null
+++ b/scripts/ext-mag-sky130A.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# Copyright 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.
+
+# To call: ./ext-mag-sky130A.sh <target_path> <design_name> <pdk-root> [<output_path> default is <target_path>/results/]
+
+export TARGET_DIR=$1
+export DESIGN_NAME=$2
+export PDK_ROOT=$3
+export OUT_DIR=${4:-$TARGET_DIR/results/}
+export TCL_CALL_PATH=$(pwd)/core_scripts
+
+if ! [[ -d "$OUT_DIR" ]]
+then
+ mkdir $OUT_DIR
+fi
+
+bash ./core_scripts/magic-ext.sh $TARGET_DIR $DESIGN_NAME $PDK_ROOT "mag" "sky130A" $OUT_DIR $TCL_CALL_PATH