How to replace #IFDEFs with TVF?

Version 1

    By using the basic TCL flow control and variable syntax all #IFDEFs can be eliminated.

    In the example below please note the use of \[ in the device definition with TVF. This keeps the TCL portion of TVF from interpreting that set of [] as a standard TCl [] directive.

     

    Example:

    ------ SVRF --------
    #DEFINE THIS_FLOW "mos"

    #IFDEF THIS_FLOW "mos"
    device mn ngate ipoly nsd nsd s_pwell [0] // nmos transistors
    #ELSE
    device mn ngate ipoly nsd nsd s_pwell [2] // nmos transistors
    #ENDIF

     

    ------TVF ----------------------
    set THIS_FLOW "mos"

    if { $THIS_FLOW == "mos" } {
    set FLOW_VAR 0
    } else {
    set FLOW_VAR 2
    }

    device mn ngate ipoly nsd nsd s_pwell \[$FLOW_VAR]