RE: [sv-bc] FW: Manti 1345, 1711: unique if/case

From: Steven Sharp <sharp_at_.....>
Date: Fri Nov 16 2007 - 16:08:04 PST
>From: "Alsop, Thomas R" <thomas.r.alsop@intel.com>

>This is why side-effects doesn't have a meaning for me in this clause.
>I understood what you meant by side effects I just didn't see a clear
>example nor could I extrapolate one.

initial
begin
  int s = 4;
  unique case (4)
    (s++)+1: $display("hello");
    s: $display("world");
  endcase
end

If you evaluate the second case item expression (s) first, then it
will be 4, and will match the case expression.  Then you evaluate
the first case item expression ((s++)+1) and it is 5, and will not
match the case expression.  You display "world".

If you evaluate the first case item expression ((s++)+1), then it
will be 5, and will not match the case expression.  As a side-effect,
it will increment s, so that s is 5.  Then you evaluate the second
case item expression (s), which is 5 and will not match the case
expression.  You do not display anything, but print a warning that
none of the cases matched.

The incrementing of s is a side-effect of the evaluation of ((s++)+1.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Nov 16 16:08:22 2007

This archive was generated by hypermail 2.1.8 : Fri Nov 16 2007 - 16:08:43 PST