Composite Statements

Sequential

A begin/end statement makes multiple statements pass as a single statement to the compiler. Each of the statements are executed in order. Here is an example of a VCO:

analog begin
   freq = (V(in) – Vmin)*(Fmax – Fmin) / (Vmax – Vmin) + Fmin;
   if (freq > Fmax) freq = Fmax;
   if (freq < Fmin) freq = Fmin;
   phase = 2*`M_PI*idtmod(freq, 0, 1, -0.5);
   V(out) <+ ampl*cos(phase);
   $bound_step(0.1/freq);
end