File size: 10,847 Bytes
d59bb1b |
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 |
# OpenDB
The OpenDB (`odb`) module in OpenROAD is a design database to support tools for physical
chip design. It was originally developed by Athena Design Systems.
Nefelus, Inc. acquired the rights to the code and open-sourced it with BSD-3 license
in 2019 to support the DARPA OpenROAD project.
The structure of OpenDB is based on the text file formats LEF
(library) and DEF (design) formats version 5.6. OpenDB supports a
binary file format to save and load the design much faster than using
LEF and DEF.
OpenDB is written in C++ 98 with standard library style iterators.
The classes are designed to be fast enough to base an application on without
having to copy them into application-specific structures.
## Commands
```{note}
- Parameters in square brackets `[-param param]` are optional.
- Parameters without square brackets `-param2 param2` are required.
```
## Directory structure
```
include/odb/db.h - public header for all database classes
src/db - private/internal database representations
src/lefin - LEF reader
src/lefout - LEF writer
src/defin - DEF reader
src/defout - DEF writer
```
## Database API
We are still working on documenting the APIs. We have over 1,800 objects
and functions that we are still documenting (for both TCL and Python).
**Contributions are very welcome in this effort**. Find starting points below.
## Python
After building successfully, run `openroad -python` to enable the Python
interpreter. You can find examples on using the API from Python under
`test/python/` directory.
To list the full set of the Python classes exposed run `openroad -python`
then:
```
import openroad
import odb
print(', '.join(dir(openroad)))
print(', '.join(dir(odb)))
```
## C++
All public database classes are defined in `db.h`. These class definitions
provide all functions for examining and modifying the database objects. The
database is an object itself, so multiple database objects can exist
simultaneously (no global state).
`dbTypes.h` defines types returned by database class member functions.
All database objects are in the `odb` namespace.
- `dbChip`
- `dbBlock`
- `dbTech`
- `dbLib`
All database objects have a 32bit object identifier accessed with the
`dbObject::getOID` base class member function that returns a `uint`. This
identifier is preserved across save/restores of the database so it should
be used to reference database object by data structures instead of pointers
if the reference lifetime is across database save/restores. OIDs allow the
database to have exactly the same layout across save/restores.
The database distance units are **nanometers** and use the type `uint`.
### Create Physical Cluster
Description TBC.
```tcl
create_physical_cluster cluster_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `cluster_name` | Name of cluster. |
### Create Child Physical Clusters
Description TBC.
```tcl
create_child_physical_clusters
[-top_module]
or
create_child_physical_clusters
[-modinst path]
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `top_module` | TBC. |
| `-modinst` | TBC. |
### Set NDR Layer Rule
Description TBC.
```tcl
set_ndr_layer_rule
tech
ndr
layerName
input
isSpacing
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `tech` | TBC. |
| `ndr` | TBC. |
| `values` | TBC. |
| `isSpacing` | TBC. |
### Set NDR Rules
Description TBC.
```tcl
set_ndr_rules
tech
ndr
values
isSpacing
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `tech` | TBC. |
| `ndr` | TBC. |
| `layerName` | TBC. |
| `input` | TBC. |
### Create NDR
Description TBC.
```tcl
create_ndr
-name name
[-spacing val]
[-width val]
[-via val]
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `-name` | TBC. |
| `-spacing` | TBC. |
| `-width` | TBC. |
| `-via` | TBC. |
### Create Voltage Domain
Description TBC.
```tcl
create_voltage_domain
domain_name
-area {llx lly urx ury}
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `-domain_name` | TBC. |
| `-area` | TBC. |
### Delete Physical Cluster
Description TBC.
```tcl
delete_physical_cluster cluster_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `cluster_name` | TBC. |
### Delete Voltage Domain
Description TBC.
```tcl
delete_voltage_domain domain_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `domain_name` | TBC. |
### Assign Power Net
Description TBC.
```tcl
assign_power_net
-domain domain_name
-net snet_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `-domain_name` | TBC. |
| `-net` | TBC. |
### Assign Ground Net
Description TBC.
```tcl
assign_ground_net
-domain domain_name
-net snet_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `-domain_name` | TBC. |
| `-net` | TBC. |
### Add to Physical Cluster
Description TBC.
```tcl
add_to_physical_cluster
[-modinst path]
cluster_name
or
add_to_physical_cluster
[-inst inst_name]
cluster_name
or
add_to_physical_cluster
[-physical_cluster cluster_name]
cluster_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `-modinst` | TBC. |
| `-inst` | TBC. |
| `-physical_cluster` | TBC. |
| `cluster_name` | TBC. |
### Remove From Physical Cluster
Description TBC.
```tcl
remove_from_physical_cluster
[-parent_module module_name]
[-modinst modinst_name]
cluster_name
or
remove_from_physical_cluster
[-inst inst_name]
cluster_name
or
remove_from_physical_cluster
[-physical_cluster cluster_name]
cluster_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `-parent_module` | TBC. |
| `-modinst` | TBC. |
| `-inst` | TBC. |
| `-physical_cluster` | TBC. |
| `-cluster_name` | TBC. |
### Report Physical Clusters
Description TBC.
```tcl
report_physical_clusters
```
### Report Voltage Domains
Description TBC.
```tcl
report_voltage_domains
```
### Report Group
Description TBC.
```tcl
report_group group
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `group` | TBC. |
### Write Guides
This command writes global routing guides, which can be used as input
for global routing.
Example: `write_guides route.guide`.
```tcl
write_guides file_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `file_name` | Guide file name. |
### Write Macro Placement
This command writes macro placement.
```tcl
write_macro_placement file_name
```
#### Options
| Switch Name | Description |
| ----- | ----- |
| `file_name` | Macro placement file name. |
## Example scripts
After building successfully, run OpenDB Tcl shell using
`../../build/src/odb/src/swig/tcl/odbtcl`. An example usage:
```
set db [dbDatabase_create]
set lef_parser [new_lefin $db true]
set tech [lefin_createTech $lef_parser ./src/odb/test/data/gscl45nm.lef]
```
You can find examples on using the API from Tcl under `test/tcl/` directory.
The full set of the Tcl commands exposed can be found under
`./build/src/swig/tcl/opendb_wrapper.cpp`. Search for `SWIG_prefix`.
## Regression tests
There are a set of regression tests in `./test`. For more information, refer to this [section](../../README.md#regression-tests).
Simply run the following script:
```shell
./test/regression
```
## Database Internals
The internal description included here is paraphrased from Lukas van Ginneken
by James Cherry.
The database separates the implementation from the interface, and as a result,
each class becomes two classes, a public one and a private one. For instance,
`dbInst` has the public API functions, while class `_dbInst` has the private
data fields.
The objects are allocated in dynamically resizable tables, the implementation
of which is in `dbTable.hpp`. Each table consists of a number of pages,
each containing 128 objects. The table contains the body of the `struct`,
not a set of pointers. This eliminates most of the pointer overhead while
iteration is accomplished by stepping through the table. Thus, grouping these
objects does not require a doubly-linked list and saves 16 bytes per object
(at the cost of some table overhead). Each object has an id, which is the
index into the table. The lowest 7 bits are the index in the page, while
the higher bits are the page number. Object id's are persistent when saving
and reading the data model to disk, even as pointer addresses may change.
Everything in the data model can be stored on disk and restored from disk
exactly the way it was. An extensive set of equality tests and diff functions
make it possible to check for even the smallest deviation. The capability
to save an exact copy of the state of the system makes it possible to create
a checkpoint. This is a necessary capability for debugging complex systems.
The code follows the definition of LEF and DEF closely and reflects many of
the idiosyncrasies of LEF and DEF. The code defines many types of objects
to reflect LEF and DEF constructs although it sometimes uses different
terminology, for instance, the object to represent a library cell is called
`dbMaster` while the LEF keyword is MACRO.
The data model supports the EEQ and LEQ keywords (i.e., electrically equivalent
and logically equivalent Masters), which could be useful for sizing. However,
it does not support any logic function representation. In general, there is
very limited support for synthesis-specific information: no way to represent
busses, no way to represent logic function, very limited understanding of
signal flow, limited support of timing information, and no support for high
level synthesis or test insertion.
The db represents routing as in DEF, representing a trace from point to point
with a given width. The layout for a net is stored in a class named `dbWire`
and it requires a special `dbWireDecoder` (which works like an iterator)
to unpack the data and another `dbWireEncoder` to pack it. The data model
does not support a region query and objects that are in the same layer are
scattered about the data model and are of different classes.
This means that whatever tool is using the layout information will have to
build its own data structures that are suitable to the layout operations
of that tool. For instance, the router, the extractor, and the DRC engine
would each have to build their unique data structures. This encourages
batch mode operation (route the whole chip, extract the whole chip, run
DRC on the whole chip).
## Limitations
## FAQs
Check out
[GitHub discussion](https://github.com/The-OpenROAD-Project/OpenROAD/discussions/categories/q-a?discussions_q=category%3AQ%26A+odb+in%3Atitle)
about this tool.
## LICENSE
BSD 3-Clause License. See [LICENSE](LICENSE) file.
|