decorators module#

Pin decorators module for JITX Standard Library

This module provides pin decorator definitions for use with symbol pins. Decorators are collections of artwork that can be attached to pins to indicate special properties like active-low signals, open-collector outputs, clock inputs, and pin cardinality (input/output/bidirectional).

class DecoratorPlacement(*values)[source]#

Bases: Enum

Placement reference for pin decorators

Indicates whether the decorator is placed inside or outside the box symbol.

OUTSIDE = 'outside'#
INSIDE = 'inside'#
class OpenCollectorType(*values)[source]#

Bases: Enum

Open collector output types

Defines whether the open collector is a low-side sink (NPN/NMOS) or high-side source (PNP/PMOS).

SINK = 'sink'#

Low side open collector (NPN BJT or NMOS FET)

SOURCE = 'source'#

High side open collector (PNP BJT or PMOS FET)

class CardinalityType(*values)[source]#

Bases: Enum

Pin cardinality types

Defines the direction of signal flow for pin decorators.

INPUT = 'input'#
OUTPUT = 'output'#
BIDIRECTIONAL = 'bidirectional'#
class DecoratorSpec[source]#

Base class for all pin decorator specifications

This is the base type for data structures that specify how pins should be decorated (e.g., Cardinality, ActiveLow, etc.)

shapes()[source]#

Return the shapes that make up this decorator

Return type:

tuple[Shape, ...]

placement()[source]#

Return the placement type for this decorator

Return type:

DecoratorPlacement

class DecoratorConfig(cardinality=<factory>, active_low=<factory>, open_collector=<factory>, clock=<factory>)[source]#

Default configurations for all decorator types

Parameters:
cardinality: Cardinality#

Configuration for cardinality decorators

active_low: ActiveLow#

Configuration for active-low decorators

open_collector: OpenCollector#

Configuration for open-collector decorators

clock: Clock#

Configuration for clock decorators

class PinDecorator(spec)[source]#

Bases: Property

Pin decorator property. This should be assigned to a component port for pin-specific decoration.

Parameters:

spec (DecoratorSpec)

spec: DecoratorSpec#

The decorator specification that this property represents

shapes()[source]#
Return type:

tuple[Shape, ...]

class ActiveLow(diameter=0.7, nudge=(0.0, 0.0))[source]#

Bases: DecoratorSpec

Active-low (bubble) pin decorator specification

Creates a circle/bubble symbol to indicate active-low signals.

Parameters:
diameter: float = 0.7#

Diameter of the bubble in symbol grid units

nudge: tuple[float, float] = (0.0, 0.0)#

Offset to position the bubble aesthetically

shapes()[source]#

Return the shapes that make up this decorator

Return type:

tuple[Shape, ...]

placement()[source]#

Return the placement type for this decorator

Return type:

DecoratorPlacement

class OpenCollector(oc_type=OpenCollectorType.SINK, width=0.7, line_width=0.15, pullup_down=False, nudge=None)[source]#

Bases: DecoratorSpec

Open collector pin decorator specification

Creates a diamond symbol with optional hat and pullup/pulldown indicator.

Parameters:
oc_type: OpenCollectorType = 'sink'#

Type of open collector (sink or source)

width: float = 0.7#

Size of the diamond symbol

line_width: float = 0.15#

Stroke width for the symbol lines

pullup_down: bool = False#

Whether to show internal pullup/pulldown resistor indicator

nudge: tuple[float, float] | None = None#

Position offset for the symbol

shapes()[source]#

Return the shapes that make up this decorator

Return type:

tuple[Shape, ...]

placement()[source]#

Return the placement type for this decorator

Return type:

DecoratorPlacement

class Clock(size=0.85, line_width=0.15)[source]#

Bases: DecoratorSpec

Clock pin decorator specification

Creates a “>” shaped symbol to indicate clock inputs.

Parameters:
size: float | tuple[float, float] = 0.85#

Size of the clock symbol

line_width: float = 0.15#

Stroke width for the symbol lines

shapes()[source]#

Return the shapes that make up this decorator

Return type:

tuple[Shape, ...]

placement()[source]#

Return the placement type for this decorator

Return type:

DecoratorPlacement

class Cardinality(cardinality, size=(0.85, 0.85), nudge=None)[source]#

Bases: DecoratorSpec

Pin cardinality specification

This is a data structure that specifies the direction of signal flow for a pin (input, output, or bidirectional).

Parameters:
cardinality: CardinalityType#

The direction of signal flow for this pin

size: float | tuple[float, float] = (0.85, 0.85)#

The size of the arrow symbols

nudge: tuple[float, float] | None = None#

The nudge offset for the arrow symbols

shapes()[source]#

Return the shapes that make up this decorator

Return type:

tuple[Shape, ...]

placement()[source]#

Return the placement type for this decorator

Return type:

DecoratorPlacement

placement(spec)[source]#

Get the placement type for a decorator spec

Return type:

DecoratorPlacement

Parameters:

spec (DecoratorSpec)

decorate(port, spec)[source]#

Decorate a port with a pin decorator spec

Return type:

None

Parameters:
draw(decorator, direction, at)[source]#
Return type:

tuple[Shape, ...]

Parameters:
Input(size=(0.85, 0.85), nudge=None)[source]#
Parameters:
Output(size=(0.85, 0.85), nudge=None)[source]#
Parameters:
Bidirectional(size=(0.85, 0.85), nudge=None)[source]#
Parameters:
OpenCollectorSource(width=0.7, line_width=0.15, pullup_down=False, nudge=None)[source]#
Parameters:
OpenCollectorSink(width=0.7, line_width=0.15, pullup_down=False, nudge=None)[source]#
Parameters: