chipflow.packaging.utils

Utility functions for package and pin lock management.

Functions

load_pinlock()

Load the pin lock file from the chipflow root.

lock_pins([config])

Create or update the pin lock file for the design.

swap_pins(pin_a, pin_b)

Swap two pin assignments in the current pins.lock.

Module Contents

chipflow.packaging.utils.load_pinlock()

Load the pin lock file from the chipflow root.

Returns:

LockFile model

Raises:

ChipFlowError – If lockfile not found or malformed

Return type:

chipflow.packaging.lockfile.LockFile

chipflow.packaging.utils.lock_pins(config=None)

Create or update the pin lock file for the design.

This allocates package pins to component interfaces and writes the allocation to pins.lock. Will attempt to reuse previous pin positions if pins.lock already exists.

Parameters:

config (Optional[chipflow.config.Config]) – Optional Config object. If not provided, will be parsed from chipflow.toml

Raises:

ChipFlowError – If configuration is invalid or pin allocation fails

Return type:

None

chipflow.packaging.utils.swap_pins(pin_a, pin_b)

Swap two pin assignments in the current pins.lock.

Bringup pins (clock, reset, power, heartbeat, JTAG — everything under the _core component) are package-defined and cannot be swapped. Both inputs must currently be allocated to user ports of a package that uses integer pin numbers (Quad / Block / Openframe).

Parameters:
  • pin_a (int) – First pin number.

  • pin_b (int) – Second pin number.

Raises:

ChipFlowErrorpins.lock is missing or malformed; pins are identical; either pin is not allocated; either pin lives in the bringup ring; or the package uses non-integer pins.

Return type:

None