ordec.layout — Working with layouts

ordec.layout.makevias(layout: Layout, rect: Rect4I, layer: Layer, size: Vec2I, spacing: Vec2I, margin: Vec2I = None, rows: int = None, cols: int = None) Rect4I

Generates via array in given rectangle area.

Parameters:
  • layout – Layout to which the vias are added.

  • rect – Area in which the via array is generated.

  • layer – Layer of generated via array.

  • size – Dimensions of individual vias.

  • spacing – Spacing between individual vias.

  • margin – Spacing between the outmost vias to the rectangle (only relevant when rows or cols is not specified).

  • rows – Number of rows. If not specified (None), its value is automatically determined based on rect, size, spacing and margin.

  • cols – Number of columns. If not specified (None), its value is automatically determined based on rect, size, spacing and margin.

ordec.layout.poly_orientation(vertices: list[Vec2I])

Returns either ‘cw’ or ‘ccw’. Warning: Does not work for complex (i.e. self-intersecting) polygons!

ordec.layout.expand_paths(layout: Layout)

For the given Layout, replaces all LayoutPath instances by geometrically equivalent LayoutPoly instances.

ordec.layout.expand_rects(layout: Layout)

For the given Layout, replaces all LayoutRect instances by geometrically equivalent LayoutPoly instances.

ordec.layout.expand_geom(layout: Layout)

Replaces all LayoutRect and LayoutPath instances by equivalent LayoutPoly instances.

ordec.layout.expand_pins(layout: Layout, directory: Directory)

For a given layout, removes LayoutPin objects and adds according LayoutPoly and LayoutLabel instances.

Handles LayoutPoly and LayoutPath refs directly. Expects that LayoutRect objects have already been expanded (e.g. through expand_rects).

ordec.layout.expand_instancearrays(layout: Layout)

For the given Layout, replaces all LayoutInstanceArrays by geometrically equivalent LayoutInstances.

ordec.layout.write_gds(layout: Layout, file: IO[bytes], directory: Directory | None = None)

Write layout ‘layout’ as GDS binary data to file-like object ‘file’.

ordec.layout.gds_text(file: IO[bytes]) str

Reads GDS data from file-like object ‘file’ and returns text representation. Used mainly for testing.

Hides modification and access times.

ordec.layout.compare(layout_a, layout_b) str | None

Compare two layouts for geometric equivalence.

Flattens and expands both layouts to LayoutPoly/LayoutLabel/LayoutPin, then compares normalized geometry. ORDB path names are ignored.

Parameters:
  • layout_a – First Layout to compare.

  • layout_b – Second Layout to compare.

Returns:

None if the layouts are identical, else a str describing the differences.

class ordec.layout.SRouter(routing_spec: RoutingSpec, layout: Layout = None, solver: Solver = None)

Stack router

move(layer: Layer, pos: Vec2LinearTerm)

Set position and layer without drawing (like SVG ‘M’).

wire(pos: Vec2LinearTerm)

Draw a wire to pos (like SVG ‘L’).

wire_x(x)

Draw a horizontal wire (like SVG ‘H’).

wire_y(y)

Draw a vertical wire (like SVG ‘V’).