10.06.2016 Views

eldo_user

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Eldo Netlist Setup<br />

Directives Interpreted by the Eldo Parser (Default)<br />

A definition can be specified in two ways:<br />

• when invoking Eldo with:<br />

<strong>eldo</strong> -define <br />

• in the netlist with:<br />

#define <br />

...<br />

For example, -define foo on the command line is equivalent to #define foo in the netlist. For<br />

both methods, the netlist statement #ifdef foo will be true.<br />

The #if statement can be used for making complex conditional statements using logical<br />

operators: OR ||, AND &&; and comparison operators: not equal to !=, equal to ==. For<br />

example:<br />

#if (defined(U) || defined(A))<br />

The #if directive can also be used in conjunction with the defined function, that is, if a #define<br />

is active, defined() returns 1 whatever value is assigned to .<br />

Pre-processor commands are position dependent; Eldo behaves like C: the #define is acted upon<br />

only when encountered. In an Eldo (or Questa ADMS mixed-signal) netlist there are normal<br />

SPICE commands and/or netlist pre-processor commands that work completely differently.<br />

SPICE commands are usually position-independent but pre-processor commands beginning<br />

with the # character are position-dependent according to C language.<br />

Examples<br />

V1 1 0 1<br />

#define U 0<br />

#if (defined(U) || defined(A))<br />

R1 1 0 1<br />

#else<br />

R1 1 0 2<br />

#endif<br />

.end<br />

Because U is defined in the above example, defined(U) will return 1. The #if statement is true<br />

and R1 will be set to 1. When the #if statement is substituted with: #if (defined(U) &&<br />

defined(A)), the #if statement will no longer be true because A is not defined. R1 would<br />

therefore be set to 2.<br />

An example of position dependency:<br />

If Eldo is invoked with “a” defined (<strong>eldo</strong> netlist.cir -define a), in the following:<br />

Eldo® User's Manual, 15.3 123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!