-
Notifications
You must be signed in to change notification settings - Fork 22
/
run_verification.py
75 lines (59 loc) · 2.22 KB
/
run_verification.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import pya
from pya import *
import SiEPIC
from SiEPIC.verification import layout_check
from SiEPIC.scripts import zoom_out
from SiEPIC.utils import get_technology_by_name
import siepic_ebeam_pdk
import os
import sys
"""
Script to load .gds file passed in through commmand line and run verification using layout_check().
Ouput lyrdb file is saved to path specified by 'file_lyrdb' variable in the script.
Jasmina Brar 12/08/23, and Lukas Chrostowski
"""
cell_Width = 1000e3
cell_Height = 500e3
cell_FaML_width_extra = 100e3
# gds file to run verification on
gds_file = sys.argv[1]
try:
# load into layout
layout = pya.Layout()
layout.read(gds_file)
except:
print('Error loading layout')
num_errors = 1
try:
# get top cell from layout
if len(layout.top_cells()) != 1:
print('Error: layout does not have 1 top cell. It has %s.' % len(layout.top_cells()))
num_errors += 1
top_cell = layout.top_cell()
# set layout technology because the technology seems to be empty, and we cannot load the technology using TECHNOLOGY = get_technology() because this isn't GUI mode
# refer to line 103 in layout_check()
# tech = layout.technology()
# print("Tech:", tech.name)
layout.TECHNOLOGY = get_technology_by_name('EBeam')
# run verification
zoom_out(top_cell)
# get file path, filename, path for output lyrdb file
path = os.path.dirname(os.path.realpath(__file__))
filename = gds_file.split(".")[0]
file_lyrdb = os.path.join(path,filename+'.lyrdb')
# run verification
num_errors = layout_check(cell = top_cell, verbose=False, GUI=True, file_rdb=file_lyrdb)
# Make sure layout extent fits within the allocated area.
if 'faml' in filename.lower():
cell_Width_check = cell_Width + cell_FaML_width_extra
else:
cell_Width_check = cell_Width
bbox = top_cell.bbox()
if bbox.width() > cell_Width_check or bbox.height() > cell_Height:
print('Error: Cell bounding box / extent (%s, %s) is larger than the maximum size of %s X %s microns' % (bbox.width()/1000, bbox.height()/1000, cell_Width_check/1000, cell_Height/1000) )
num_errors += 1
except:
print('Unknown error occurred')
num_errors = 1
# Print the result value to standard output
print(num_errors)