Skip to content

jsl/layerstack

Package name: jsl/layerstack

Summary

Data Types

LayerMaterial

Base class for Defining the Layer Material

Constructors

Function Description
LayerMaterial Constructor for defstruct LayerMaterial

Functions

Function Description
get-type
LayerSpec

DielectricMaterial

Functions

Function Description
FR4 Create a Generic FR4 layer
DielectricMaterial
Soldermask Create a Generic Soldermask layer

LayerSpec

Functions

Function Description
get-name
FR4 Create a Generic FR4 layer
add-top Add one or more layers to the top of the board stackup.
make-stack-statement
add-symmetric Symmetrically add another copper layer with dielectric to the stackup
conductors Get the idx-th conductor layer
LayerSpec
Soldermask Create a Generic Soldermask layer
make-layer-stack Construct a LayerStack with a tuple of outer layers.
is-soldermask
get-conductor Retrieve the conductor LayerSpec and the adjacent dielectric layers if any
get Get a layer by index
set-name
add-bottom Add one or more layers to the bottom of the board stackup.
LayerStack
add-soldermask Add a soldermask layer to both sides of the board.
Copper Create a Copper layer

ConductorMaterial

Functions

Function Description
Copper Create a Copper layer
compute-thickness Compute conductor layer thickness in mm from the layer weight (oz / ft^2)
ConductorMaterial

LayerStack

Functions

Function Description
get-conductor Retrieve the conductor LayerSpec and the adjacent dielectric layers if any
get-conductor-count Get the total number of conductor layers in the layer stack.
create-pcb-stackup
get Get a layer by index
add-bottom Add one or more layers to the bottom of the board stackup.
LayerStack
add-top Add one or more layers to the top of the board stackup.
add-soldermask Add a soldermask layer to both sides of the board.
add-symmetric Symmetrically add another copper layer with dielectric to the stackup
conductors Get the idx-th conductor layer
make-layer-stack Construct a LayerStack with a tuple of outer layers.

General Definitions

Variable Description
CopperMaterial
AluminumMaterial
FR4-Material
SoldermaskMaterial

Definitions

LayerMaterial

Base class for Defining the Layer Material

public defstruct LayerMaterial <: Hashable & Equalable
    description: Maybe<String>
    material-def: Maybe<JITXDef>
    name: Maybe<String>
    type: MaterialType

  • description: Maybe<String>

  • material-def: Maybe<JITXDef>

  • name: Maybe<String>

  • type: MaterialType

Constructors

LayerMaterial

Constructor for defstruct LayerMaterial

public defn LayerMaterial (name:Maybe<String>, type:MaterialType, description:Maybe<String>, material-def:Maybe<JITXDef>)

Functions

get-type

public defn get-type (x:LayerMaterial) -> MaterialType

  • Returns MaterialType

LayerSpec

public defn LayerSpec ( -- name:String = ?, desc:String = ?, material:LayerMaterial, thickness:Double) -> LayerSpec

  • Returns LayerSpec

DielectricMaterial

public defstruct DielectricMaterial <: LayerMaterial
    dielectric-coefficient: Maybe<Double>
    is-soldermask: True|False
    loss-tangent: Maybe<Double>

  • dielectric-coefficient: Maybe<Double>

  • is-soldermask: True|False

  • loss-tangent: Maybe<Double>

Functions

FR4

Create a Generic FR4 layer

public defn FR4 (thickness:Double, material:DielectricMaterial = ? -- name:String = ?, description:String = ?) -> LayerSpec

  • thickness: Double - thickness of the layer in mm
  • material: DielectricMaterial - material of the layer. The default is the generic FR4-Material definition.
  • name: String - name of the layer - by default this is None() implying no name.
  • description: String - Descriptive text for this layer. By default this is None() implying no description
  • Returns LayerSpec

Usage: FR4(1.0) : specify thickness in mm FR4(1.2, name = "core-1") : specify thickness and name FR4(0.3, Isola370, name = "prepreg") : specify thickness, material and name

DielectricMaterial

public defn DielectricMaterial ( -- name:String = ?, description:String = ?, dielectric-coefficient:Double = ?, roughness:Double = ?, loss-tangent:Double = ?, material-def:JITXDef = ?, is-soldermask:True|False = ?) -> DielectricMaterial

  • Returns DielectricMaterial

Soldermask

Create a Generic Soldermask layer

public defn Soldermask (thickness:Double, material:DielectricMaterial = ? -- name:String = ?, description:String = ?) -> LayerSpec

  • thickness: Double - thickness of the layer in mm
  • material: DielectricMaterial - material of the layer. The default is the generic SoldermaskMaterial definition.
  • name: String - name of the layer - by default this is None() implying no name.
  • description: String - Descriptive text for this layer. By default this is None() implying no description
  • Returns LayerSpec

LayerSpec

public defstruct LayerSpec <: Equalable
    description: Maybe<String>
    material: LayerMaterial
    name: Maybe<String>
    thickness: Double

  • description: Maybe<String>

  • material: LayerMaterial

  • name: Maybe<String>

  • thickness: Double

Functions

get-name

public defn get-name (x:LayerSpec) -> Maybe<String>

  • Returns Maybe<String>

FR4

Create a Generic FR4 layer

public defn FR4 (thickness:Double, material:DielectricMaterial = ? -- name:String = ?, description:String = ?) -> LayerSpec

  • thickness: Double - thickness of the layer in mm
  • material: DielectricMaterial - material of the layer. The default is the generic FR4-Material definition.
  • name: String - name of the layer - by default this is None() implying no name.
  • description: String - Descriptive text for this layer. By default this is None() implying no description
  • Returns LayerSpec

Usage: FR4(1.0) : specify thickness in mm FR4(1.2, name = "core-1") : specify thickness and name FR4(0.3, Isola370, name = "prepreg") : specify thickness, material and name

add-top

Add one or more layers to the top of the board stackup.

public defn add-top (l-set:LayerSpec|Collection<LayerSpec>, s:LayerStack) -> LayerStack

  • l-set: LayerSpec|Collection<LayerSpec> - layer or set of layers to add to the top of the stack. Note that if this value is a collection, then the layers will be added to the stack one at a time. For example:
add-top( [dielectric, copper], stack)

This will add the dielectric to the top of the stack, and then the copper on top of that. - s: LayerStack - LayerStack we are adding to. - Returns LayerStack - The modified layer stack object

When used on its own, this function is useful for creating asymmetric pcb stackups. This function is most useful when used on a non-empty layer stack.

make-stack-statement

public defn make-stack-statement (x:LayerSpec)

add-symmetric

Symmetrically add another copper layer with dielectric to the stackup

public defn add-symmetric (copper:LayerSpec, dielectric:LayerSpec, s:LayerStack) -> LayerStack

  • copper: LayerSpec - Copper Layer to add to the top and the bottom
  • dielectric: LayerSpec - Dielectric Layer to add to the top and the bottom.
  • s: LayerStack - The LayerStack object
  • Returns LayerStack - The LayerStack object that was passed in.

This function takes the current stackup and adds the dielectric layer on both sides, followed by the copper layer on both sides.

This results in a board that is built up from the center with 2 more dielectric layers, and 2 more copper layers. This constructs a symmetric stackup.

val stack = LayerStack(name = "6-Layer Symmetric Stackup")

val copper-35um = Copper(0.035, name = "cu")
val core-FR4 = FR4(1.0, name = "core")
val prepreg-FR4 = FR4(0.5, name = "prepreg")

add-symmetric(copper-35um, core-FR4,
  add-symmetric(copper-35um, prepreg-FR4,
    add-symmetric(copper-35um, core-FR4, stack)
  )
)

conductors

Get the idx-th conductor layer

public defn conductors (ls:LayerStack) -> Tuple<LayerSpec>

  • Returns Tuple<LayerSpec>

Usage: conductors(stack)[idx]

LayerSpec

public defn LayerSpec ( -- name:String = ?, desc:String = ?, material:LayerMaterial, thickness:Double) -> LayerSpec

  • Returns LayerSpec

Soldermask

Create a Generic Soldermask layer

public defn Soldermask (thickness:Double, material:DielectricMaterial = ? -- name:String = ?, description:String = ?) -> LayerSpec

  • thickness: Double - thickness of the layer in mm
  • material: DielectricMaterial - material of the layer. The default is the generic SoldermaskMaterial definition.
  • name: String - name of the layer - by default this is None() implying no name.
  • description: String - Descriptive text for this layer. By default this is None() implying no description
  • Returns LayerSpec

make-layer-stack

Construct a LayerStack with a tuple of outer layers.

public defn make-layer-stack (name:String, top-layers:Tuple<[LayerSpec, LayerSpec]> -- description:String = ?, soldermask:LayerSpec = ?) -> LayerStack

  • name: String - The name of the LayerStack
  • top-layers: Tuple<[LayerSpec, LayerSpec]> - The pairs of mechanical and dielectric layers, from outer to inner layers.
  • description: String - The description of the LayerStack
  • Returns LayerStack

Example:

  val copper-35um = Copper(0.035)
  val copper-17_5um = Copper(0.0175)
  val jlcpcb-jlc2313 = make-layer-stack("JLCPCB 4-layer 1.6mm", outer-layers,
    soldermask = soldermask) where :
    val soldermask = Soldermask(0.019, SoldermaskMaterial)
    val prepreg-2313 = FR4(0.1, FR4-Material-2313)
    val core-2313 = FR4(1.265, FR4-Material-Core)
    val outer-layers = [
      [copper-35um prepreg-2313]
      [copper-17_5um core-2313]
    ]
The LayerStack created has these layers: [ soldermask copper-35um prepreg-2313 copper-17_5um core-2313 copper-17_5um prepreg-2313 copper-35um soldermask ]

is-soldermask

public defn is-soldermask (l:LayerSpec) -> True|False

  • Returns True|False

get-conductor

Retrieve the conductor LayerSpec and the adjacent dielectric layers if any

public defn get-conductor (ls:LayerStack, index:Int) -> [Maybe<LayerSpec>, LayerSpec, Maybe<LayerSpec>]

  • ls: LayerStack - LayerStack object to interrogate
  • index: Int - Conductor layer to inspect. This is a zero-based index where the top layer is 0, the first inner layer is 1, etc.
  • Returns [Maybe<LayerSpec>, LayerSpec, Maybe<LayerSpec>]

When calculating trace widths, etc it is often useful to know the features of the copper layers those traces will be placed on. This function helps extract the copper layer data as well as the adjacent dielectric layers if any.

get

Get a layer by index

public defn get (ls:LayerStack, idx:Int) -> LayerSpec

  • Returns LayerSpec

Usage: stack[idx]

set-name

public defn set-name (l:LayerSpec, name:String)

add-bottom

Add one or more layers to the bottom of the board stackup.

public defn add-bottom (l-set:LayerSpec|Collection<LayerSpec>, s:LayerStack) -> LayerStack

  • l-set: LayerSpec|Collection<LayerSpec> - layer or set of layers to add to the top of the stack. Note that if this value is a collection, then the layers will be added to the stack one at a time. For example:
add-bottom( [dielectric, copper], stack)

This will add the dielectric to the bottom of the stack, and then the copper after the dielectric. - s: LayerStack - LayerStack we are adding to. - Returns LayerStack - The modified layer stack object

When used on its own, this function is useful for creating asymmetric pcb stackups. This function is most useful when used on a non-empty layer stack.

LayerStack

public defn LayerStack ( -- name:String = ?, description:String = ?, initial-layers:Seqable<LayerSpec> = ?) -> LayerStack

  • Returns LayerStack

add-soldermask

Add a soldermask layer to both sides of the board.

public defn add-soldermask (sm:LayerSpec, s:LayerStack) -> LayerStack

  • Returns LayerStack

Copper

Create a Copper layer

public defn Copper (thickness:Double, material:ConductorMaterial = ? -- name:String = ?, description:String = ?) -> LayerSpec

  • thickness: Double - thickness of the layer in mm
  • material: ConductorMaterial - material of the layer. The default is the generic CopperMaterial definition.
  • name: String - name of the layer - by default this is None() implying no name.
  • description: String - Descriptive text for this layer. By default this is None() implying no description
  • Returns LayerSpec

Usage: Copper(0.3) : specify thickness Copper(0.3, name = "Cu") : specify thickness and name Copper(0.3, CustomCuMaterial, name = "PWR") : specify thickness, material and name

ConductorMaterial

public defstruct ConductorMaterial <: LayerMaterial
    density: Double
    roughness: Maybe<Double>

  • density: Double - Density of this Conductor material in g / mm^3

  • roughness: Maybe<Double> - Surface roughness in mm RMS.

Functions

Copper

Create a Copper layer

public defn Copper (thickness:Double, material:ConductorMaterial = ? -- name:String = ?, description:String = ?) -> LayerSpec

  • thickness: Double - thickness of the layer in mm
  • material: ConductorMaterial - material of the layer. The default is the generic CopperMaterial definition.
  • name: String - name of the layer - by default this is None() implying no name.
  • description: String - Descriptive text for this layer. By default this is None() implying no description
  • Returns LayerSpec

Usage: Copper(0.3) : specify thickness Copper(0.3, name = "Cu") : specify thickness and name Copper(0.3, CustomCuMaterial, name = "PWR") : specify thickness, material and name

compute-thickness

Compute conductor layer thickness in mm from the layer weight (oz / ft^2)

public defn compute-thickness (x:ConductorMaterial, weight:Double) -> Double

  • x: ConductorMaterial - Conductor Material type
  • weight: Double - expects a value like 0.5, 1.0, 2.0 etc for the weight of the metal layer in oz / ft^2.
  • Returns Double - Layer thickness in mm

ConductorMaterial

public defn ConductorMaterial ( -- name:String = ?, description:String = ?, density:Double, roughness:Double = ?, material-def:JITXDef = ?) -> ConductorMaterial

  • Returns ConductorMaterial

LayerStack

public defstruct LayerStack
    description: Maybe<String>
    layers: Vector<LayerSpec>
    name: Maybe<String>

  • description: Maybe<String>

  • layers: Vector<LayerSpec>

  • name: Maybe<String>

Functions

get-conductor

Retrieve the conductor LayerSpec and the adjacent dielectric layers if any

public defn get-conductor (ls:LayerStack, index:Int) -> [Maybe<LayerSpec>, LayerSpec, Maybe<LayerSpec>]

  • ls: LayerStack - LayerStack object to interrogate
  • index: Int - Conductor layer to inspect. This is a zero-based index where the top layer is 0, the first inner layer is 1, etc.
  • Returns [Maybe<LayerSpec>, LayerSpec, Maybe<LayerSpec>]

When calculating trace widths, etc it is often useful to know the features of the copper layers those traces will be placed on. This function helps extract the copper layer data as well as the adjacent dielectric layers if any.

get-conductor-count

Get the total number of conductor layers in the layer stack.

public defn get-conductor-count (ls:LayerStack) -> Int

  • Returns Int

This is the number of signal and plane layers that are available in this stackup.

create-pcb-stackup

public defn create-pcb-stackup (ls:LayerStack)

get

Get a layer by index

public defn get (ls:LayerStack, idx:Int) -> LayerSpec

  • Returns LayerSpec

Usage: stack[idx]

add-bottom

Add one or more layers to the bottom of the board stackup.

public defn add-bottom (l-set:LayerSpec|Collection<LayerSpec>, s:LayerStack) -> LayerStack

  • l-set: LayerSpec|Collection<LayerSpec> - layer or set of layers to add to the top of the stack. Note that if this value is a collection, then the layers will be added to the stack one at a time. For example:
add-bottom( [dielectric, copper], stack)

This will add the dielectric to the bottom of the stack, and then the copper after the dielectric. - s: LayerStack - LayerStack we are adding to. - Returns LayerStack - The modified layer stack object

When used on its own, this function is useful for creating asymmetric pcb stackups. This function is most useful when used on a non-empty layer stack.

LayerStack

public defn LayerStack ( -- name:String = ?, description:String = ?, initial-layers:Seqable<LayerSpec> = ?) -> LayerStack

  • Returns LayerStack

add-top

Add one or more layers to the top of the board stackup.

public defn add-top (l-set:LayerSpec|Collection<LayerSpec>, s:LayerStack) -> LayerStack

  • l-set: LayerSpec|Collection<LayerSpec> - layer or set of layers to add to the top of the stack. Note that if this value is a collection, then the layers will be added to the stack one at a time. For example:
add-top( [dielectric, copper], stack)

This will add the dielectric to the top of the stack, and then the copper on top of that. - s: LayerStack - LayerStack we are adding to. - Returns LayerStack - The modified layer stack object

When used on its own, this function is useful for creating asymmetric pcb stackups. This function is most useful when used on a non-empty layer stack.

add-soldermask

Add a soldermask layer to both sides of the board.

public defn add-soldermask (sm:LayerSpec, s:LayerStack) -> LayerStack

  • Returns LayerStack

add-symmetric

Symmetrically add another copper layer with dielectric to the stackup

public defn add-symmetric (copper:LayerSpec, dielectric:LayerSpec, s:LayerStack) -> LayerStack

  • copper: LayerSpec - Copper Layer to add to the top and the bottom
  • dielectric: LayerSpec - Dielectric Layer to add to the top and the bottom.
  • s: LayerStack - The LayerStack object
  • Returns LayerStack - The LayerStack object that was passed in.

This function takes the current stackup and adds the dielectric layer on both sides, followed by the copper layer on both sides.

This results in a board that is built up from the center with 2 more dielectric layers, and 2 more copper layers. This constructs a symmetric stackup.

val stack = LayerStack(name = "6-Layer Symmetric Stackup")

val copper-35um = Copper(0.035, name = "cu")
val core-FR4 = FR4(1.0, name = "core")
val prepreg-FR4 = FR4(0.5, name = "prepreg")

add-symmetric(copper-35um, core-FR4,
  add-symmetric(copper-35um, prepreg-FR4,
    add-symmetric(copper-35um, core-FR4, stack)
  )
)

conductors

Get the idx-th conductor layer

public defn conductors (ls:LayerStack) -> Tuple<LayerSpec>

  • Returns Tuple<LayerSpec>

Usage: conductors(stack)[idx]

make-layer-stack

Construct a LayerStack with a tuple of outer layers.

public defn make-layer-stack (name:String, top-layers:Tuple<[LayerSpec, LayerSpec]> -- description:String = ?, soldermask:LayerSpec = ?) -> LayerStack

  • name: String - The name of the LayerStack
  • top-layers: Tuple<[LayerSpec, LayerSpec]> - The pairs of mechanical and dielectric layers, from outer to inner layers.
  • description: String - The description of the LayerStack
  • Returns LayerStack

Example:

  val copper-35um = Copper(0.035)
  val copper-17_5um = Copper(0.0175)
  val jlcpcb-jlc2313 = make-layer-stack("JLCPCB 4-layer 1.6mm", outer-layers,
    soldermask = soldermask) where :
    val soldermask = Soldermask(0.019, SoldermaskMaterial)
    val prepreg-2313 = FR4(0.1, FR4-Material-2313)
    val core-2313 = FR4(1.265, FR4-Material-Core)
    val outer-layers = [
      [copper-35um prepreg-2313]
      [copper-17_5um core-2313]
    ]
The LayerStack created has these layers: [ soldermask copper-35um prepreg-2313 copper-17_5um core-2313 copper-17_5um prepreg-2313 copper-35um soldermask ]

General Definitions

CopperMaterial

public val CopperMaterial

AluminumMaterial

public val AluminumMaterial

FR4-Material

public val FR4-Material

SoldermaskMaterial

public val SoldermaskMaterial