Wenbo Duan | ac9c280 | 2020-12-16 19:00:38 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # SPDX-FileCopyrightText: 2020 Efabless Corporation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # SPDX-License-Identifier: Apache-2.0 |
| 16 | |
| 17 | |
| 18 | export PDK_ROOT=~/foss/pdks/open_pdks/sky130; |
| 19 | export MAGTYPE=maglef ; |
| 20 | export PDKPATH=$PDK_ROOT/sky130A ; |
| 21 | export MAGIC=magic |
| 22 | |
| 23 | $MAGIC -rcfile $PDKPATH/libs.tech/magic/current/sky130A.magicrc -dnull -noconsole <<EOF |
| 24 | drc off |
| 25 | load $1.mag |
| 26 | select top cell |
| 27 | expand |
| 28 | lef write $1.lef |
| 29 | quit -noprompt |
| 30 | EOF |
| 31 | |
| 32 | $MAGIC -rcfile $PDKPATH/libs.tech/magic/current/sky130A.magicrc -dnull -noconsole << EOX |
| 33 | drc off |
| 34 | lef read $1.lef |
| 35 | load $1 |
| 36 | save $1.lef.mag |
| 37 | #writeall force $1.lef.mag |
| 38 | |
| 39 | # copy GDS properties from the MAG view into the MAGLEF view |
| 40 | set gds_properties [list] |
| 41 | set fp [open $1.mag r] |
| 42 | set mag_lines [split [read \$fp] "\n"] |
| 43 | foreach line \$mag_lines { |
| 44 | if { [string first "string GDS_" \$line] != -1 } { |
| 45 | lappend gds_properties \$line |
| 46 | } |
| 47 | } |
| 48 | close \$fp |
| 49 | set fp [open $1.lef.mag r] |
| 50 | set mag_lines [split [read \$fp] "\n"] |
| 51 | set new_mag_lines [list] |
| 52 | foreach line \$mag_lines { |
| 53 | if { [string first "<< end >>" \$line] != -1 } { |
| 54 | lappend new_mag_lines [join \$gds_properties "\n"] |
| 55 | } |
| 56 | lappend new_mag_lines \$line |
| 57 | } |
| 58 | close \$fp |
| 59 | set fp [open $1.lef.mag w] |
| 60 | puts \$fp [join \$new_mag_lines "\n"] |
| 61 | close \$fp |
| 62 | |
| 63 | |
| 64 | quit |
| 65 | EOX |
| 66 | |
| 67 | mv -f $1.lef.mag ../maglef/$1.mag |
| 68 | rm -f $1.lef |