• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. Verilog-A: is it possible to nest analog events? e.g. timer...

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 125
  • Views 9250
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Verilog-A: is it possible to nest analog events? e.g. timer() inside cross()?

dontpanic
dontpanic over 2 years ago

Hi! I'm trying to recreate the behavior of an synchronous controller in Verilog-A. The real circuit is made of delays and logic, and basically creates a sequence of pulses after been triggered by the edge of an asynchronous clock.

So far:

  1. I tried to implement this behavior using nested timers inside a crossing event for detecting the clock edges, but (despite compiling & simulating with no errors/warnings) this didn't work--se code & resulting waveforms (1) below.
  2. I found a workaround that uses absdelay() to create delayed copies of the clock, and generates the desired outputs on the crossings of these delayed clocks--see code/waveforms (2) below. This solution seems inefficient when generating a large number of outputs, due to the added overhead... is this *the only* possible way to implement the desired behavior?

Can anybody please help me to understanding why (1) doesn't work and/or how to fix it?

Thanks and regards,
Jorge.


(1) This code doesn't work:



`include "discipline.h"
module examplePulseGenerator (CLK,OUT1,OUT2);
input  CLK;    voltage CLK;
output OUT1;   voltage OUT1;
output OUT2;   voltage OUT2;

parameter real    VSS       = 0;
parameter real    VDD       = 1;
parameter real    Tguard    = 20p;
parameter real    Tdelay1   = 50p;
parameter real    Twidth1   = 200p;
parameter real    Tdelay2   = 0;
parameter real    Twidth2   = 400p;

real Tstart1   = Tdelay1;
real Tstop1    = Tstart1+Twidth1;
real Tstart2   = Tstop1+Tguard+Tdelay2;
real Tstop2    = Tstart2+Twidth2;

real OUT1_unfiltered;
real OUT2_unfiltered;

analog begin

    @(initial_step) begin
        OUT1_unfiltered = VSS;
        OUT2_unfiltered = VSS;
    end

    @(cross(V(CLK)-0.5*(VDD+VSS),1)) begin
        @(timer($abstime+Tstart1)) OUT1_unfiltered = VDD;
        @(timer($abstime+Tstop1))  OUT1_unfiltered = VSS;
        @(timer($abstime+Tstart2)) OUT2_unfiltered = VDD;
        @(timer($abstime+Tstop2))  OUT2_unfiltered = VSS;
    end

    V(OUT1) <+ transition(OUT1_unfiltered,0,10p,10p);
    V(OUT2) <+ transition(OUT2_unfiltered,0,10p,10p);

end
endmodule




(2) This code works:



`include "discipline.h"
module examplePulseGenerator (CLK,OUT1,OUT2);
input  CLK;    voltage CLK;
output OUT1;   voltage OUT1;
output OUT2;   voltage OUT2;

parameter real    VSS       = 0;
parameter real    VDD       = 1;
parameter real    Tguard    = 20p;
parameter real    Tdelay1   = 50p;
parameter real    Twidth1   = 200p;
parameter real    Tdelay2   = 0;
parameter real    Twidth2   = 400p;

real Tstart1   = Tdelay1;
real Tstop1    = Tstart1+Twidth1;
real Tstart2   = Tstop1+Tguard+Tdelay2;
real Tstop2    = Tstart2+Twidth2;

real OUT1_unfiltered;
real OUT2_unfiltered;

real CLKdelayed_Tstart1;
real CLKdelayed_Tstop1;
real CLKdelayed_Tstart2;
real CLKdelayed_Tstop2;

analog begin

    @(initial_step) begin
        OUT1_unfiltered = VSS;
        OUT2_unfiltered = VSS;
    end

    CLKdelayed_Tstart1 = absdelay(V(CLK),Tstart1);
    CLKdelayed_Tstop1  = absdelay(V(CLK),Tstop1);
    CLKdelayed_Tstart2 = absdelay(V(CLK),Tstart2);
    CLKdelayed_Tstop2  = absdelay(V(CLK),Tstop2);

    @(cross(CLKdelayed_Tstart1 -0.5*(VDD+VSS),1)) OUT1_unfiltered = VDD;
    @(cross(CLKdelayed_Tstop1  -0.5*(VDD+VSS),1)) OUT1_unfiltered = VSS;
    @(cross(CLKdelayed_Tstart2 -0.5*(VDD+VSS),1)) OUT2_unfiltered = VDD;
    @(cross(CLKdelayed_Tstop2  -0.5*(VDD+VSS),1)) OUT2_unfiltered = VSS;

    V(OUT1) <+ transition(OUT1_unfiltered,0,10p,10p);
    V(OUT2) <+ transition(OUT2_unfiltered,0,10p,10p);

end
endmodule

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    The Verilog-A Reference manual clearly states:

    Do not use the timer function inside conditional statements.

    Essentially, the timer events needs to be evaluated at each time step, otherwise they have no effect. So you can't implement it this way.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information