ISSUE 411

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 411
Category enhancement
Synopsis extend operators to vectors and arrays
State open
Class enhancement
Arrival-DateJul 31 2003
Originator Shalom Bresticker <Shalom.Bresticker@motorola.com>
Release 2001b
Environment
Description
This is a big subject and there are many possibilities.

Each operator has to be considered separately.

For example, a typical need is to do a bit-wise multiplexing operation.

If I write

a ? b[15:0] : c[15:0]

it will just output b[15:0] or c[15:0].

Often what I want is:

{
a[15] ? b[15] : c[15],
a[14] ? b[14] : c[14],
a[13] ? b[13] : c[13],
...
a[02] ? b[02] : c[02],
a[01] ? b[01] : c[01],
a[00] ? b[00] : c[00] }

Yes, I can write

(a[15:0] & b[15:0]) | (~a[15:0] & c[15:0])

but that's ugly.

I would like to be able to apply unary operators to arrays also.

And there are a lot of useful things to do with binary operators as well.

--
Shalom Bresticker Shalom.Bresticker@motorola.com
Design & Reuse Methodology Tel: +972 9 9522268
Motorola Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 441478



Fix
Audit-Trail

From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, Shalom.Bresticker@motorola.com
Cc:
Subject: Re: enhancement/411: extend operators to vectors and arrays
Date: Mon, 29 Sep 2003 17:35:12 -0400 (EDT)

>For example, a typical need is to do a bit-wise multiplexing operation.
>
>If I write
>
>a ? b[15:0] : c[15:0]
>
>it will just output b[15:0] or c[15:0].
>
>Often what I want is:
>
>{
>a[15] ? b[15] : c[15],
>a[14] ? b[14] : c[14],
>a[13] ? b[13] : c[13],
>...
>a[02] ? b[02] : c[02],
>a[01] ? b[01] : c[01],
>a[00] ? b[00] : c[00] }


I have seen this come up in user designs also.

>Yes, I can write
>
>(a[15:0] & b[15:0]) | (~a[15:0] & c[15:0])
>
>but that's ugly.


It also doesn't give quite the same results. If a[0] is X, and both
b[0] and c[0] are 1, the conditional operator will correctly produce
a 1 for the result. The boolean version will produce a more pessimistic
result of X. Both versions will produce a 0 if both b[0] and c[0] are 0.
If you change the boolean version to a product-of-sums instead of a
sum-of-products representation, then it will get a 1 for both inputs 1,
but will get X for both input 0. A bitwise conditional operator could
get the less pessimistic answer in both cases.

I am only aware of 2 other operators that are missing bitwise versions:
case equality and case inequality. These can only produce a single bit
result, not a vector of bits containing the results of comparing
corresponding bits of the inputs. Note that logical equality and
inequality do have bitwise versions: ~^ and ^ (XNOR and XOR).

If vector operators were added for any of these, I don't know what would
be a reasonable syntax.


Steven Sharp
sharp@cadence.com

Unformatted



Hosted by Boyd Technology