structure

The structure statement is a means of applying the Routing Structure constraint to a signal topology. This constraint is used by the routing engine to apply the appropriate geometry to signal routes on the board.

This statement is only valid within the pcb-module context.

These constraints are applied to the endpoints of a signal topology. The routing engine will infer that this constraint must be applied to every segment of the topology between the passed endpoints.

Signature

; Explicit Endpoint Form
structure(<REF-1>, <REF-2>) = <RoutingStructure|DifferentialRoutingStructure>

; KeyValue Form
structure(<EXP>) = <RoutingStructure|DifferentialRoutingStructure>
structure(<EXP-1>, <EXP-2>) = <DifferentialRoutingStructure>

For the Explicit Endpoint form, the user provides a ref to a set of ports. The requirements are:

  1. The &lt;REF-*> must be a ref to a component, module, or abstract (require) port.
    1. For RoutingStructure (Single-Ended):
      1. This port can be a SinglePin, Bundle, or PortArray
    2. For DifferentialRoutingStructure:
      1. This port must be of type Bundle.
      2. The Bundle type of this port must contain 2 SinglePin ports.
      3. This is typically a diff-pair bundle
  2. The types of &lt;REF-1> and &lt;REF-2> must match.
    1. If &lt;REF-1> is a SinglePin then &lt;REF-2> must also be a SinglePin

For the KeyValue form, the user can use the => operator to construct the endpoint expression &lt;EXP-*>.

In its simplest form - the KeyValue expression looks something like this:

structure( <REF-1> => <REF-2> ) = <RoutingStructure|DifferentialRoutingStructure>

The same requirements for &lt;REF-*> defined in the Explicit Endpoint form exist for the KeyValue form.

Routing Structures

The structure statement is a means of applying a geometry constraint to a signal topology. Because of the complex nature of a PCB design, this typically requires more than just a single trace width. Hence the need for a "Routing Structure" type that encodes this information across layers and other board conditions.

Usage

The structure statement requires the passed endpoints to be part of a Valid Topology.


pcb-differential-routing-structure diff-100:
  trace-width = 0.145
  pair-spacing = 0.127
  clearance = 0.3
  ...

pcb-component KSZ8081:
  port TX : diff-pair
  port RX : diff-pair
  ...

pcb-component RJ45-with-magnetics:
  port TX : diff-pair
  port RX : diff-pair
  ...

pcb-module ethernet-demo :

  inst PHY : KSZ8081
  inst conn : RJ45-with-magnetics

  net (PHY.TX, conn.TX)
  net (PHY.RX, conn.RX)

  ; Construct the Topology between the PHY and connector
  topology-segment(PHY.TX, conn.TX)
  topology-segment(PHY.RX, conn.RX)

  ; Add the structure constraint for this topology.
  structure(PHY.TX => conn.TX) = diff-100
  structure(PHY.RX => conn.RX) = diff-100

The above is a typical differential pair example. Here there are two differential pairs, one for TX and one for RX that make up a 100-BaseT lane.

The structure statement applies a 100 ohm differential impedance to both diff-pair ports of the lane.

There are two equivalent forms of this statement.

Equivalent Form #1 - SinglePin KeyValue Form

  ; SinglePin KeyValue Form
  ; Equivalent `structure` statements as the `diff-pair`
  structure(PHY.TX.P => conn.TX.P, PHY.TX.N => conn.TX.N ) = diff-100
  structure(PHY.RX.P => conn.RX.P, PHY.RX.N => conn.RX.N ) = diff-100

This form is more verbose and explicitly calls out each SinglePin port of the diff-pair. This can be a useful form when the diff-pair signals are not necessarily in nice, tidy bundles. You may need to select ports on disparate components and tie them together with a structure.

Equivalent Form #2 - Exlicit Ref Form


  ; Explicit Ref Form
  ; Equivalent `structure` statements as the `diff-pair`
  structure(PHY.TX, conn.TX) = diff-100
  structure(PHY.RX, conn.RX) = diff-100

In this form, we avoid the => operator in favor of an "argument" syntax. This is an older form of the same constraint.

Single-Ended on PortArray

For certain bus style architectures, like MicroSD, we need to apply a single-ended routing structure across mutiple singles in a PortArray.


pcb-routing-structure se-50 :
  name = "50 Ohm single-ended"
  ...

pcb-bundle micro-sd:
  port data : pin[4]
  port clk : pin
  port cmd : pin

pcb-component MCU:
  port sd : micro-sd
  ...

pcb-component SDCard_Connector : 
  port sd : micro-sd
  ...

pcb-module portarray-example :

  inst mcu : MCU
  inst conn : SDCard_Connector

  net (mcu.sd.data, conn.sd.data)
  topology-segment(mcu.sd.data, conn.sd.data)

  structure(mcu.sd.data => conn.sd.data) = se-50

Notice that micro-sd.data is a PortArray port consisting of 4 SinglePin ports. We can connect these two port arrays on the mcu and conn instances directly. Subsequently, we can use the structure statement to apply the routing structure constraint.

In this case, the se-50 routing constraint gets applied, individually, to each of the signals of the data port array. This would be the same as:


  for i in 0 to length(mcu.sd.data) do:
    structure(mcu.sd.data[i] => conn.sd.data[i]) = se-50