blob: 8bb30356b1a00522096ea4e3d1f401f5d6f3ba5d [file] [log] [blame]
Ahmed Ghazy6eaeda82020-12-31 00:40:03 +00001# SPDX-FileCopyrightText: 2020 Efabless Corporation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# SPDX-License-Identifier: Apache-2.0
15
16gds read $::env(DESIGN_IN_DRC).gds
17set fout [open ./tmp/$::env(DESIGN_IN_DRC).drc w]
18set oscale [cif scale out]
19set cell_name $::env(DESIGN_IN_DRC)
20magic::suspendall
21puts stdout "\[INFO\]: Loading $::env(DESIGN_IN_DRC)\n"
22flush stdout
23load $::env(DESIGN_IN_DRC)
24select top cell
25drc euclidean on
26drc style drc(full)
27drc check
28set drcresult [drc listall why]
29set count 0
30puts $fout "$::env(DESIGN_IN_DRC)"
31puts $fout "----------------------------------------"
32foreach {errtype coordlist} $drcresult {
33 puts $fout $errtype
34 puts $fout "----------------------------------------"
35 foreach coord $coordlist {
36 set bllx [expr {$oscale * [lindex $coord 0]}]
37 set blly [expr {$oscale * [lindex $coord 1]}]
38 set burx [expr {$oscale * [lindex $coord 2]}]
39 set bury [expr {$oscale * [lindex $coord 3]}]
40 set coords [format " %.3f %.3f %.3f %.3f" $bllx $blly $burx $bury]
41 puts $fout "$coords"
42 set count [expr {$count + 1} ]
43 }
44 puts $fout "----------------------------------------"
45}
46
47puts $fout "\[INFO\]: COUNT: $count"
48puts $fout "\[INFO\]: Should be divided by 3 or 4"
49
50puts $fout ""
51close $fout
52
53puts stdout "\[INFO\]: COUNT: $count"
54puts stdout "\[INFO\]: Should be divided by 3 or 4"
55puts stdout "\[INFO\]: DRC Checking DONE (./tmp/$::env(DESIGN_IN_DRC).drc)"
56flush stdout
57
58puts stdout "\[INFO\]: Saving mag view with DRC errors(./tmp/$::env(DESIGN_IN_DRC).drc.mag)"
59# WARNING: changes the name of the cell; keep as last step
60save ./tmp/$::env(DESIGN_IN_DRC).drc.drc.mag
61puts stdout "\[INFO\]: Saved"