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