Previous Section Next Section

10.6 Latency Coverage

Latency coverage requires comparison of the time an activity ends with the time that activity started. There are no built-in constructs provided by e for latency coverage. However, it is easily possible to perform latency coverage using e.

To perform latency coverage, do the following steps:

Example 10-7 shows how to record latency coverage.

Example 10-7 Latency Coverage
Example of latency coverage
<'
struct packet {
    !gen_time: time; //Snapshot of time value
    !latency: time; //Value of time difference
    event clk is rise ('~/top/clk') @sim; //Define posedge of clock
    event pkt_started is rise('~/top/packet_vld')@clk; //Packet start
    event pkt_ended is fall('~/top/packet_end')@clk; //End of packet

    //Take a snapshot of system time on start of packet
    //sys.time gets the value of current simulation time
    on pkt_started { gen_time = sys.time };

    //Compute the value of latency at end of packet
    on pkt_ended { latency = sys.time - gen_time};

    cover pkt_ended is { //Set up coverage when the packet finishes
        item latency using ranges = { //Range values for latency
           range([1..20], "short"); //Short latency
           range([21..40], "medium"); //Medium latency
           range([41..63], "long"); //Long latency
        };
    };
}; //end of struct packet
'>
Previous Section Next Section