blob: 455c4a6b7cf95afe4a57331cbd6874a1eb104adb [file] [log] [blame]
mkk91ada922020-12-02 09:08:26 -08001#!/bin/bash
agorararmard6c766a82020-12-10 18:13:12 +02002# SPDX-FileCopyrightText: 2020 Efabless Corporation
agorararmarde5780bf2020-12-09 21:27:56 +00003#
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.
agorararmardafa96ea2020-12-09 23:37:31 +020015# SPDX-License-Identifier: Apache-2.0
agorararmarde5780bf2020-12-09 21:27:56 +000016
mkk91ada922020-12-02 09:08:26 -080017
18export PDK_ROOT=~/foss/pdks/open_pdks/sky130;
19export MAGTYPE=mag ;
20export PDKPATH=$PDK_ROOT/sky130A ;
21export MAGIC=magic
22
23
24$MAGIC -rcfile $PDKPATH/libs.tech/magic/current/sky130A.magicrc -dnull -noconsole << EOX
25drc off
26lef read $1.lef
27load $1
28save $1.lef.mag
29#writeall force $1.lef.mag
30
31 # copy GDS properties from the MAG view into the MAGLEF view
32 set gds_properties [list]
33 set fp [open $1.mag r]
34 set mag_lines [split [read \$fp] "\n"]
35 foreach line \$mag_lines {
36 if { [string first "string GDS_" \$line] != -1 } {
37 lappend gds_properties \$line
38 }
39 }
40 close \$fp
41 set fp [open $1.lef.mag r]
42 set mag_lines [split [read \$fp] "\n"]
43 set new_mag_lines [list]
44 foreach line \$mag_lines {
45 if { [string first "<< end >>" \$line] != -1 } {
46 lappend new_mag_lines [join \$gds_properties "\n"]
47 }
48 lappend new_mag_lines \$line
49 }
50 close \$fp
51 set fp [open $1.lef.mag w]
52 puts \$fp [join \$new_mag_lines "\n"]
53 close \$fp
54
55
56quit
57EOX
58
59mv -f $1.lef.mag ../maglef/$1.mag
60rm -f $1.lef