10.06.2016 Views

eldo_user

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Eldo Control Language<br />

Simulation Dynamic Control<br />

.define_task t_osc<br />

set w = 0<br />

set res = simulation(<br />

/* netlist to simulate. */<br />

+ tb_osc(),<br />

/* The callback defined below will be called when the<br />

* frequency is stabilized at 7 MHz.<br />

* 'period_osc' is a vector so need to specify '[LAST]'<br />

* to get the last calculated period.<br />

* Need to add a condition on time because the frequency<br />

* is erratic at the beginning before falling progressively<br />

* to 7 MHz.<br />

*/<br />

+ callback=f_callback_osc(),<br />

+ condition="(meas(period_osc[LAST]) > (1/7Meg)) && (time>1u)",<br />

/* To save the wave in the wdb file. */<br />

+ w=@w_osc)<br />

if (res.simu_status == 0)<br />

fprint(stdout, "Simulation succeeded.\n")<br />

else<br />

fprint(stdout, "Simulation failed.\n")<br />

endif<br />

.end_define_task<br />

.define_function f_callback_osc()<br />

/* It is the callback function that will be called<br />

* when the condition is met.<br />

*/<br />

set i = 0<br />

/* Get the time where the simulation was stopped. */<br />

set curtime = _simu_get("time")<br />

/* Get some extract values using '_simu_get_extract'. */<br />

set max_v = _simu_get_extract("max_v_osc")<br />

/* v_period i a vector. */<br />

set v_period = _simu_get_extract("period_osc")<br />

/* Get the last frequency. */<br />

set freq = 1 / v_period[v_period.imax]<br />

fprint(stdout, "Evolution of the frequency of the waveform from 0 s to<br />

%.2e s:\n", curtime) for (i = v_period.imin; i

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

Saved successfully!

Ooh no, something went wrong!