-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpdk.py
More file actions
180 lines (170 loc) · 6.4 KB
/
Copy pathpdk.py
File metadata and controls
180 lines (170 loc) · 6.4 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from dataclasses import dataclass, field
import logging
import os
logger = logging.getLogger(__name__)
@dataclass
class PDK:
"""
Dataclass for PDK information
"""
name : str = "" # pdk name
version : str = "" # pdk version
root : str = "" # resolved pdk root path
tech : str = "" # pdk tech lef file
lefs : list = field(default_factory=list) # pdk lef files
libs : list = field(default_factory=list) # pdk liberty files
mapping_file : str = "" # pdk mapping file
corners : list = field(default_factory=list)
sdc : str = "" # pdk sdc file
spef : str = "" # pdk spef file
site_core : str = "" # core site
site_io : str = "" # io site
site_corner : str = "" # corner site
tap_cell : str = "" # tap cell
end_cap : str = "" # end cap
buffers : list = field(default_factory=list) # buffers
fillers : list = field(default_factory=list) # fillers
tie_high_cell : str = ""
tie_high_port : str = ""
tie_low_cell : str = ""
tie_low_port : str = ""
dont_use : list = field(default_factory=list) # don't use cell list
abc_driver_cell : str = "" # ABC driving cell
abc_load : float = 0.015 # ABC output load
def validate(self) -> None:
"""Check that critical PDK paths exist. Raises ValueError if not."""
errors = []
if self.root and not os.path.isdir(self.root):
errors.append(f"PDK root directory not found: {self.root}")
if not self.tech:
errors.append("PDK tech LEF is missing")
if not self.lefs:
errors.append("PDK has no LEF files")
if not self.libs:
errors.append("PDK has no liberty files")
if errors:
msg = "PDK validation failed:\n " + "\n ".join(errors)
logger.error(msg)
raise ValueError(msg)
def get_pdk(pdk_name : str, pdk_root: str = "") -> PDK:
"""
Return the PDK instance based on the given pdk name.
"""
pdk_name_normalized = (pdk_name or "").strip().lower()
if pdk_name_normalized == "ics55":
pdk = PDK_ICS55(pdk_root=pdk_root)
else:
pdk = PDK(name=pdk_name_normalized)
pdk.validate()
return pdk
def PDK_ICS55(pdk_root: str = "") -> PDK:
current_dir = os.path.split(os.path.abspath(__file__))[0]
root = current_dir.rsplit('/', 2)[0]
default_pdk_root = "{}/chipcompiler/thirdparty/icsprout55-pdk".format(root)
# Resolve: explicit arg > env vars > default
resolved_root = os.path.abspath(os.path.expanduser(
(pdk_root or "").strip()
or os.environ.get("CHIPCOMPILER_ICS55_PDK_ROOT", "").strip()
or os.environ.get("ICS55_PDK_ROOT", "").strip()
or default_pdk_root
))
stdcell_dir = "{}/IP/STD_cell/ics55_LLSC_H7C_V1p10C100".format(resolved_root)
tech_path = "{}/prtech/techLEF/N551P6M_ecos.lef".format(resolved_root)
lef_paths = [
"{}/ics55_LLSC_H7CR/lef/ics55_LLSC_H7CR_ecos.lef".format(stdcell_dir),
"{}/ics55_LLSC_H7CL/lef/ics55_LLSC_H7CL_ecos.lef".format(stdcell_dir)
]
lib_paths = [
"{}/ics55_LLSC_H7CR/liberty/ics55_LLSC_H7CR_ss_rcworst_1p08_125_nldm.lib".format(stdcell_dir),
"{}/ics55_LLSC_H7CL/liberty/ics55_LLSC_H7CL_ss_rcworst_1p08_125_nldm.lib".format(stdcell_dir)
]
mapping_file = "{}/resource/ICsprout_55LLULP_1P6M_5lc_V1p1_cell.map".format(resolved_root)
corners = [
{
"name" : "TYPICAL",
"ecc_tf" : "{}/resource/TYP.json".format(resolved_root),
"itf_file" : "{}/resource/TYP.itf".format(resolved_root),
"captab_file" : "{}/resource/TYP.captab".format(resolved_root),
"spef_file" : "{}/resource/TYP.spef".format(resolved_root)
},
{
"name" : "RCbest",
"ecc_tf" : "{}/resource/RCbest.json".format(resolved_root),
"itf_file" : "{}/resource/RCbest.itf".format(resolved_root),
"captab_file" : "{}/resource/RCbest.captab".format(resolved_root),
"spef_file" : "{}/resource/RCbest.spef".format(resolved_root)
},
{
"name" : "RCworst",
"ecc_tf" : "{}/resource/RCworst.json".format(resolved_root),
"itf_file" : "{}/resource/RCworst.itf".format(resolved_root),
"captab_file" : "{}/resource/RCworst.captab".format(resolved_root),
"spef_file" : "{}/resource/RCworst.spef".format(resolved_root)
},
{
"name" : "Cbest",
"ecc_tf" : "{}/resource/Cbest.json".format(resolved_root),
"itf_file" : "{}/resource/Cbest.itf".format(resolved_root),
"captab_file" : "{}/resource/Cbest.captab".format(resolved_root),
"spef_file" : "{}/resource/Cbest.spef".format(resolved_root)
},
{
"name" : "Cworst",
"ecc_tf" : "{}/resource/Cworst.json".format(resolved_root),
"itf_file" : "{}/resource/Cworst.itf".format(resolved_root),
"captab_file" : "{}/resource/Cworst.captab".format(resolved_root),
"spef_file" : "{}/resource/Cworst.spef".format(resolved_root)
}
]
pdk = PDK(
name="ics55",
version="V1p10C100",
root=resolved_root,
tech=tech_path if os.path.isfile(tech_path) else "",
lefs=[path for path in lef_paths if os.path.isfile(path)],
libs=[path for path in lib_paths if os.path.isfile(path)],
mapping_file = mapping_file,
corners=corners,
site_core = "core7",
site_io = "core7",
site_corner = "core7",
tap_cell = "FILLTAPH7R",
end_cap = "FILLTAPH7R",
buffers = [
"BUFX8H7L",
"BUFX12H7L",
"BUFX16H7L",
"BUFX20H7L"
],
fillers = [
"FILLER64H7R",
"FILLER32H7R",
"FILLER16H7R",
"FILLER8H7R",
"FILLER4H7R",
"FILLER2H7R",
"FILLER1H7R"
],
tie_high_cell = "TIEHIH7R",
tie_high_port = "Z",
tie_low_cell = "TIELOH7R",
tie_low_port = "Z",
abc_driver_cell = "BUFX0P5H7R",
abc_load = 0.015,
dont_use=[
"DFFSRQX*",
"DFFSRX*",
"*AO222*",
"*2BB2*",
"*AOI222*",
"*AOI33*",
"*OA222*",
"*OAI222*",
"*OAI33*",
"*NOR4*",
"ICG*"
]
)
return pdk