[Moved]: Eldo "for-loop"
Has anyone ever tried to make a loop in "eldo"? Is there any command for a loop, like "FOR" in C/MATLAB/ect?
I want to count down from 7FF (Hex) to 000. I wonder if I have to type every single number or there is a simple way!
Many thanks.
can you use the .step param statement, for instance if your hex value is used to define the value of a bus signal?
there an example in eldo's documentation in the .step section:
.param pat="HX000" .sigbus vplus[9:0] + VHI=vdd + VLO=0 + BASE=DEC + PATTERN S(pat) .step param pat list "HX001" "HX010"
Can you please elaborate more on this? My problem is that I couldn't define the pulse time, etc with .step command! Seems that what you have mentioned only replace two values it does not sweep between two values, right?
Do you think this command works? Sweep from HX000 to HX0010 with a step of HX0001
.step param pat HX000 HX0001 HX0010
Many thanks.
do you want it to change during a transient simulation?
Yes I want to do a transient simulation. You got any idea?
I have tried .STEP and STEP LOOP but havent been able to simulate my circuit yet!
Here an example which didnt work for me!
.param KK=0 SET i=0 SET PAT=0 STEP (TYPE=STEP, PARAM=i, START=0, STOP=1023, STEP=1) .sigbus address VHI=1.2 VLO=0 TFALL=100p TRISE=0.1n THOLD=20n TDELAY=0n BASE=DEC PATTERN KK KK=KK+i ENDSTEP
using a sigbus and a pattern is a good way to define your signal, but I'm sorry I'm not aware of any way to define the pattern itself with a for loop
the .step command involes multiple runs of the simulation (one with each value) but this is not what you want
if you're trying to avoid the inconvenience of writing all the values to be used (can be troublesome), can you use a script to generate a csv file containing the values you want to use? (this script can then have the for loop). The sigbus and pattern commands in Eldo can load a csf file for the pattern definition
I hope this helps
I think you could use the PULSE function. Here's an example for 12 bit. For counting down from 0x7FF to 000 you'd have to reduce it to 11 Bits and may be change the bit order. No - not the bit order. I think it's enough to exchange vlo against vhi - and vice versa.
Code PHP - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 * 12bit input code for DAC Vbit11 bit11 gnd PULSE (vlo vhi td tr tf 'per/2^1' 'per/2^0') Vbit10 bit10 gnd PULSE (vlo vhi td tr tf 'per/2^2' 'per/2^1') Vbit9 bit9 gnd PULSE (vlo vhi td tr tf 'per/2^3' 'per/2^2') Vbit8 bit8 gnd PULSE (vlo vhi td tr tf 'per/2^4' 'per/2^3') Vbit7 bit7 gnd PULSE (vlo vhi td tr tf 'per/2^5' 'per/2^4') Vbit6 bit6 gnd PULSE (vlo vhi td tr tf 'per/2^6' 'per/2^5') Vbit5 bit5 gnd PULSE (vlo vhi td tr tf 'per/2^7' 'per/2^6') Vbit4 bit4 gnd PULSE (vlo vhi td tr tf 'per/2^8' 'per/2^7') Vbit3 bit3 gnd PULSE (vlo vhi td tr tf 'per/2^9' 'per/2^8') Vbit2 bit2 gnd PULSE (vlo vhi td tr tf 'per/2^10' 'per/2^9') Vbit1 bit1 gnd PULSE (vlo vhi td tr tf 'per/2^11' 'per/2^10') Vbit0 bit0 gnd PULSE (vlo vhi td tr tf 'per/2^12' 'per/2^11')
This is SPICE code, but I think it should work with ELDO similarly.
S. Eldo User?s Manual, v6.6_1, 2005.3 p. 5-25