The "select" control statement
----------------------------------------------
Abstract

The "select" statement is used to choose between sections of a circuit
based on an attribute passed in.  The switching is done as part of
preprocessing, in the same pass that selects typ/min/max.
----------------------------------------------
BNF

default : 'default' '=' literal '\n'
	| /* nothing */

case : 	'.case' literal '\n'
	net_list
	'.end' 'case' '\n'

case_list : case_list case
	| /* nothing */

select : '.select' '(' env_var ')' '\n'
	 default
	 case_list
	 '.end' 'select' '\n' 
----------------------------------------------
Description

The select statement takes the following form:

1. A line beginning with ".select", followed by the name of a string
attribute variable.
Example: .select (control_word)

2. An optional ".default" line specifying which choice to make when
the attribute is not passed in.
Example: .default = "[Off]"

3. At least one "case" section consisting of:

  3a. A line beginning with ".case", followed by the value that
  selects this case (the name of a value of the same enumeration type
  used in #1.), which also identifies the beginning of a circuit block
  which is connected only for this "case".

  3b. A list of circuit elements.  Control lines are not allowed,
  except for ".local", ".correlate" and ".inherit".  Others are
  considered to be errors.

  3c. A line ".end case".

4. The line ".end select" to terminate it.
----------------------------------------------
Uses in IBIS 3.2

This is used to implement the "series switch" model type.
----------------------------------------------
Application notes

1. The circuit topologies are not required to be the same or similar,
except that they must have identical connections, so switching is
possible. 

2. In the data section, there must be values provided for all cases.

3. The value of the attribute passed in must match one of the listed
case values.  If there is a ".default" statement, it is legal to not
pass in this attribute.  Still, it is an error to give a value that is
not listed.
----------------------------------------------
Example

[Define Model] on_or_off (pin1 pin2 ctrl)
.local t1
resistor Rser (pin1 t1) R = R_series || short

.select (ctrl)
  .case "[Off]"
    capacitor C1 (t1 pin2) C = C_shunt
  .case "[On]"
    resistor R1  (t1 pin2) R = R_shunt
    capacitor C1 (t1 pin2) C = C_shunt
.end select

[End Define Model]


This defines a new model type "on_or_off", that has two signal pins
and a control attribute "ctrl".  A portion of the circuit is selected
by the value of the attribute "ctrl".

The selectable circuits have two nodes that are switched.  (t1 and pin2).

The [Model] section must have an [Off] section and an [On] section.
A scalar "R_series" is optional outside of all [Off] an [On] blocks.
The [Off] block must define a value for "C_shunt".  The [On] block must
define a value for "R_shunt" and "C_shunt".

The two "C_shunt" keys are in different scopes, so the fact that the
names are the same is irrelevant.

A [Model] section might look like:

[Model]  swtched_load
Model_type on_or_off

R_series  10

[On]
R_shunt  100
C_shunt  50p

[Off]
C_shunt  100p

[End Model]

This expands differently depending on the value of the argument
"ctrl".

If "ctrl" has a value of "[On]":

.subckt swtched_load  pin1 pin2
Rser (pin1 t1) 10
R1   (t1 pin2) 100
C1   (t1 pin2) 50p
.ends

If "ctrl" has a value of "[Off]":

.subckt swtched_load  pin1 pin2
Rser (pin1 t1) 10
C1   (t1 pin2) 100p
.ends
----------------------------------------------
----------------------------------------------
