helper¶
Helper utilities for GDS generation: die area, pitch, step substitution.
This module exposes utilities used by the GDS generator flows.
Functions¶
|
Apply LibreLane-style step substitutions to a nested step list. |
|
Read the FP_TRACKS_INFO file and return layer information. |
|
Read the FP_TRACKS_INFO file and return track offsets for X and Y. |
|
Read the FP_TRACKS_INFO file and return min pitches for X and Y. |
|
Get the routing obstructions from the config. |
|
Merge meta.substituting_steps across layered config sources. |
|
Round the DIE_AREA to multiples of the minimum pitch. |
|
Round dimension up so each of its divisions equal parts is pitch-aligned. |
|
Round up value to the next multiple of pitch. |
Module Contents¶
- apply_step_substitutions(steps, substitutions) list[type[librelane.steps.step.Step]][source]¶
Apply LibreLane-style step substitutions to a nested step list.
LibreLane’s
SequentialFlow.Substitute/meta.substituting_stepsonly walks a flow’s top-levelStepslist, so it cannot see steps nested inside aWhileStep(a FABulous-authored composite, not a LibreLane built-in). This reproduces the same matching/replace semantics for that nested list, sogds_config.yamlcan target loop-internal steps with identical syntax.- Parameters:
steps (list[type[Step]]) – The loop body to substitute into. Not mutated; a copy is returned.
substitutions (SubstitutionsObject) – A dict or list of (id, step) tuples, using the same syntax as LibreLane’s
meta.substituting_steps: a bare id replaces,+idappends after,-idprepends before, and aNonevalue removes.
- Returns:
The resulting step list.
- get_layer_info(config) dict[str, dict[str, tuple[Decimal, Decimal]]][source]¶
Read the FP_TRACKS_INFO file and return layer information.
Returns a dictionary mapping layer names to their cardinal directions and corresponding (offset, pitch) tuples.
- get_offset(config) tuple[Decimal, Decimal][source]¶
Read the FP_TRACKS_INFO file and return track offsets for X and Y.
Returns a tuple (x_offset, y_offset) where x_offset is the track offset along X-axis (IO_PIN_V_LAYER X direction) and y_offset is the track offset along Y-axis (IO_PIN_H_LAYER Y direction). The cardinal field in FP_TRACKS_INFO is expected to be ‘X’ or ‘Y’ (case-insensitive).
- get_pitch(config) tuple[Decimal, Decimal][source]¶
Read the FP_TRACKS_INFO file and return min pitches for X and Y.
Returns a tuple (x_pitch, y_pitch) where x_pitch is the minimum pitch along X-axis (IO_PIN_V_LAYER X direction) and y_pitch is minimum pitch along Y-axis (IO_PIN_H_LAYER Y direction). The cardinal field in FP_TRACKS_INFO is expected to be ‘X’ or ‘Y’ (case-insensitive).
- get_routing_obstructions(config) list[tuple[str, Decimal, Decimal, Decimal, Decimal]][source]¶
Get the routing obstructions from the config.
Returns a list of tuples (layer, x1, y1, x2, y2) representing the obstructions in the routing area.
- Parameters:
config (Config) – The configuration object from liberlane.
- Returns:
A list of obstruction tuples.
- Raises:
ValueError – If the entry is not a valid obstruction.
- merge_layered_substitutions(config_sources) librelane.flows.sequential.SubstitutionsObject | None[source]¶
Merge
meta.substituting_stepsacross layered config sources.Config.load()overwritesConfig.metawholesale for each source in its configs list rather than merging, so a later source with nometa:key (e.g. a tile-specific or custom override dict) silently drops an earlier source’ssubstituting_steps. This walks the same sources ourselves, in the same order, and concatenates each source’s own substitutions so a later source’s entries still apply after an earlier source’s.
- round_die_area(config) librelane.config.config.Config[source]¶
Round the DIE_AREA to multiples of the minimum pitch.
This reads the minimum pitch from FP_TRACKS_INFO and updates the config DIE_AREA to start at (0,0) with width/height rounded up to the next multiple of that pitch.