Subject: RE: [sv-ac] Example showing reporting of variables in action block.
From: Jay Lawrence (lawrence@cadence.com)
Date: Tue Aug 26 2003 - 10:14:28 PDT
Adam,
The separate scope that contains a variable of the same name with the
sampled value exists already in SystemVerilog. It is called the clocking
domain.
If assertions and the pass/fail statements are placed in a clocking
domain then the sampling is controlled explicitly by the clocking domain
sensitivity, and both the assertion and the pass/fail see the sampled
values.
jay
===================================
Jay Lawrence
Senior Architect
Functional Verification
Cadence Design Systems, Inc.
(978) 262-6294
lawrence@cadence.com
===================================
> -----Original Message-----
> From: Adam Krolnik [mailto:krolnik@lsil.com]
> Sent: Tuesday, August 26, 2003 11:10 AM
> To: sv-ac@eda.org
> Subject: [sv-ac] Example showing reporting of variables in
> action block.
>
>
>
> Good morning all;
>
> Here is a simple example of a property that includes a
> message trying to report
> a problem.
>
> assert property @(posedge clk) // Simple example
> (a => b ##1 c)
> else
> $error("C (%0d) did not follow b after a.\n", c); // 'c'
> may show the wrong value.
>
> The property is evaluated with sampled values of the
> variables (a, b, c), but the
> action block is executed in the reactive region with access
> to the current values
> of the variables. Thus if 'c' changes the next cycle, then
> the action block can
> correctly execute upon detecting a failure, but report the
> wrong information -
> the new value of 'c' instead of the sampled value.
>
> The problems with this are the following:
>
> 1. The above code looks fine to a casual review.
> 2. It is common to want to include variables from the property
> in the action block report. Thus this will be a common
> coding problem.
>
> I had two thoughts for this.
>
> 1. One problem is that the property and the action block are
> separate scopes.
>
> If an assertion directive was more like:
>
> assert
> begin
> property @(posedge clk)
> (a => b ##1 c)
> else
> $error("b %d and c %d were bad.", b, c);
> end
>
> The property and the action block are one scope. You could
> even think of it something
> like this:
>
> assert
> begin
> property @(posedge clk)
> if (a => b ##1 c)
> else
> $error("b %d and c %d were bad.", b, c);
> end
>
> Now, everyone could agree that the (a,b,c) in the property
> and the (b,c) in the
> error call should be the same value.
>
> The only problem with this is the possible need to get to the
> new (live) values
> of the variables. So there would need to be some marker to
> indicate this.
> E.g.
>
> assert
> property @(posedge clk)
> (a => b ##1 c)
> begin
> <want live variables.>
> $display("The last saved C was %0d.\n", save_c);
> save_c = c;
> end
> end
>
> Obviously, one way is this:
>
> assert
> property @(posedge clk)
> (a => b ##1 c)
> begin
> #1; // Move to slightly next step.
> $display("The last saved C was %0d.\n", save_c);
> save_c = c;
> end
> end
>
> But that may take one too far - maybe not. Any other ideas?
>
>
> Adam Krolnik
> Verification Mgr.
> LSI Logic Corp.
> Plano TX. 75074
>
>
>
This archive was generated by hypermail 2b28 : Tue Aug 26 2003 - 10:16:37 PDT