Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Third version of make-layer-stack to use add-symmetric on a tuple of LayerSpec #92

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lchao-jitx
Copy link
Contributor

The third version of make-layer-stack with simplified interface and a version of add-symmetric that supports a tuple of LayerSpec and even-layers? flag

public defn make-layer-stack (name:String,
  series-of-top-layers:Tuple<Tuple<LayerSpec>>
      -- description:String = ?,
         soldermask:LayerSpec = ?,
         even-layers?:True|False = false) -> LayerStack :
  val stack = #LayerStack(One(name), description)
  ;Access pairs of outer-layers in reverse order
  for top-layers in in-reverse(series-of-top-layers) do :
    add-symmetric(top-layers, stack, even-layers? = even-layers?)
  ;Add soldermask
  if value?(soldermask) is LayerSpec :
    add-soldermask(value!(soldermask), stack)
  ;Return the LayerStack
  stack

Perhaps, we could rename even-layers? since it really indicates whether the center of the stackup has one single layer or two identical layers. Here is the enhanced add-symmetric

public defn add-symmetric (top-layers:Tuple<LayerSpec>, stack:LayerStack
      -- even-layers?:True|False = false) -> LayerStack :
  ;Verify input
  if length(top-layers) <= 1 :
    throw(Exception("Invalid argument: Expect two or more layers in the tuple. Found %_" % [top-layers]))
  ;Get layers from outermost to innermost layers
  val layers-vec = to-vector<LayerSpec> $ top-layers
  ;Add innermost layer
  if length(layers(stack)) == 0 and not even-layers? :
    val innermost = pop(layers-vec) ; layers-vec contains the remaining layers
    ;Add the innermost layer(s)
    add(layers(stack), innermost)
  ;Add the remaining layers
  val reversed-layers = reverse $ to-list $ layers-vec ; reversed order - from inner to outer layers
  add-top(reversed-layers, stack)
  add-bottom(reversed-layers, stack)
  stack

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant