module V_peak_detector(in,out); input in; output out; voltage in,out; real vmax; analog begin @(initial_step) vmax = -inf; if (V(in) > vmax) vmax = V(in); V(out) <+ vmax; @(final_step) $strobe("Peak Voltage : %g V\n",vmax); end endmodule