added ./scripts folder with misc purposes. THIS IS WORK IN PROGRESS
diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..c81d547 --- /dev/null +++ b/scripts/README.md
@@ -0,0 +1,2 @@ +This folder contains miscelleneous useful scripts +THIS IS STILL WORK IN PROGRESSS - SUGGESTIONS ARE WELCOME THROUGH ISSUES
diff --git a/scripts/addmpwseal.tcl b/scripts/addmpwseal.tcl new file mode 100644 index 0000000..695ced2 --- /dev/null +++ b/scripts/addmpwseal.tcl
@@ -0,0 +1,11 @@ +drc off +gds readonly true +gds read ../gds/sram_1rw1r_32_256_8_sky130_lp1.gds +load openram_tc_1kb.mag +select top cell +move origin -1015um -1272.5um +box position 0 0 +getcell advSeal_6um_gen +save +gds write ../gds/openram_tc_1kb.gds +
diff --git a/scripts/create-project.sh b/scripts/create-project.sh new file mode 100755 index 0000000..6817239 --- /dev/null +++ b/scripts/create-project.sh
@@ -0,0 +1,23 @@ +#!/bin/sh +cat <<'EOT' > .gitignore +.DS_Store +*.vcd +*.raw +*.vvp +a.out +EOT +mkdir scripts ; echo "This folder contains miscelleneous useful scripts" > scripts/README.md +mkdir def ; echo "This folder contains *.def files related to this project" > def/README.md +mkdir gds ; echo "This folder contains *.gds files related to this project" > gds/README.md +mkdir verilog ; echo "This folder contains *.v files related to this project" > verilog/README.md +mkdir mag ; echo "This folder contains *.mag files related to this project" > mag/README.md +mkdir lef ; echo "This folder contains *.lef files related to this project" > lef/README.md +mkdir macros ; echo "This folder contains subcell & macro files related to this project" > macros/README.md +mkdir doc ; echo "This folder contains documents related to this project" > doc/README.md +mkdir ngspice ; echo "This folder contains ngspice related files related to this project" > ngspice/README.md +mkdir openlane ; echo "This folder contains openlane related files related to this project" > openlane/README.md +mkdir pkg ; echo "This folder contains packaging-related files related to this project" > pkg/README.md +mkdir test ; echo "This folder contains test-related files related to this project" > test/README.md +mkdir xspice ; echo "This folder contains xspice files related to this project" > xspice/README.md +mkdir spi ; echo "This folder contains *.spi files related to this project" > spi/README.md +mkdir qflow ; echo "This folder contains qflow-related files related to this project" > qflow/README.md
diff --git a/scripts/dot.magicrc b/scripts/dot.magicrc new file mode 100644 index 0000000..029ee93 --- /dev/null +++ b/scripts/dot.magicrc
@@ -0,0 +1,49 @@ +puts stdout "Sourcing design .magicrc for technology sky130A ..." + +# 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 + +# default pdk +# set SW_PDK_ROOT "/ef/tech/SW.2" +set PDK "sky130A" +set SCL_VARIANT "sky130_fd_sc_hd" +set IO_VARIANT "sky130_fd_io" +set PDKPATH "$::env(SW_PDK_ROOT)/$PDK" + +# loading technology +tech load "$PDKPATH/libs.tech/magic/current/$PDK.tech" + +# load device generator +source "$PDKPATH/libs.tech/magic/current/$PDK.tcl" + + +# load bind keys (optional) +source "$PDKPATH/libs.tech/magic/current/$PDK-BindKeys" + +# set units to lambda grid +snap lambda + +# add path to reference cells +set MAGPATH "$PDKPATH/libs.ref/$SCL_VARIANT/mag/*.mag" + + +addpath "$PDKPATH/libs.ref/sky130_fd_pr_base/mag" +addpath "$PDKPATH/libs.ref/$IO_VARIANT/mag" +addpath "$PDKPATH/libs.ref/$SCL_VARIANT/mag" + +# addpath ${MAGPATH}/s8fmlt + +# 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}
diff --git a/scripts/drc-mag.sh b/scripts/drc-mag.sh new file mode 100644 index 0000000..075ce5a --- /dev/null +++ b/scripts/drc-mag.sh
@@ -0,0 +1,25 @@ +#!/bin/bash + +export MAGTYPE=mag ; +export BASE=/home/mk/zooz/ ; +export PDKPATH=$BASE/pdks/ef-skywater-s8/EFS8A ; + +magic -dnull -noconsole -rcfile $PDKPATH/libs.tech/magic/current/EFS8A.magicrc <<EOF +gds polygon subcell true +gds warning default +gds read $1.gds +load $1 +cellname delete \(UNNAMED\) +writeall force +select top cell +expand +drc on +drc euclidean on +drc check +drc catchup +drc listall +drc listall why +drc count total +drc count +quit -noprompt +EOF
diff --git a/scripts/drc-maglef.sh b/scripts/drc-maglef.sh new file mode 100644 index 0000000..6289f0b --- /dev/null +++ b/scripts/drc-maglef.sh
@@ -0,0 +1,25 @@ +#!/bin/bash + +export MAGTYPE=maglef ; +export BASE=/home/mk/zooz/ ; +export PDKPATH=$BASE/pdks/ef-skywater-s8/EFS8A ; + +magic -dnull -noconsole -rcfile $PDKPATH/libs.tech/magic/current/EFS8A.magicrc <<EOF +gds polygon subcell true +gds warning default +gds read $1.gds +load $1 +cellname delete \(UNNAMED\) +writeall force +select top cell +expand +drc on +drc euclidean on +drc check +drc catchup +drc listall +drc listall why +drc count total +drc count +quit -noprompt +EOF
diff --git a/scripts/drc.sh b/scripts/drc.sh new file mode 100755 index 0000000..075ce5a --- /dev/null +++ b/scripts/drc.sh
@@ -0,0 +1,25 @@ +#!/bin/bash + +export MAGTYPE=mag ; +export BASE=/home/mk/zooz/ ; +export PDKPATH=$BASE/pdks/ef-skywater-s8/EFS8A ; + +magic -dnull -noconsole -rcfile $PDKPATH/libs.tech/magic/current/EFS8A.magicrc <<EOF +gds polygon subcell true +gds warning default +gds read $1.gds +load $1 +cellname delete \(UNNAMED\) +writeall force +select top cell +expand +drc on +drc euclidean on +drc check +drc catchup +drc listall +drc listall why +drc count total +drc count +quit -noprompt +EOF
diff --git a/scripts/edit.tcl b/scripts/edit.tcl new file mode 100644 index 0000000..7b30db2 --- /dev/null +++ b/scripts/edit.tcl
@@ -0,0 +1,11 @@ +drc off +puts "Small delay..." +set macro_mags "digital_pll.mag lvlshiftdown.mag striVe2_soc.mag striVe_clkrst.mag striVe_spi.mag" + +gds readonly yes +gds rescale no +gds read ../gds/sram_1rw1r_32_256_8_sky130.gds +lef read ../lef/sram.abs.lef +foreach ff $macro_mags { drc off; load $ff -dereference; after 1000; select top cell; property LEFview TRUE } +load striVe2 -dereference +select top cell
diff --git a/scripts/ext-gds.sh b/scripts/ext-gds.sh new file mode 100644 index 0000000..b528d63 --- /dev/null +++ b/scripts/ext-gds.sh
@@ -0,0 +1,28 @@ +#!/bin/bash + +export MAGTYPE=maglef ; +export BASE=/home/mk/zooz/ ; +export PDKPATH=$BASE/pdks/ef-skywater-s8/EFS8A ; + +magic -dnull -noconsole -rcfile $PDKPATH/libs.tech/magic/current/EFS8A.magicrc <<EOF +gds polygon subcell true +gds warning default +gds read $1.gds +load $1.mag +save $1.mag +writeall force +select top cell +extract style ngspice(si) +extract +ext2spice hierarchy on +ext2spice format ngspice +ext2spice cthresh infinite +ext2spice rthresh infinite +ext2spice renumber offS +ext2spice scale off +ext2spice blackbox on +ext2spice subcircuit top auto +ext2spice global off +ext2spice $1.ext +quit -noprompt +EOF
diff --git a/scripts/ext-mag.sh b/scripts/ext-mag.sh new file mode 100644 index 0000000..cb3cfcc --- /dev/null +++ b/scripts/ext-mag.sh
@@ -0,0 +1,25 @@ +#!/bin/bash + +export MAGTYPE=mag ; +export BASE=/home/mk/zooz/ ; +export PDKPATH=$BASE/pdks/ef-skywater-s8/EFS8A ; + +magic -dnull -noconsole -rcfile $PDKPATH/libs.tech/magic/current/EFS8A.magicrc <<EOF +load $1.mag +save $1.mag +writeall force +select top cell +extract style ngspice(si) +extract +ext2spice hierarchy on +ext2spice format ngspice +ext2spice cthresh infinite +ext2spice rthresh infinite +ext2spice renumber offS +ext2spice scale off +ext2spice blackbox on +ext2spice subcircuit top auto +ext2spice global off +ext2spice $1.ext +quit -noprompt +EOF
diff --git a/scripts/ext.sh b/scripts/ext.sh new file mode 100644 index 0000000..3a68b67 --- /dev/null +++ b/scripts/ext.sh
@@ -0,0 +1,28 @@ +#!/bin/bash + +export MAGTYPE=maglef ; +export BASE=/home/mk/zooz/ ; +export PDKPATH=$BASE/pdks/ef-skywater-s8/EFS8A ; + +magic -dnull -noconsole -rcfile $PDKPATH/libs.tech/magic/current/EFS8A.magicrc <<EOF +gds polygon subcell true +gds warning default +gds read $1.gds +load $1.mag +save $1.mag +writeall force +select top cell +extract style ngspice(si) +extract +ext2spice hierarchy on +ext2spice format ngspice +ext2spice cthresh infinite +ext2spice rthresh infinite +ext2spice renumber off +ext2spice scale off +ext2spice blackbox on +ext2spice subcircuit top auto +ext2spice global off +ext2spice $1.ext +quit -noprompt +EOF
diff --git a/scripts/extract.tcl b/scripts/extract.tcl new file mode 100644 index 0000000..e043e66 --- /dev/null +++ b/scripts/extract.tcl
@@ -0,0 +1,16 @@ +lef read $::env(PDKPATH)/libs.ref/techLEF/scs8hd/scs8hd_tech.lef +set macro_mags "openram_tc_core.mag" + +# lef read ../lef/sram_1rw1r_32_256_8_sky130_lp1.lef + +foreach ff $macro_mags { drc off; after 500; load $ff -dereference; select top cell; property LEFview TRUE } + +load openram_tc_1kb -dereference + +select top cell +extract do local +extract +ext2spice lvs +ext2spice openram_tc_1kb.ext +feedback save extract.tcl.log +exit
diff --git a/scripts/lvs.sh b/scripts/lvs.sh new file mode 100755 index 0000000..33d010f --- /dev/null +++ b/scripts/lvs.sh
@@ -0,0 +1,7 @@ +#!/bin/sh +/ef/apps/bin/netgen -noconsole << EOF +readnet spice $1.spice +readnet spice $1.sp +lvs {$1.spice sram_2_16_sky130} {sram_2_16_sky130.sp sram_2_16_sky130} setup.tcl sram_2_16_sky130.lvs.report +quit +EOF
diff --git a/scripts/mag2gds.tcl b/scripts/mag2gds.tcl new file mode 100644 index 0000000..372a3a3 --- /dev/null +++ b/scripts/mag2gds.tcl
@@ -0,0 +1,18 @@ +# assumes an /ef tree or at least a symlink +drc off +gds readonly true +gds rescale false +set ::env(MAGTYPE) mag + +# gds read <hard macros read as-is.gds> +gds read ../gds/sram_1rw1r_32_256_8_sky130_lp1.gds + +load sram_1rw1r_32_256_8_sky130 -dereference +load openram_tc_core -dereference +load openram_tc_1kb -dereference + +select top cell + +cif *hier write disable + +gds write openram_tc_1kb.gds
diff --git a/scripts/magic_drc.tcl b/scripts/magic_drc.tcl new file mode 100755 index 0000000..9ea88fa --- /dev/null +++ b/scripts/magic_drc.tcl
@@ -0,0 +1,70 @@ +# 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. +set ::env(DESIGN_NAME) openram_tc_1kb +drc off +lef read ../lef/sram_1rw1r_32_256_8_sky130_lp1.lef +load sram_1rw1r_32_256_8_sky130 -dereference +load openram_tc_core -dereference +load openram_tc_1kb -dereference + +drc style drc(full) +drc euclidean on + +set fout [open drc.log 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 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(DESIGN_NAME).drc)" +flush stdout + +puts stdout "\[INFO\]: Saving mag view with DRC errors($::env(DESIGN_NAME).drc.mag)" +# WARNING: changes the name of the cell; keep as last step +save $::env(DESIGN_NAME).drc.mag +puts stdout "\[INFO\]: Saved" + +exit 0
diff --git a/scripts/pfg.sh b/scripts/pfg.sh new file mode 100755 index 0000000..5cc71b4 --- /dev/null +++ b/scripts/pfg.sh
@@ -0,0 +1,23 @@ +#!/bin/bash + +export PDKPATH=/home/mk/zooz/pdks/ef-skywater-s8/EFS8A +export MAGTYPE=mag + +padring \ +-L $PDKPATH/libs.ref/lef/s8iom0s8/s8iom0s8.lef \ +-L $PDKPATH/libs.ref/lef/s8iom0s8/power_pads_lib.lef \ +--def padframe.def padframe.cfg + +magic -rcfile $PDKPATH/libs.tech/magic/current/EFS8A.magicrc -noc -dnull <<EOF +def read padframe.def +save padframe +select top cell +lef write padframe.lef +gds write padframe.gds +exit +EOF + + + + +
diff --git a/scripts/run_openram_tc_1kb.sh b/scripts/run_openram_tc_1kb.sh new file mode 100755 index 0000000..d520971 --- /dev/null +++ b/scripts/run_openram_tc_1kb.sh
@@ -0,0 +1,8 @@ +#!/bin/bash +# +# Run netgen on striVe (top level) +# + +NETGEN_SETUP=$PDK_ROOT/EFS8A/libs.tech/netgen/EFS8A_setup.tcl + +netgen -batch lvs "../spi/openram_tc_1kb.spice openram_tc_1kb" "../verilog/gl/openram_tc_1kb.synthesis.v openram_tc_1kb" ${NETGEN_SETUP} openram_tc_1kb_comp.out -json | tee openram_tc_1kb_comp_lvs.log
diff --git a/scripts/setup.tcl b/scripts/setup.tcl new file mode 100644 index 0000000..c90e3bb --- /dev/null +++ b/scripts/setup.tcl
@@ -0,0 +1,12 @@ +# We must flatten these because the ports are disconnected +flatten class {-circuit1 dummy_cell_6t} +flatten class {-circuit1 dummy_cell_1rw_1r} +flatten class {-circuit1 dummy_cell_1w_1r} +flatten class {-circuit1 bitcell_array_0} +flatten class {-circuit1 pbitcell_0} +flatten class {-circuit1 pbitcell_1} +property {-circuit1 nshort} remove as ad ps pd +property {-circuit1 pshort} remove as ad ps pd +property {-circuit2 nshort} remove as ad ps pd +property {-circuit2 pshort} remove as ad ps pd +permute transistors
diff --git a/scripts/wrap.tcl b/scripts/wrap.tcl new file mode 100644 index 0000000..a8e5593 --- /dev/null +++ b/scripts/wrap.tcl
@@ -0,0 +1,13 @@ +drc off +gds readonly yes +gds rescale no + +gds read ../macros/sram/riscv-sky130/sram_1rw1r_32_256_8_sky130.gds +load sram_1rw1r_32_256_8_sky130 + +select top cell +property LEFview "TRUE" + +save pk_sram_1rw1r_32_256_8_sky130.mag + +# exec sed -i -E "/^.*GDS_END.*$/d" sram_1rw1r_32_256_8_sky130_original.mag
diff --git a/scripts/wrap2.tcl b/scripts/wrap2.tcl new file mode 100644 index 0000000..5ed83f1 --- /dev/null +++ b/scripts/wrap2.tcl
@@ -0,0 +1,21 @@ +drc off +gds readonly yes +gds rescale no + +lef read ../lef/sram.abs.con.lef +load sram_1rw1r_32_256_8_sky130 + +select top cell +expand +property LEFview "" +property LEFsymmetry "" +property LEFclass "" + +box position 5um 5um +getcell pk_sram_1rw1r_32_256_8_sky130 + +save sram_1rw1r_32_256_8_sky130.mag + +gds write output.gds + +save