-
Notifications
You must be signed in to change notification settings - Fork 86
/
docs.txt
610 lines (479 loc) · 24.1 KB
/
docs.txt
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
open_pdks : A system for installing silicon foundry PDKs for open-source EDA tools
(also maybe works for installing commercial tools)
----------------------------------------------------------------------------------
Written by Tim Edwards 2019 - 2022 for efabless (efabless.com)
and Open Circuit Design (opencircuitdesign.com)
URL: http://opencircuitdesign.com/open_pdks
Mirror URL: https://github.com/RTimothyEdwards/open_pdks
Distributed under the Apache-2.0 license (see file LICENSE).
----------------------------------------------------------------------------------
Quick Install:
Looking to install the Google/SkyWater SKY130 PDK libraries and setup
files for open source EDA tools? Read the README file in the sky130/
directory.
The rest of this README file is general information about open_pdks
and is not specific to any single PDK.
----------------------------------------------------------------------------------
Introduction:
Silicon foundry PDKs are notoriously non-standard, and files obtained
from the foundry may end up in any possibly configuration of files and
folders. In addition, silicon foundries are notorious among open source
EDA tool enthusiasts for supplying user setups for commercial EDA tools
and all but ignoring open source EDA tools. Open_pdks aims to mitigate
the problem by defining a standard layout of files and directories for
known open standard formats (e.g., SPICE, verilog, liberty, LEF, etc.)
and for various open source EDA tools (e.g., magic, netgen, OpenROAD,
klayout) using a Makefile system and a number of conversion scripts to
ensure that for any process, all files needed by all EDA tools can be
found in predictable locations.
The scripts aim to be as general-purpose as possible to allow easy
adaptation to new tools, formats, and foundries. Where foundry data
is intractably unusable, custom install files can be added to overwrite
or annotate vendor data as needed.
Each foundry process is a subdirectory of the open_pdks top level and
has its own Makefile. The typical install process is to cd to the
foundry top level and run "make" (see below for details).
The general file structure created by open_pdks is as follows:
<foundry_root>/
<name_of_pdk_variant_1>/
<name_of_pdk_variant_2>/
...
<name_of_pdk_variant_x>/
libs.tech/
<name_of_EDA_tool_1>/
<name_of_EDA_tool_2>/
...
<name_of_EDA_tool_x>/
<EDA_tool_setup_files>
libs.ref
<name_of_IP_library_1>/
<name_of_IP_library_2>/
...
<name_of_IP_library_x>/
<name_of_file_format_1>
<name_of_file_format_2>
...
<name_of_file_format_x>
<vendor_files>
Note that this format is very general and does not constrain the
EDA tools supported or file formats supported, so long as there
are scripts in the system to provide that support. It is intended
that open_pdks can be extended as needed to support new tools or
new file formats.
Current EDA tools supported in this version of open_pdks:
Tool Directory name
--------------------------
ngspice ngspice
magic magic
netgen netgen
klayout klayout
qflow qflow
openlane openlane
Current IP library file formats supported in this version of open_pdks*:
Format Directory name
--------------------------
CDL cdl
SPICE spice
magic mag, maglef
LEF lef, techlef
GDS gds
verilog verilog
liberty lib
PDF** doc
(* "Supported" meaning expected/handled by conversion scripts;
as noted, the install is very general purpose and any name
can be used as a target for any vendor or custom files.)
(** or HTML or any valid document format, plus supporting files.)
How to use open_pdks:
There are a seriously limited number of open foundry PDKs. Those that
are known (SkyWater, MOSIS SCMOS) are included in the repository. In
other cases (X-Fab XH035, XH018) it is possible to get an extension to
open_pdks from a known trusted source through NDA verification with
the foundry. In all other cases, foundries should be berated until
they agree to support the open_pdks format.
Open_pdks does not attempt to keep any foundry data to the extent
possible. Instead, it adapts to the file structure available from
whatever system each foundry uses for downloads. Each foundry
directory should contain a README file that details how to obtain
downloads from the foundry, and what files need to be downloaded.
Since the download methods vary wildly, it is up to the user to obtain
the foundry data as instructed. The Makefile in the open_pdks foundry
directory then needs to be edited to set the correct path to the
foundry source data.
The installation is a bootstrapping process, so needs to be done in
stages. The first stage installs setup files for all the EDA tools.
The second stage installs IP libraries (e.g., standard cells, padframe
I/O, analog circuits) and depends heavily on the use of the open EDA
tools themselves to fill in any missing file formats. Therefore the
tool setup files need to be installed first, and then the IP libraries.
If using a distributed install (see below), then the tool setup files
need to be installed and distributed (relocated to the final run-time
location) before the IP libraries are installed.
Users installing on the same host they are running on will want to
use the typical flow of;
./configure See options for setting paths
make Generate local staging area
sudo make install Install onto local system
which will install to /usr/local/share/pdk directory.
Users can also elect to install somewhere by giving ./configure the
`--prefix` and other similar standard ./configure options.
For example;
Installing to /usr/share/pdk;
./configure --prefix=/usr
make
sudo make install
Installing to /opt/share/pdk;
./configure --prefix=/opt
make
sudo make install
Installing to ~/pdk;
./configure --prefix=$HOME --datarootdir=$HOME
make
make install
Packagers and administrators that want to create a directory which
is destined to be installed on other machines should set`--prefix`
to be the directory where the files should be staged, and use
`DESTDIR` with `make install` to the final install location.
See the following example:
./configure --prefix=/tmp/package
make
# Need to use sudo so the file ends up with the right permissions.
sudo make DESTDIR=/usr install
(cd /tmp/package; tar -cvf ../dist.tar)
Then on the final install machine you would want to do:
(sudo cd /usr; tar -xvf dist.tar)
Prerequisites:
The following tools/software stacks are needed to run open_pdks:
python3
magic opencircuitdesign.com/magic or github.com/RTimothyEdwards
assumed to be installed and discoverable in the standard
search path as defined by the shell (version 8.2+ required)
How to make or update an open PDK:
The backbone of the open_pdks system is a set of scripts found in the
common/ subdirectory. The two main scripts are "preproc.py" and
"foundry_install.py", with a host of supporting scripts.
Creating a new PDK starts with generating a Makefile, which can be
done by copying a Makefile from an existing project. The first thing
to do is to define the number of PDK variants (usually based on back-end
metal stacks available, but can also include front-end options, especially
if they are mutually exclusive rather than simply additional masks).
Then create the make and make-install targets for local and distributed
install, including install (plain), install-vendor, and install-custom.
Define the default source and target paths.
(Needed: A "make makefile" script that generates the "local" and "dist"
automatically, and potentially can also make all the different PDK
targets automatically, from a much shorter and simpler master Makefile.)
Create the basic scripts for tools. Since foundries do not support open
EDA tools, it is inevitable that these files need to be created by hand
unless there is an option to import other formats. Because Magic is used
heavily by open_pdks to create missing file formats from other existing
file formats, a Magic techfile is critical. Each of the basic scripts
will contain #ifdef ... #endif and similar conditionals to allow the
script to be parsed for each target PDK variant. Each of these scripts
is passed through common/preproc.py to handle the conditionals. Of course,
it is possible to make a separate file for each PDK variant as long as the
Makefile handles them properly, but use of the preproc.py script allows
all the PDK variants to be handled in the same way, simplifying the Makefile.
--------------------------------------------------------------------------
preproc.py Usage:
preproc.py input_file [output_file] [-D<variable> ...]
Where <variable> may be a keyword or a key=value pair
Syntax: Basically like cpp. However, this preprocessor handles
only a limited set of keywords, so it does not otherwise mangle
the file in the belief that it must be C code. Handling of boolean
relations is important, so these are thoroughly defined (see below)
#if defined(<variable>) [...]
#ifdef <variable>
#ifndef <variable>
#elseif <variable>
#else
#endif
#define <variable> [...]
#undef <variable>
#include <filename>
<variable> may be
<keyword>
<keyword>=<value>
<keyword> without '=' is effectively the same as <keyword>=1
Lack of a keyword is equivalent to <keyword>=0, in a conditional.
Boolean operators (in order of precedence):
! NOT
&& AND
|| OR
Comments:
Most comments (C-like or Tcl-like) are output as-is. A
line beginning with "###" is treated as a preprocessor
comment and is not copied to the output.
Examples;
#if defined(X) || defined(Y)
#else
#if defined(Z)
#endif
--------------------------------------------------------------------------
The script common/foundry_install.py handles all the IP library processing
and installation. It generates the local directory structure and populates
the directories with foundry vendor data, and filters or otherwise uses
open EDA tools to generate missing standard file formats or create file
formats needed by the open EDA tools.
foundry_install.py Usage:
foundry_install.py [option [option_arguments]] ...
All options begin with "-" and may be followed by one or more
arguments (that do not begin with "-"). The foundry_install.py
script may be called multiple times, although it is best to
group together all files for the installation of an IP library,
since the options given will be used to determine what files are
missing and need to be generated.
Global options:
-link_from <type>
Make symbolic links to vendor files from target
Types are: "none", "source", or a PDK name.
Default "none" (copy all files from source)
-source <path>
Path to source data top level directory
-target <path>
Path to target top level directory
-local <path>
For distributed installs, this is the local
path to target top level directory.
-library <type> <name>
The install target is an IP library with
name <name>.
-ef_format
Use the original efabless format for file
installs. This has several differences from
then no-efabless install. The most important
is that the order of directories for IP libraries
is <file_format>/<library_name> instead of
<library_name>/<file_format>. As the efabless
platform migrates to the open_pdks developing
standard, this use should eventually be
deprecated. In open_pdks, the option is set
from the EF_FORMAT variable setting in the Makefile.
All other options represent installation into specific directories.
The primary rule is that if foundry_install.py is passed an option
"-library" (see syntax below), then all other non-global options
represent subdirectories of the IP library, given the same name as
the option word following the "-". If the foundry_install.py command
line does not have an option "-library", then all non-global options
represent per-EDA tool subdirectories, where the name of the subdirectory
is the same as the option word following the "-".
Each tool install option has the syntax:
-<tool_name> <path> [<option_arguments>]
Each IP library install option has the syntax:
-<file_format_name> <path> [<option_arguments>]
The <path> is a directory path that is relative to the path prefix
given by the -source option. The path may be wildcarded with the
escape string "%l", which is replaced by the name of the library,
and for simplicity with versioning, "%v" will be interpreted to
match any versioning string in the form "major[.minor[.rev]]".
Note that only the numerical part of a versioning string is
represented, so, for example, to match "/V1.1.0/" the <path> should
use "/V%v/". In the unlikely event of a percent character in the
path, use the escape string "%%".
"*" has the usual meaning of matching any characters in a name (see
python glob.glob() command for reference). However, for backwards
compatibility with earlier versions of open_pdks, the library name
in the path may also be wildcarded with "*" in the specific text
"/*/".
Library name wildcarding in either form is only valid if "-library"
is given as an an option.
(Note that the INSTALL variable in the Makefile starts with "set -f"
to suppress the OS from doing wildcard substitution; otherwise the
wildcards in the install options will get expanded by the OS before
being passed to the install script.)
Library option:
-library <type> <name> [<target>]
<type> may be one of the following:
digital Digital standard cells
primitive Primitive devices
general All others
Analog and I/O libraries fall under the category "general".
<name> is the vendor name of the library.
[<target>] is the (optional) local name of the library. If omitted,
then the vendor name is used for the target (there is no particular
reason to specify a different local name for a library).
Any number of libraries may be supported, and one "-library" option
may be provided for each supported library. The use of multiple
libraries for a single run of foundry_install.py only works if the
formats (gds, cdl, lef, etc.) happen to all work with the same wildcards.
But it is generally most common to declare only one library name per
call to foundry_install.py.
Common foundry_install.py options when used with "-library":
-techlef <path> [option_arguments] Technology LEF file
-doc <path> [option_arguments] library documentation
-lef <path> [option_arguments] LEF file
-spice <path> [option_arguments] SPICE netlists
-cdl <path> [option_arguments] CDL netlists
-lib <path> [option_arguments] Liberty timing files
-gds <path> [option_arguments] GDS layout data
-verilog <path> [option_arguments] Verilog models
Any name can be used after the "-" and the installation of files
will be made into a directory of that name, which will be created
if it does not exist. The names used above are preferred, for
the sake of compatibility between EDA tools.
Of special note is "techlef", as technology LEF files are often
associated with a PDK and not an IP library. In this system,
the technology LEF file should be associated with each standard
cell library for which it is intended.
[option_arguments] may be one of the following:
up=<number>
Any tool option can use this argument to indicate that
the source hierarchy should be copied entirely, starting
from <number> levels above the files indicated by <path>.
For example, if liberty files are kept in multiple
directories according to voltage level, then
-liberty x/y/z/PVT_*/*.lib
would install all .lib files directly into
libs.ref/<libname>/liberty/*.lib while
-liberty x/y/z/PVT_*/*.lib up=1
would install all .lib files into
libs.ref/liberty/<libname>/PVT_*/*.lib.
nospec
Remove timing specification before installing (used with
verilog files only; could be extended to liberty files).
compile
Create a single library from all components. Used when a
foundry library has inconveniently split an IP library
(LEF, CDL, verilog, etc.) into individual files.
compile-only
Same as argument "compile", except that the individual
files are not copied to the target; only the compiled
library is created.
stub
Remove contents of subcircuits from CDL and SPICE netlist,
or verilog files. This is useful to LVS and other tools
to know the order of pins in a circuit (for CDL or SPICE),
or simply to ignore the contents of the file (any format)
so that the circuit in question is treated as a "black box".
priv
Mark the contents being installed as privleged, and put
them in a separate root directory libs.priv where they
can be given additional read/write restrictions.
rename=<file_name>
Rename the file being copied to the name of the argument.
This can be used to copy one file into multiple destination
libraries and give each copy a name related to the
destination library.
filter=<script_file_path>
Process all files through the script <script_file_path>,
which is given as a relative path to the directory
containing the Makefile. The filter script traditionally
is put in local subdirectory custom/scripts/. The filter
script should be written to take a single argument, which
is the path to a file, and process that file, and overwrite
the file with the result. Commonly used filters are found
in the common/ directory. See common/fixspice.py for an
example.
sort=<script_file_path>
Generate a list of all files to combine in a library,
called "filelist.txt", then call the script. The
script should read the "filelist.txt" file and sort
the files according to the order in which they should
appear in the library.
noclobber
Mainly diagnostic. When specified, any temporary files
used during installation will be retained instead of
deleted after use. This includes, for example, scripts
passed to magic for running extraction or file format
generation. It is useful when debugging problems with
the install.
anno
Currently only supported for LEF files. This argument
indicates that the vendor LEF files should be used only
for annotating GDS input with port location information,
but the LEF files themselves should not be installed.
File conversions handled by foundry_install.py:
The following file format conversions can be done automatically by
foundry_install.py:
CDL to SPICE: A CDL netlist or library can be converted to a
general-purpose SPICE netlist that can be read
by any tool that can read Berkeley SPICE 3f5
syntax.
GDS to LEF: An abstract view can be generated from a full
layout view using Magic.
GDS to SPICE: In the absence of any netlist, Magic will
extract a SPICE netlist from a full layout.
SPICE (any) to SPICE (ngspice): The fixspice.py script will
attempt to convert any SPICE model file,
cell library, or netlist to a form that is
compatible with ngspice version 30.
open_pdks additional Makefile notes:
The "make install-local" ("make install-dist") step is generally
broken into individual make sections, one for each tool (e.g.,
magic, netgen, klayout). There is an additional section called
"general" which installs a ".config" directory at the PDK top
level, containing a file "nodeinfo.json" which has general
information about the PDK that may be used by any tool that
understands the key:value pairs used in the JSON file. Keys used
are as follows:
foundry : Short name of the foundry, equal to the foundry
directory root, above the PDK variants.
foundry-name : Long name of the foundry.
node : The name of the PDK variant
feature-size : The foundry process feature size (e.g., 130nm)
status : "active" or "inactive". May be used by tools
to present or hide specific PDK variants.
description : Long text description of the process variant
(e.g., 6-metal stack + MiM caps)
options : List of options, corresponding to the definitions
used in the Makefile and passed to preproc.py.
stdcells : List of standard cell libraries available for this
PDK variant.
iocells : List of I/O pad cell libraries available for this
PDK variant.
Note that the JSON file is, like other EDA tool setup files, usually a
master file that is parsed by preproc.py; therefore when specifying
"options", use #undef before specifying each option name so that the
option name itself is ignored by the pre-processor.
Goals of the open_pdks project:
The intended goal of open_pdks is to be able to support as many open source
EDA tools as practical, and to be able to generate all needed files for
those tools from any sufficiently complete set of vendor files.
A number of file converions are not available but would be useful to have:
SPICE to liberty: Create timing files by running simulations
on SPICE netlists using ngspice.
liberty to verilog: Use the function statements in liberty
format to create verilog primitives. Maybe
use liberty timing information to generate
LEF specify sections.
verilog to liberty: Reverse of the above. Use verilog logic
tables and specify sections to generate liberty
functions and timing tables.
File formats that need to be supported:
Schematic and symbol: There are few standards, so either everyone
needs to agree on a good format to use, or there
needs to be a lot of scripts to do conversions
between formats. Open EDA tools that could be
supported include:
electric, xcircuit, kicad, sue2
Other open source EDA tools that need to be supported:
OpenROAD
Coriolis2
(add more here. . .)
Commercial EDA tools can potentially be supported under this same system,
provided sufficient compatibility with the file system structure.
Other scripts needed:
Project setup script: It would be useful to define a "standard
project file structure" that is similar to the standard PDK file
structure defined in open_pdks. The preferred project setup
based on the efabless model is:
<project_name>
.config/
techdir (symbolic link to open_pdks PDK)
project.json (information file for tools)
<tool_name> (magic, qflow, ngspice, etc.) or
<format_name> (spice, gds, verilog, etc.)
In general, <tool_name> directories are intended to be workspaces
for specific EDA tools (and may have their own nested hierarchies;
e.g., qflow/<digital_block>/source,synthesis,layout) while
<format_name> is a place to keep (final) files of a specific format,
with the intention that any project can easily be made into an
IP library and folded into the open_pdks scheme with little effort.
The project.json file contains project information that can be used
by a script to build a setup for any EDA tool. One goal of the
project.json file is to define "datasheet" (documented elsewhere)
that can be used to drive characterization simulations and create
a datasheet for the project. Field "ip-name" of "datasheet" is
the canonical name of the project, which can be distinguished from
the project directory top-level name, such that the project can be
moved or copied without affecting the tool flows.