[sv-ac] SVAC 0.79 template example


Subject: [sv-ac] SVAC 0.79 template example
From: Adam Krolnik (krolnik@lsil.com)
Date: Wed Jan 29 2003 - 14:14:15 PST


Hello all;

Using the draft 0.79, I've tried to write an example template.

I am trying to write a template to show that:

   For every request (pulse) there exists a corresponding ack (pulse).
     [expect_req_then_ack]
   For every ack (pulse) there exists a, previously sent, corresponding req (pulse).
     [match_req]
   Up to 4 request (pulses) (the pipedepth) may be sent before an ack (pulse)
     is returned. [pipedepth_exceeded]

So I am trying to write this template.

template pipeline_reqack(
   clk, // The clock signal (posedge version)
   req, // The request (single pulse) signal.
   ack, // The acknowledge of completion, corresponding to a req.
   latency, // The maximum time for an ack to be returned for req.
   pipedepth) // The maximum number of requests waiting for acknowedges.

   // Declare two counter to number requests and acknowledges.
   int req_cnt; // what is the initial value?
   int ack_cnt; // same Q.

   // Update the counters - but how? I can only write a nonblocking assignment.
   // When does these assignments execute?
   req_cnt <= req ? req_cnt + 1'b1 : req_cnt;
   ack_cnt <= ack ? ack_cnt + 1'b1 : ack_cnt;

   // Assertions
   expect_req_then_ack: assert @(posedge clk)
     (req => first_match ( (int cnt = req_cnt) // Note req_cnt to match with ack_cnt.
                            ([1: latency] ack && ack_cnt == cnt))) // matches with req.

     else $error("Ack not received within %0d cycles.", latency);

   match_req: assert @(posedge clk)
     (ack => first_match ((int cnt = ack_cnt) // Note ack_cnt to match with past re

              //First, timeshift the req/req_cnt waveforms into the future, by latency.
              // Then look for the resulting future version of req matching the ack_cnt.
            ([1: latency -1] $past(req, latency) && $past(req_cnt, latency) == cnt))))
        else $error("Extra ack received w/ no corresponding req.");

   pipedepth_exceeded: assert @(posedge clk) (req_cnt - ack_cnt < pipedepth)
     else $error ("exceeded pipdepth (%0d) of protocol for requests.", pipedepth);

   endtemplate

Questions:

   1. What is the initial value of variables declared in the template?
      Is there some way to get back to an initial state (presumably if a reset
      term was asserted) ?
   2. How do the variables get updated? - I presume the nonblocking statements update
      them.
   3. With what clock do the nonblocking assignments get executed on?
   4. Are there other problems with this template example?

   Thanks.

     Adam Krolnik
     Verification Mgr.
     LSI Logic Corp.
     Plano TX. 75074



This archive was generated by hypermail 2b28 : Wed Jan 29 2003 - 14:14:59 PST