# Module libreda_pnr::db

source · [−]## Expand description

The `prelude`

helps to import most commonly used modules.

## Modules

Experimental

Traits and datastructures for the representation of technology related properties, especially design rules.

Re-export of most traits. This can be useful if only traits should be used but not the rest.

## Structs

An arc represents the direct path from one pin to another.

Default implementation for `CellInstRef`

.
This is just a wrapper around a netlist and a cell ID.

A reference to a cell. This is just a wrapper around a netlist and a cell ID.

A netlist is the container of circuits.

Transformation described by a mirroring at the `x`

axis,
then a rotation around the origin, then a scaling, then a translation.
This transformation allows rotations by arbitrary angles.

An edge (line segment) is represented by its starting point and end point.

Wrapper around a netlist which provides an on-the-fly flat view of a certain cell. The presented view is flattened until leaf cells. Internally this works by using component IDs that are actually paths through the hierarchy.

A one dimensional interval which is represented by a start and end coordinate.

Describe a non-equispaced repetition by storing a list of offsets.

Meta-data of a layer.

Reference to a layer.

Description of a transformation in the euclidean plane by a 2x2 matrix `A`

.
Transforming a point `p`

is computed by the matrix product `A*p`

.

Affine transformation represented as a 3x3 matrix like:

A `MultiPolygon`

is a list of polygons. There is no restrictions on the polygons (they can be
intersecting, empty, etc.).

A reference to a net. This is just a wrapper around a netlist and a net ID.

`Path`

is essentially a chain of line segments but with a possibly a non-zero width.
It can be thought of the shape resulting by a stroke of a thick pen along the line segments.

A reference to a pin instance. This is just a wrapper around a netlist and a pin instance ID.

A reference to a pin. This is just a wrapper around a netlist and a pin ID.

A point is defined by a x and y coordinate in the euclidean plane.

A point string is a finite sequence of points.
TODO: Implement `Deref`

for accessing the list of points.

A polygon possibly with holes. The polygon is defined by a hull and a list of holes
which are both `SimplePolygon`

s.

An rectilinear edge (horizontal or vertical line segment) is represented by its starting point and end point.

Resource counted string, used for names.
`RcString`

s can be efficiently cloned.

A rectangle which is oriented along the x an y axis and represented by its lower left and upper right corner.

Iterator over edges of a rectangle.

Describe a equi-spaced n*m two-dimensional repetition as a lattice.
The offsets are computed as `(i*a, j*b)`

for `i`

in `0..n`

and `j`

in `0..m`

.
`a`

and `b`

the distance vectors between two neighbouring points.

Transformation that consists only of a rotation by a multiple of 90 degrees
around the origin `(0, 0)`

.

Annotate a layer ID as ‘via’ or ‘routing’ layer.

Reference to a shape.

A `SimplePolygon`

is a polygon defined by vertices. It does not contain holes but can be
self-intersecting.

A `SimpleRPolygon`

is a rectilinear polygon. It does not contain holes but can be self-intersecting.
The vertices are stored in an implicit format (one coordinate of two neighbour vertices is always the same
for rectilinear polygons). This reduces memory usage but has the drawback that edges must
alternate between horizontal and vertical. Vertices between two edges of the same orientation will
be dropped.

Describes a geometric transformation that consists of a optional mirroring along the x-axis followed by a rotation by a multiple of 90 degrees followed by a displacement.

A text is a point associated with a string. This struct does not define how the text should be rendered on screen.

## Enums

Angle expressed as a multiple of 90 degrees.

This is a result type for containment checks.

Signal type for pins.

Direction in one dimension.

Directions along the coordinate axes in two dimensions.

Return type for the edge-edge intersection functions. Stores all possible results of an edge to edge intersection.

Abstracted geometrical shape.

Return type for the line-line intersection functions. Stores all possible results of a line to line intersection.

Relative orientation of two geometrical objects such as vectors.

Orientation in two dimensions along one of the axes.

Encoding for the type of the beginning and end of the path.

Property value type. Properties can hold different types that are encapsulated in this enum.

Orientation of a rectilinear edge.

Return type for the line-line intersection functions. Stores all possible results of a line to line intersection.

Describe the regular or irregular repetition of a geometrical object.

A routing layer is either a ‘via’ or ‘routing/metal’ layer.

Location relative to a directed line or edge. Something can be on the left of the line, right of the line or on top of the line (center).

A terminal is a generalization of pins and pin instances.

Either a pin or a pin instance.

## Constants

Precision for distance related decisions.

## Traits

Geometric transformation which preserves parallelism.
Adds ‘shear’ to the `SimilarityTransform`

.

Calculate the area of a geometry.

Calculation of the ‘bounding box’, i.e. the smallest rectangle that contains the geometrical object.

Trait for types that can be used as coordinates in the euclidean plane. In practice this are integers, floats and possible rational numbers.

Used for immutable dereferencing operations, like `*v`

.

Geometric transformation which preserves oriented angles and distances (i.e. translation).

Define essential types used for expressing design rules based on distance relations.

Calculate the doubled oriented area of a geometry. Using the doubled area allows to compute the area without using fractions. This is especially helpful when computing in integer coordinates.

Get the endpoints of an edge.

Define the intersection between two edges (i.e. line segments).

Most basic trait for the hierarchical flyweight pattern which is used to efficiently represent chip layouts and netlists.

Edit functions for a hierarchical flyweight structure like a netlist or a cell-based layout.

Modifying utility functions for the cell hierarchy..
Import the this trait to use the utility functions all types that implement the `HierarchyEdit`

trait.

Trait that provides object-like read access to a cell hierarchy structure and its elements.

Non-modifying utility functions for the cell hierarchy..
Import the this trait to use the utility functions all types that implement the `HierarchyBase`

trait.

Iterate over edges. For an n-gon this would produce n edges.

Geometric transformation which preserves angles and distances (e.g. euclidean transform).

Geometric transformation which preserves angles and distances (e.g. euclidean transform) but allows only rotations by a multiple of 90 degrees.

Fused layout and netlist view. This trait makes the link between netlist elements and layout elements.

Fused layout and netlist view. This trait makes the link between netlist elements and layout elements.

Most basic trait of a layout.

Trait for layouts that support editing.

Helper functions for layouts.

Trait that provides object-like read access to a layout structure and its elements.

Trait for reading a layout from a byte stream.

Trait for writing a layout to a byte stream.

Transform the geometrical object by transforming each point of it.

Minimum spacing rules between shapes on the same layer.

Minimum with rules.

Mirror at the x or y axis.

Most basic trait for traversing a netlist.
A netlist extends the `HierarchyBase`

and hence is hierarchical.
`NetlistBase`

extends the components of the hierarchy with pins and nets.
Each cell can have pins. Each cell instance has pin instances that correspond one-to-one
to the pins of the template cell. Cells can contain nets. Each pin and each pin instance can be
connected to one or zero nets. A net can be connected to an arbitrary number of pins and pin instances.

Trait for netlists that support editing.

Modifying utility functions for netlists.
Import the this trait to use the utility functions all types that implement the `NetlistBase`

trait.

Read a netlist from a byte stream.

Trait that provides object-like read access to a hierarchical netlist structure and its elements.

Non-modifying utility functions for netlists.
Import the this trait to use the utility functions all types that implement the `NetlistBase`

trait.

Write a netlist to a byte stream.

Preferred routing direction on metal layers.

Access shapes and instances in a layout based on their locations.

Rotate by a integer multiple of 90 degrees.

Define standardized access for routing and via layers.

Define essential types used for expressing design rules.

Scale the geometrical shape. Scaling center is the origin `(0, 0)`

.

Geometric transformation which preserves angles and ratios of distances.
Adds resizing to the `IsometricTransform`

.

Geometric transformation which preserves angles and ratios of distances.
Adds resizing by integer numbers to the [`IsometricRTransform`

].

Trait for types that can be used as the text of this label.
The most simple solution is to use `String`

. However, in many cases
where the same text is used in many labels it might be desirable to use ‘string interning’
for more efficient memory usage. Then an `Rc<String>`

could be used for instance.

Trait for the conversion of a geometric shape to a polygon.

General geometric transformation.

Translate the geometrical object by a vector.

Try the calculation of the ‘bounding box’, i.e. the smallest rectangle that contains the geometrical object. In some cases this is not always possible, so the try might fail. For instance a set of polygons does not have a bounding box if the set is empty.

This trait defines the type-casting of the coordinate types for geometrical objects.

Try to compute the bounding box while consuming the data. This is intended to be used for computing bounding boxes over iterators.

Compute the winding number of a geometrical object around a point. The winding number is used to check if a point is contained in a shape.

Defines an additive identity element for `Self`

.

## Functions

Copy all layers (without their contents) from a source layout into a destination layout.

Copy all layers (without their contents) from a source layout into a destination layout and preserve
the layer IDs.
Source and target layout must have the same `LayerId`

type.

Copy a layer (without its content) from a source layout into a destination layout.

Copy a layer (without its content) from a source layout into a destination layout
while preserving the layer ID.
`LayerId`

types of the both layouts must be the same.

Copy the pin definitoins from a cell to another cell in another netlist.

Copy the shapes on a specific layer from one cell into another cell.

Copy the shapes from all layers in a cell into another cell.

## Type Definitions

Integer coordinate type.

Default type for euclidean distances.

Default floating point type.

Return type for the edge-edge intersection functions. Stores all possible results of a edge to edge intersection.

Default signed integer type.

Default unsigned integer type.