Boards¶
A pcb-board
statement defines the physical structure of the circuit board for a design. A board contains a stackup, boundary, signal boundary, and optional layer statements.
Signature¶
pcb-board board-name (arg1:Type1, ...):
name = <String|False>
description = <String|False>
boundary = <Shape>
signal-boundary = <Shape|False>
stackup = <Stackup>
vias = [<Via>, <Via>, ... ]
layer(<LayerSpecifier>) = <Shape>
...
The expression name board-name
uniquely identifies this board definition in the current context.
The argument list (arg1:Type1, ...)
is optional and provides a means of constructing parameterized board definitions.
- Required Parameters
boundary
- This is aShape
that defines the physical board shape.- This shape must be a simple polygon.
- This means that it must not have any holes or self-intersections.
- This shape should be a filled shape, e.g. Rectangle or Polygon, and not a bare outline e.g. Line
stackup
- User must provide a pcb-stackup definition.- This defines the copper and dielectric layer stackup.
vias
- Tuple of pcb-via definitions.- These definitions limit what vias are allowed to be placed on the board.
- Only the vias present in this tuple will populate the drop-down via menu in the board tool.
- Optional Parameters
name
- Optional string to provide a human readable name, mostly for the UI. If not present, then the expression name will be used.description
- Optional string to describe this object. This is primarily for documentation and use in the UI.signal-boundary
- This is an optionalShape
that defines what region of the board the router is allowed to route copper.- This shape must be a simple polygon.
- This shape should be a filled shape, e.g. Rectangle or Polygon, and not a bare outline e.g. Line
- If not provided, the board definition will re-use the
boundary
shape for this parameter. - If provided, this shape must be no larger than the
boundary
shape. If this shape exceeds theboundary
shape, then the JITX runtime will raise an error.
layer()
- Optional layer statements that allow the user to introduce geometry on any of the layers of the board.
Usage¶
The pcb-board
definition is passed to the JITX runtime via the set-board function.
The pcb-board
definition is passed to the JITX runtime via the set-board function.
val board-shape = Rectangle(60.0, 40.0)
val my-stackup = ocdb/manufacturers/stackups/jlcpcb-jlc2313
pcb-via default-th:
start = Top
stop = Bottom
diameter = 0.65
hole-diameter = 0.4
type = MechanicalDrill
tented = true
pcb-board my-circuit-board :
stackup = my-stackup
boundary = board-shape
signal-boundary = offset(board-shape, -0.5)
vias = [default-th]
...
set-board(my-circuit-board)
The OCDB library has many predefined stackups that can be useful for building prototypes.
Notice the use of the offset function to construct a signal-boundary
that is slightly inset from the board boundary
.
Notice the use of the offset function to construct a signal-boundary
that is slightly inset from the board boundary
.
Using Arguments¶
Parameterized board definitions can be useful when constructing common structures. Building on the previous example:
val STD-FIXTURE-SHAPE = RoundedRectangle(100.0, 40.0, 1.0)
pcb-board fixture-board (
base-stackup:Stackup,
--
outline:Shape = STD-FIXTURE-SHAPE,
sig-buffer:Double = 0.5
) :
name = to-string("fixture-%_-%_" % [outline, sig-buffer])
stackup = base-stackup
boundary = outline
signal-boundary = offset(outline, (- sig-buffer))
vias = [default-th]
...
val my-stackup = ocdb/manufacturers/stackups/jlcpcb-jlc2313
; Example #1
val brd = fixture-board(my-stackup)
; Example #2
val brd = fixture-board(my-stackup, sig-buffer = 1.0)
set-board( brd )
In this example, we demonstrate the use of optional keyword arguments for parametrically defining the board for our design.
Here the sig-buffer
argument is a keyword argument with a default value of 0.5
. This forces the signal-boundary
to be 0.5mm smaller than the boundary
shape on all sides
of the board.
Making it a keyword argument provides better readability of the code - we don't have to wonder whether that second argument was supposed to be the outline
shape or the sig-buffer
.
It is often convenient to include a name
constructed from the parameters so that we can differentiate two different pcb-board
definitions constructed with this function.
Using Generators¶
Generators are a tool to compose reusable features into a definition.
defn set-boundary (outline:Shape -- sig-buffer:Double = 0.5) :
inside pcb-board:
boundary = outline
signal-boundary = offset(outline, (- sig-buffer))
val board-shape = Rectangle(60.0, 40.0)
pcb-board circuit-board-2 :
stackup = my-stackup
vias = [default-th]
set-boundary(board-shape)
...
set-board(circuit-board-2)
The set-boundary
function is a generator. Notice the use of the inside pcb-board
syntax. When set-boundary
is called from within the context of a pcb-board
definition, it can create any of the expected pcb-board
parameters. In this particular instance, the set-boundary
function sets the boundary
and signal-boundary
parameters.
The resulting circuit-board-2
definition would be equivalent to:
val board-shape = Rectangle(60.0, 40.0)
pcb-board equivalent-circuit-board :
stackup = my-stackup
vias = [default-th]
boundary = board-shape
signal-boundary = offset(board-shape, -0.5)
Calling set-boundary
from any other context (ie, a regular function or a pcb-module
) will elicit an error because the boundary =
syntax will be unknown.