RE: [sv-ac] sampled value function and dynamic auomatic references

From: John Havlicek <johnh@cadence.com>
Date: Fri Sep 20 2013 - 08:09:49 PDT
Hi Daniel:

I think one follows the definitions in 16.9.3, applying the generalized notion of "sampled value" from 16.5.1 to the newly supported kinds of arguments.

For the example

function automatic foo;
     int a;
     bit clk;
     $display($rose(a, (posedge clk);
endfunction

I would argue that "the most recent strictly prior time step in which the clocking event occurred" does not exist for "posedge clk" because clk is an automatic local variable in foo, so in this case I think that the current sampled value of "a" would be compared to the default sampled value of "a" (32'd0) to determine the return value of $rose.

I think the same basic approach applies with the class example.  In the context of the "initial" statement, I think there can be no strictly prior time step at which "posedge c.clk" occurred, so I think that $past(c.a, posedge c.c) will return the default sampled value of c.a, i.e.  32'd0.

Best regards,

John H.  


-----Original Message-----
From: owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] On Behalf Of Daniel Mlynek
Sent: Tuesday, September 17, 2013 4:40 AM
To: sv-ac@eda-stds.org
Subject: [sv-ac] sampled value function and dynamic auomatic references

LRM has removed restrcition that automatic vars cannot be used in 
sampled value function. (http://www.verilog.org/mantis/view.php?id=4252)
Proposed solution has sens for $past but what aoub other sampled value 
function how those should work with auomatic variables? ie
function automatic foo;
     int a;
     bit clk;
     $display($rose(a, (posedge clk);
endfunction

LRM also do not mention about dynamic var ie:
class C;
   int a;
   bit clk;
   function automatic foo;
     $display($past(a, (posedge clk);
   endfunction
endclass

C c;
     iniitial $display($past(c.a, (posedge c.clk);

How should code like above behave?

DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Sep 20 08:10:27 2013

This archive was generated by hypermail 2.1.8 : Fri Sep 20 2013 - 08:10:31 PDT