[SOLVED] Verilog-A pulse generator

Status
Not open for further replies.

gemass

Newbie level 3
Joined
Nov 10, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
Hi,

I'm new to verilog-A and I use the following code to detect the first falling edge of my input signal (Vin) and generate a pulse of 0V for 10ns at my output signal (Vout) as soon as the falling edge of Vin is detected, throught the @cross function, and also at time 0 with @initial_step(it creates a reset pulse):
Code:
module allo(in,out);
parameter real td = 10n;   // width of pulse
parameter real tt = 0n;	// output transition time (s)
parameter real t1 = 0n;

   output out;
   input in;
   voltage in, out;
   real Vout, tend,rst;

analog begin

	@ (initial_step or cross(V(in)-1, -1)) begin
		 Vout = 0;
		 tend = $abstime + td;//return simulation time + td
	  end

	  @(timer(tend))
		 Vout = 1.8;
		 V(out) <+ transition(Vout, td, tt);
	   end
endmodule

The problem is that, for a certain reason, a pulse of 20 ns is generated even thougth I specify a value of 10 ns (td=10 ns) and only the second falling edge of my input signal is detected (at 75.21 ns)while I want the one at 65.24ns to be detected. How can I change my code in order to detect the first falling edge of my input signal Vin ?

Thanks for your help !
 

Attachments

  • v_pulse_2.png
    14.1 KB · Views: 493

my bad, I have put two delays of 10ns..one in @cross and the one in the transition function...
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…