Home stop cadence simulation via VerilogA code
Post
Cancel

stop cadence simulation via VerilogA code

This VerilogA block/code for Stop the current simulation in Cadence Virtuoso depending on analog conditions.

This block is perfect when you need to perform multiple long simulations, for example, corners or Monte Carlo. You will save a lot of simulation time

The following VerilogA code will stop the simulation after some time when the condition is fulfilled.

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
///////////////////////////////////////////////////////////////////////////
// Engineer: Alberto Lopez
//
// Description: stop the simulation when the input voltage arrives to a minimum value
//
// Change history: feb/2021
//
/////////////////////////////////////////////////////////////////////////////

`include "constants.vams"
`include "disciplines.vams"

module FINISH_run_delay( vin, GND );

inout GND;
input vin;

electrical GND;
electrical  vin;


//Parameters
parameter real tiempo = 1u;            //refreshing time for the Verilog code

parameter real MIN_VOLTAGE = 2;    //Min voltage level to trigger the FINISH
parameter real DELAY_TIME = 1000; // number of "tiempo" steps to execute the stop action
integer flag;
integer cnt;

analog begin

    @(initial_step) begin
        flag = 0;
        cnt = 0;
    end

    @(timer(0,tiempo)) begin
        if( V(vin,GND) > MIN_VOLTAGE ) begin
            flag = 1;    //only for testing purposes

        end
        if (flag == 1) begin
            cnt = cnt +1;
            if (cnt == DELAY_TIME) begin
                //$finish(0);                         //command to stop the whole simulation
                $finish_current_analysis(0);        //command to stop the current simulation
            end
        end

    end    

end //analog
endmodule

Reference: https://miscircuitos.com/veriloga-code-to-stop-simulation-cadence/

This post is licensed under CC BY 4.0 by the author.

SPI or DEC2BIN implementation for quick simulation

CMOS technology scaling