3 Replies Latest reply on May 18, 2017 5:22 AM by alain_wittmann

# How to use "if" statement in Eldo?

Hello guys,

I want to use sort of special function in a subcircuit. Let assume we have a subcircuit as specified below

.subckt res X Y param: ro=10K

R1 X Y ro

# endif

.ends

It gives two errors as,

+   Syntax error in expression IF  ( ( V ( X )-V(Y ) ) > 1) .PARAM RO = 5K

+   Error: signe < or > expected at IF ( ( V ( X )-V(Y ) ) > 1)

I was expecting to see these errors bu I wonder how I can do that if I don't want to use a Verilog-A model?

I appreciate your help

• ###### 1. Re: How to use "if" statement in Eldo?

This is not the purpose of If / Then / Else syntax in Eldo. The condition of the IF statement needs to be resolved at elaboration, not at DC or during any other analysis. So you cannot test the voltage of the pins of the circuit.

The following is accepted by Eldo:

* Testing if

.param foo=1

.subckt res X Y param: ro=10K

R1 X Y ro

if (foo>=1)

.param ro= 5K

endif

.ends

v1 0 1 dc 1

X1 1 0 res

.dc

.extract dc i(v1)

• ###### 2. Re: How to use "if" statement in Eldo?

Thank you very much for your response, alain_wittmann

So you mean that there is no way to read the signal and use it for if-condition?

Is there anyway that perhaps I can assign the signal to "param"  or sth and then I use the param?

I'd rather not use Verliog-A as it seems to be too slow in Eldo!

Thank you.

• ###### 3. Re: How to use "if" statement in Eldo?

R1 X Y VALUE=valif(V(X)-V(Y)) > 1, 5k, 10k)

Have you tried that?