blob: f167252d78d0c54c337cb805880fd67af1191479 [file] [log] [blame]
Ahmed Ghazy6eaeda82020-12-31 00:40:03 +00001#!/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
18export PDK_ROOT=~/foss/pdks/open_pdks/sky130;
19export MAGTYPE=maglef ;
20export PDKPATH=$PDK_ROOT/sky130A ;
21export MAGIC=magic
22
23$MAGIC -dnull -noconsole <<EOF
24drc off
25load $1.mag
26select top cell
27expand
28lef write $1.lef -hide
29quit -noprompt
30EOF
31
32$MAGIC -dnull -noconsole << EOX
33drc off
34lef read $1.lef
35load $1
36save $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
64quit
65EOX
66
67mv -f $1.lef.mag ../maglef/$1.mag
68rm -f $1.lef