Product Documentation
Spectre FX Circuit Simulator User Guide
Product Version 23.1, September 2023

.if and .else

.if (condition_1)
 Statements
.elseif (condition_2)
 Statements
.else
 Statements
.endif

Description

Specifies the different conditions that determine the components that are instantiated by the Spectre FX simulator for a given simulation. The determining conditions are computed from the values of parameter expressions. You can specify these conditions with the structural .if/.else statement. These statements can be embedded.

Arguments

Name Description

condition

Boolean-valued expressions where a non-zero value is considered as true.

statements

Contains one or more instance statements or .if statements. The .else or .elseif part of the statement is optional.

Example

The following example illustrates the use of the .if statement. There are additional .if statements in the statement1 and statement2 fields.

.param cvalue=1p 
.if (rseries == 0)
c1 a b cvalue
.if (gparallel != 0) 
rgp1 a b '1/gparallel'
.endif
.else  
r2 a x rseries 
c2 x b cvalue
.if (gparallel != 0) 
rgp2 x b '1/gparallel'
.endif
.endif

In the above example, the Spectre FX simulator adds different instance statements into the simulation depending on the values of the parameters, rseries and gparallel.

Related Topics

Conditional Instances


Return to top
 ⠀
X