blob: 109dd3601942a2bbacc9b77aa724dc91749c8635 [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
9$MAGIC -rcfile $PDKPATH/libs.tech/magic/current/sky130A.magicrc -dnull -noconsole << EOX
10drc off
11lef read $1.lef
12load $1
13save $1.lef.mag
14#writeall force $1.lef.mag
15
16 # copy GDS properties from the MAG view into the MAGLEF view
17 set gds_properties [list]
18 set fp [open $1.mag r]
19 set mag_lines [split [read \$fp] "\n"]
20 foreach line \$mag_lines {
21 if { [string first "string GDS_" \$line] != -1 } {
22 lappend gds_properties \$line
23 }
24 }
25 close \$fp
26 set fp [open $1.lef.mag r]
27 set mag_lines [split [read \$fp] "\n"]
28 set new_mag_lines [list]
29 foreach line \$mag_lines {
30 if { [string first "<< end >>" \$line] != -1 } {
31 lappend new_mag_lines [join \$gds_properties "\n"]
32 }
33 lappend new_mag_lines \$line
34 }
35 close \$fp
36 set fp [open $1.lef.mag w]
37 puts \$fp [join \$new_mag_lines "\n"]
38 close \$fp
39
40
41quit
42EOX
43
44mv -f $1.lef.mag ../maglef/$1.mag
45rm -f $1.lef