libreda_db/
lib.rs

1// Copyright (c) 2020-2021 Thomas Kramer.
2// SPDX-FileCopyrightText: 2022 Thomas Kramer
3//
4// SPDX-License-Identifier: AGPL-3.0-or-later
5
6//! This crate is a database for VLSI physical design. The core components are traits that define
7//! how netlist and layouts can be accessed and modified. Additionally the crate provides default
8//! implementations of those traits for representation of chip layouts and netlists.
9//!
10//! ## Core parts
11//!
12//! An important part of this crate are trait definitions that describe the access methods
13//! of cell hierarchies, netlists and layouts. The idea is that most algorithms should not be implemented
14//! for concrete types but for this traits. For instance an algorithm that analyzes a netlist without looking at the layout
15//! might be implemented for all types that implement the [`NetlistBase`] trait. In many
16//! cases this allows to be agnostic of the actual netlist implementation. Hence the algorithm implementation
17//! might be more portable.
18//!
19//! A fundamental idea is that all things (cells, instances, pins, nets, shapes, etc.) have unique
20//! identifiers. The type of the identifiers is generically defined as an associated type of the traits.
21//! In practice the identifiers might be for example integers but they can also some sort of smart pointer.
22//!
23//! The following are important traits which define how netlist and layouts can be accessed
24//! and modified:
25//! * [`HierarchyBase`] - traverse cell hierarchies
26//! * [`HierarchyEdit`] - edit cell hierarchies
27//! * [`NetlistBase`] - traverse netlists
28//! * [`NetlistEdit`] - edit netlists
29//! * [`LayoutBase`] - access layout shapes
30//! * [`LayoutEdit`] - edit layout shapes
31//! * [`L2NBase`] - access the links between layout shapes and netlist
32//! * [`L2NEdit`] - edit the links between layout shapes and netlists
33//!
34//! Read more about netlists and layouts in the following modules:
35//! * [`Netlist`]
36//! * [`Layout`]
37//!
38//! The [`Chip`] struct implements the above traits and hence can be used as a default data base structure.
39//!
40//! ## Netlist/layout wrappers
41//!
42//! Additional functionality can be added to netlists and layout structures with the
43//! following wrappers:
44//!
45//! * [`Undo`] - Make modifications reversible
46//! * [`FlatView`] - Create an on-the-fly flattened view of a hierarchical structure.
47//!
48//! # Input/output
49//! Reading and writing data base structures is generally left to other crates such as `libreda-oasis`,
50//! `libreda-lefdef`, ...
51//!
52//! # Geometric primitives
53//! Two dimensional geometrical primitives (polygons, rectangles, etc.) are re-exported from the [`iron_shapes`] crate.
54//!
55//! # Technology-related data
56//! There is no complete standard way to deal with technology related data. A proposal on how to
57//! also create an abstraction layer for technology data such as rules is here:
58//!
59//! * [`technology`] - interfaces for accessing technology related information such commonly used DRC rules
60//!
61//! [`iron_shapes`]: iron_shapes
62//! [`HierarchyBase`]: trait@traits::HierarchyBase
63//! [`HierarchyEdit`]: trait@traits::HierarchyEdit
64//! [`NetlistBase`]: trait@netlist::traits::NetlistBase
65//! [`NetlistEdit`]: trait@netlist::traits::NetlistEdit
66//! [`LayoutBase`]: trait@layout::traits::LayoutBase
67//! [`LayoutEdit`]: trait@layout::traits::LayoutEdit
68//! [`L2NBase`]: trait@traits::L2NBase
69//! [`L2NEdit`]: trait@traits::L2NEdit
70//! [`Netlist`]: netlist
71//! [`Layout`]: layout
72//! [`Chip`]: chip::Chip
73//! [`Undo`]: undo
74//! [`FlatView`]: flat_view
75
76// Enforce documentation of the public API.
77#![deny(missing_docs)]
78
79#[cfg(feature = "serde")]
80#[macro_use]
81extern crate serde;
82extern crate num_traits;
83
84#[macro_use]
85extern crate num_derive;
86
87/// Re-exports: Crate for geometric primitives (points, polygons, ...).
88pub use iron_shapes;
89pub use iron_shapes_booleanop;
90
91/// Helpers for deriving trait implementations of core traits.
92pub mod derive {
93    pub use portrait::delegate;
94    pub use portrait::fill;
95}
96
97// Public modules.
98pub mod chip;
99pub mod flat_view;
100pub mod hierarchy;
101pub mod index;
102pub mod l2n;
103pub mod layout;
104pub mod netlist;
105pub mod prelude;
106pub mod profile;
107pub mod property_storage;
108pub mod rc_string;
109pub mod reference_access;
110pub mod region_search;
111pub mod rw_reference_access;
112pub mod traits;
113pub mod undo;
114
115pub mod technology;
116
117mod blanket_impl;
118mod library;
119mod slab_alloc;