Re: [sv-ac] Problems with Mantis 3033. 17.9 Complex checker example

From: ben cohen <hdlcohen@gmail.com>
Date: Sun Jan 15 2012 - 19:50:47 PST

Before discussing this, there is a typo in the model (extra space after
next_
else
  next_ window = window;
should be
  else
  next_window = window;

*<In this case introducing start_flag, end_flag is redundant, and also
checking that end_flag == 1'b1 instead of end_flag does not bring anything
significant. > *
[Ben] The issue here is that start_event and end_even are untyped, thus the
actual maybe an integer or a vector, or a bit.
As a result, there is a difference between
"window && end_flag == 1'b1)" and
"if (reset || window && end_event)"
The result of "assign start_flag = start_event;" is the LSB of start_event,
whereas using the " && end_event" would be true if
end_event > 0.
Below is a simple test case
bit[3:0] a =5; bit b;
 bit[3:0] c =4; bit d;
bit r;
initial begin
   #5
   b=a;
   d=c;
   r = 1'b1 && c;
end
The results below show that d and r have different results.
         ns /assert_window1/a
          delta /assert_window1/b
                         /assert_window1/c
                           /assert_window1/d
                             /assert_window1/r
          0 +0 0101 0 0100 0 0
          5 +0 0101 1 0100 0 1

   I was also wondering if we need a $cast, but I don't totally think so.
Examples:
assign start_flag = $cast(start_event, start_flag);
always_comb if(!$cast(end_flag, end_event)) $error;
Ben

On Sun, Jan 15, 2012 at 2:15 AM, Korchemny, Dmitry <
dmitry.korchemny@intel.com> wrote:

> Hi all,****
>
> ** **
>
> I found the following problem in 17.9 Complex checker example, Mantis 3033.
> ****
>
> ** **
>
> It is written:****
>
> ** **
>
> When start_event and end_event are boolean, the checker may be implemented
> as shown in Example 1.****
>
> ** **
>
> Example 1.****
>
> …****
>
> bit start_flag, end_flag;****
>
> assign start_flag = start_event;****
>
> assign end_flag = end_event;****
>
> // Compute next value of window****
>
> always_comb begin****
>
> if (reset || window && end_flag == 1'b1)****
>
> next_window = 1'b0;****
>
> else if (!window && start_flag == 1'b1)****
>
> // …****
>
> ** **
>
> In this case introducing start_flag, end_flag is redundant, and also
> checking that end_flag == 1'b1 instead of end_flag does not bring anything
> significant. Therefore this code should be rewritten as:****
>
> ** **
>
> // Compute next value of window****
>
> always_comb begin****
>
> if (reset || window && end_event)****
>
> next_window = 1'b0;****
>
> else if (!window && start_event)****
>
> // …****
>
> ** **
>
> Another thing that I noticed is that the coverage message:****
>
> $display("win_open_covered”);****
>
> should be replaced with****
>
> $display("window_open covered”);****
>
> ** **
>
> Also, as minor tweak, I would replace test_expr[*1:$] with test_expr[+],
> and (!end_flag && window) [*0:$] with (!end_flag && window) [*].****
>
> ** **
>
> I filed a new Mantis 4012 (http://www.eda-stds.org/mantis/view.php?id=4012).
> We should be able to handle it as a balloting issue if it has been
> submitted as such.****
>
> ** **
>
> Thanks,****
>
> Dmitry****
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, 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 Sun Jan 15 19:51:51 2012

This archive was generated by hypermail 2.1.8 : Sun Jan 15 2012 - 19:52:01 PST