From: Michael McNamara (mac@verisity.com)
Date: Wed Jul 30 2003 - 18:10:02 PDT
Precedence: bulk
The following reply was made to PR enhancement/409; it has been noted by GNATS.
From: Michael McNamara <mac@verisity.com>
To: Steven Sharp <sharp@cadence.com>
Cc: etf-bugs@boyd.com
Subject: Re: enhancement/409: lists in part-selects
Date: Wed, 30 Jul 2003 17:13:50 -0700
Steven Sharp writes:
> Precedence: bulk
>
> The following reply was made to PR enhancement/409; it has been noted by GNATS.
>
> From: Steven Sharp <sharp@cadence.com>
> To: sharp@cadence.com, Shalom.Bresticker@motorola.com
> Cc: etf-bugs@boyd.com
> Subject: Re: enhancement/409: lists in part-selects
> Date: Wed, 30 Jul 2003 20:35:27 -0400 (EDT)
>
> >You'd be surprised.
> >
> >If often comes up in contexts like
> >
> >"if ((a[3:5] == 3'b101) & !a[7] & (a[9:11] == 3'b110) & a[13])".
>
>
> I assume you are suggesting recoding this as
>
> if (a[3:5,7,9:11,13] == 8'b10101101)
>
> or
>
> if (a[3:5,7,9:11,13] == 8'hab)
>
>
> This can already be done with bit masks. Assuming a[0:15],
>
> if (a & 16'b0001110101110100 == 16'b0001010001100100)
>
> or
>
> if (a & 16'h1d74 == 16'h1464)
>
> This is similar in compactness (regardless of the length of the signal
> name). It should execute faster, since it uses bitwise operations
> that can be done in parallel, rather than extracting and reassembling
> bit fields sequentially. Most C programmers should already be familiar
> with the technique of using bit masks to extract only a desired subset of
> bits for testing. A bit mask can be a parameter or can be derived from
> multiple partial masks by operators, while a list of ranges and bits
> cannot. This makes it easier to parameterize the code if desired.
> And bit masks can be done without any language additions.
>
> Some designers may not know how to do this with the existing language
> features, but it is no harder than learning how to do it a new way,
> and it actually works better.
>
>
>
>
> Steven Sharp
> sharp@cadence.com
>
I agree with Steve, but suggest he meant to type
if ( (a & 16'b0001110101110100) == 16'b0001010001100100) begin
as in Verilog (and C) the == operator binds tighter than the &
operator, so what Steve typed would be interpreted as if it were
if ( a & (16'b0001110101110100 == 16'b0001010001100100))
This archive was generated by hypermail 2.1.4
: Wed Jul 30 2003 - 18:10:48 PDT
and
sponsored by Boyd Technology, Inc.