blob: 51082fd3f095b73dd79001138ca379c03ed86240 [file] [log] [blame]
export PDK_ROOT=~/foss/pdks/open_pdks/sky130;
export MAGTYPE=mag ;
export PDKPATH=$PDK_ROOT/sky130A ;
export MAGIC=magic
$MAGIC -rcfile $PDKPATH/ -dnull -noconsole <<EOF
drc off
load $1.mag
select top cell
lef write $1.lef -hide
quit -noprompt
$MAGIC -rcfile $PDKPATH/ -dnull -noconsole << EOX
drc off
lef read $1.lef
load $1
save $1.lef.mag
#writeall force $1.lef.mag
# copy GDS properties from the MAG view into the MAGLEF view
set gds_properties [list]
set fp [open $1.mag r]
set mag_lines [split [read \$fp] "\n"]
foreach line \$mag_lines {
if { [string first "string GDS_" \$line] != -1 } {
lappend gds_properties \$line
close \$fp
set fp [open $1.lef.mag r]
set mag_lines [split [read \$fp] "\n"]
set new_mag_lines [list]
foreach line \$mag_lines {
if { [string first "<< end >>" \$line] != -1 } {
lappend new_mag_lines [join \$gds_properties "\n"]
lappend new_mag_lines \$line
close \$fp
set fp [open $1.lef.mag w]
puts \$fp [join \$new_mag_lines "\n"]
close \$fp
mv -f $1.lef.mag ../maglef/$1.mag
rm -f $1.lef