Ed,
I agree with you. What we have now in 3033 is this:
if (reset || window && end_flag == 1'b1)****
next_window = 1'b0;****
else if (!window && start_flag == 1'b1)
It should be:
always_comb begin
if (reset || window && (end_event != ‘b0))
next_window = 1'b0;
else if (!window && (start_event != ‘b0))
The issue is that if end_flag is a vector of value 5, end_flag == 1'b1 will
fail, whereas
(end_event != ‘b0) will succeed.
I ran this model in a simulator to test this point:
bit[3:0] a =5; bit b;
bit[3:0] c =4; bit d;
bit r;
initial begin
#20
$display("a=%d", a);
if (a != 'b0)
$display("a != 'b0");
else
$display("a == 'b0");
if (a == 1'b1)
$display("a == 1'b1");
else
$display("a == 1'b1 failed");
end
*Simulation result: *
# a= 5
# a != 'b0
# a == 1'b1 failed
Ben Cohen
On Mon, Jan 16, 2012 at 5:27 AM, Eduard Cerny <Eduard.Cerny@synopsys.com>wrote:
> Hi Ben,****
>
> ** **
>
> you do not need a dynamic cast. I think that it could be written as****
>
> ** **
>
> always_comb begin****
>
> if (reset || window && (end_event != ‘b0))****
>
> next_window = 1'b0;****
>
> else if (!window && (start_event != ‘b0))****
>
> // …****
>
> I could not find in the LRM how && is handled if the operands are
> bitvectors, if it is the same as in if condition then what Dmitry wrote is
> sufficient. If it is the LSB, the we need the comparison.****
>
> ** **
>
> Best regards****
>
> ed****
>
> ** **
>
> ** **
>
> *From:* owner-sv-ac@eda.org [mailto:owner-sv-ac@eda.org] *On Behalf Of *ben
> cohen
> *Sent:* Sunday, January 15, 2012 10:51 PM
> *To:* Korchemny, Dmitry
> *Cc:* sv-ac@eda-stds.org
> *Subject:* Re: [sv-ac] Problems with Mantis 3033. 17.9 Complex checker
> example****
>
> ** **
>
> 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* <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 Mon Jan 16 08:58:57 2012
This archive was generated by hypermail 2.1.8 : Mon Jan 16 2012 - 08:59:04 PST