leejh6783
Newbie level 1
Hi, I am trying to make a pulse generator with conditional delay.
But it is not working.
Can someone help me with this?
Thank you,
But it is not working.
Can someone help me with this?
Code - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 module verilog_pulse(out); output out; electrical out; parameter real fpul = 500M; parameter real fsin = 242M; parameter real vdd = 0.8; parameter real t_tran = 0; parameter real va = 1; real p,phase,vout,t_delay; analog begin @(initial_step) begin p=0; @(timer(0, 1/fpul*0.5)) begin if (p==0) begin vout=0; p=1; end else if (p==1) begin vout=vdd; p=0; phase = 2*`M_PI*idtmod(fsin, 0.0, 1.0, -0.5); t_delay = va*sin(phase); end end V(out) <+ transition(vout,t_delay,t_tran); end
Thank you,