blob: 51082fd3f095b73dd79001138ca379c03ed86240 [file] [log] [blame]
mkk91ada922020-12-02 09:08:26 -08001#!/bin/bash
2
3export PDK_ROOT=~/foss/pdks/open_pdks/sky130;
4export MAGTYPE=mag ;
5export PDKPATH=$PDK_ROOT/sky130A ;
6export MAGIC=magic
7
8$MAGIC -rcfile $PDKPATH/libs.tech/magic/current/sky130A.magicrc -dnull -noconsole <<EOF
9drc off
10load $1.mag
11select top cell
12expand
13lef write $1.lef -hide
14quit -noprompt
15EOF
16
17$MAGIC -rcfile $PDKPATH/libs.tech/magic/current/sky130A.magicrc -dnull -noconsole << EOX
18drc off
19lef read $1.lef
20load $1
21save $1.lef.mag
22#writeall force $1.lef.mag
23
24 # copy GDS properties from the MAG view into the MAGLEF view
25 set gds_properties [list]
26 set fp [open $1.mag r]
27 set mag_lines [split [read \$fp] "\n"]
28 foreach line \$mag_lines {
29 if { [string first "string GDS_" \$line] != -1 } {
30 lappend gds_properties \$line
31 }
32 }
33 close \$fp
34 set fp [open $1.lef.mag r]
35 set mag_lines [split [read \$fp] "\n"]
36 set new_mag_lines [list]
37 foreach line \$mag_lines {
38 if { [string first "<< end >>" \$line] != -1 } {
39 lappend new_mag_lines [join \$gds_properties "\n"]
40 }
41 lappend new_mag_lines \$line
42 }
43 close \$fp
44 set fp [open $1.lef.mag w]
45 puts \$fp [join \$new_mag_lines "\n"]
46 close \$fp
47
48
49quit
50EOX
51
52mv -f $1.lef.mag ../maglef/$1.mag
53rm -f $1.lef