Skip to content

jsl/pin-assignment/generators

Package name: jsl/pin-assignment/generators

Summary

General Definitions

Function Description
swizzle-bus Swizzle a Bus Bundle
reversible-dual-pair Reversible Diff-Pair Support Generator
add-pass-through Generate a Bidirectional pass-through support
cross-bar Construct a N:N crossbar of supports for these ports
connect-require-ports Connect a set of ports/nets to require ports on C
one-to-one Construct a 1:1 Support Mapping for a single, bundle, or array.
swappable-diff-pair (+ 1) Swappable Diff-Pair Support Generator from single pins
bidir-swappable-dual-pair (+ 1) Generator to construct a Bidirectional, Swappable Dual Pair support
one-of Construct a support that will select one of a list of options to satisfy that support.

Definitions

General Definitions

swizzle-bus

Swizzle a Bus Bundle

public defn swizzle-bus (bus-bundle:JITXObject -- locked:Tuple<Int>)

This constructs a supports statement for a bus bundle. A bus bundle is a bundle with one PortArray pin definition. The support statement then constructs a cross-bar for the ?

reversible-dual-pair

Reversible Diff-Pair Support Generator

public defn reversible-dual-pair (A:JITXObject, B:JITXObject)

  • A: JITXObject - diff-pair bundle port instance
  • B: JITXObject - diff-pair bundle port instance

This function generates a supports statement for a dual-pair. This supports statement defines two allowable configurations:

  1. A => B
  2. B => A

This is for supporting bidirectional diff-pair where we don't care which side is the input vs the output but we do care what the P/N ordering is.

add-pass-through

Generate a Bidirectional pass-through support

public defn add-pass-through (p1:JITXObject, p2:JITXObject)

  • p1: JITXObject - SinglePin object for one side of the pass through.
  • p2: JITXObject - SinglePin object for the other side of the pass through.

This function expects to be called within a pcb-component definition.

cross-bar

Construct a N:N crossbar of supports for these ports

public defn cross-bar (ports:JITXObject ...)

This is useful for constructing supports that allow the user to map a particular pin/bundle/etc to any incoming connection to a bundle of that type.

connect-require-ports

Connect a set of ports/nets to require ports on C

public defn connect-require-ports (C:JITXObject, port-set:Seqable<JITXObject> -- def-bundle:Bundle = ?)

  • C: JITXObject - Component Instance from which require ports will be extracted.
  • port-set: Seqable<JITXObject> - The port objects that we will interrogate and then construct require ports for. Each element, we will find its PortType and then take one of three actions:
  • For SinglePin, we will require a def-bundle from C and net to it.
  • For PortArray, we will recursively call connect-require-ports on each child element.
  • For Bundle, we will require a bundle of matching type fromC` and net to it.
  • def-bundle: Bundle - For SinglePin ports, we will use this default bundle type when creating require statements. This bundle must have one port in its definition and that port must be a SinglePin. By default this function uses gpio.

This function expects to be called from a pcb-module context.

This function is recursive for PortArray instances.

This function will create a new require port for each of the port objects in port-set and then net that port to the newly created require port.

This function assumes that C has sufficient supports defined to satisfy all of the passed ports. If not - this will likely result in an UNSAT or Unsatisfiable condition at runtime.

one-to-one

Construct a 1:1 Support Mapping for a single, bundle, or array.

public defn one-to-one (pb:JITXObject|Bundle, p2:JITXObject)

  • pb: JITXObject|Bundle - This object is either a bundle definition (the top level instance in a supports statement) or a JITXObject (ie, a pin).
  • p2: JITXObject - This is the object being assigned to the supports bundle. It is either a single pin, bundle, or array - but must match with its counter part.

This tool is used when generating a mapping inside a supports/option statement.

This function is recursive.

swappable-diff-pair

Swappable Diff-Pair Support Generator from single pins

public defn swappable-diff-pair (p1:JITXObject, p2:JITXObject)

  • p1: JITXObject - Single Pin that makes up one of the strands of the diff-pair
  • p2: JITXObject - Single Pin that makes up the other strand of the diff-pair

This function is a generator that constructs the support statements for a differential pair on a component or module where the ordering of the positive and negative terminals is not necessarily important.

This is most commonly used for cases where:

  1. There is no polarity - for example, an ESD chip does not care whether P or N are swapped. It is going to do the same protection function regardless
  2. There is some internal circuitry (mux) that allows the user to select the polarity of the signal, possibly by writing a register in firmware.

swappable-diff-pair

Swappable Diff-Pair Support Generator from bundle

public defn swappable-diff-pair (dp:JITXObject)

  • dp: JITXObject - Bundle Port of type diff-pair. This will construct an abstract pin that can be satisfied by either P/N or N/P as a diff-pair.

bidir-swappable-dual-pair

Generator to construct a Bidirectional, Swappable Dual Pair support

public defn bidir-swappable-dual-pair (A:JITXObject, B:JITXObject)

  • A: JITXObject - Expected to be a diff-pair bundle for one side of the dual-pair
  • B: JITXObject - Expected to be a diff-pair bundle for the other side of the diff-pair

bidir-swappable-dual-pair

Generator to construct a Bidirectional, Swappable Dual Pair support

public defn bidir-swappable-dual-pair (A-P:JITXObject, A-N:JITXObject, B-P:JITXObject, B-N:JITXObject)

  • A-P: JITXObject - Single pin for P side of a diff-pair for side A of the dual-pair
  • A-N: JITXObject - Single pin for N side of a diff-pair for side A of the dual-pair
  • B-P: JITXObject - Single pin for P side of a diff-pair for side B of the dual-pair
  • B-N: JITXObject - Single pin for N side of a diff-pair for side B of the dual-pair

This function constructs a support statement for a dual-pair that allows the pairs to be swapped (A => B) or (B => A). In addition, the differential pairs can swap (P => N) or (N => P) as long as both sides are consistent.

one-of

Construct a support that will select one of a list of options to satisfy that support.

public defn one-of (pins:JITXObject ...)

  • pins: JITXObject - list of SinglePin/PortArray/Bundle objects that will be selected from.

For example - lets say you have a microcontroller with two IO Ports A and B. Let's say that the MCU supports one timer output on either pins A[1], B[3], B[6].

You could construct this support with:

supports timer:
  timer.timer => one-of(self.A[1], self.B[3], self.B[6])

Related Packages

Forwarded by package: jsl/pin-assignment