Subject: CP-003
From: Peter Ashenden (peter@ashenden.com.au)
Date: Tue Feb 18 2003 - 22:46:16 PST
Folks,
<Chair hat off>
To my mind, if we're going to have vector/scalar logical operators, the
bit operand should be extended by replication. The standard logic
vector types are a form of bit-vector type, with concrete detail of
electrical driving characteristics added, so we're really arguing about
the semantics of vector/scalar operators on conceptual bit-vector
values.
Bit vectors are just indexed collections of bits. They don't
necessarily represent numbers. So to argue that 1 should extended to
00001, say, is to imply a numeric interpretation. Otherwise, 10000
would be just as reasonable, as would extending 0 to 11110 or 01111. It
makes more sense to my mind to think of the semantics as distributing
the bit operand across each element of the vector operand. Thus, I
would rule out option 3.
The choice between options 1 and 3 is one of expressiveness. I agree
that you can (or should be able to) write
Y <= (A and (A'range => ASel)) or (B and (B'range => BSel));
but this looks cumbersome. Certainly, if you require the explicit type
qualification, it looks even more cumbersome.
(I don't buy the idea, though, of typing std_logic_vector being a pain -
see M-/ in emacs! And introducing an alias such as slv would obfuscate
things even more. Remember, code is read more often than is is
written.)
Bhasker's idea of a FANOUT function makes the above expression clearer,
since the function name documents the intent. But the whole idea of
allowing operators to be overloaded is to make models more readable. To
my mind, the expression
Y <= (A and ASel) or (B and BSel);
is much more intelligible than the previous expression. Thus, I think
option 2 wins over the status quo. I would support adding corresponding
overloads for bit/bit_vector in std.standard.
Cheers,
PA
</Chair hat off>
-- Dr. Peter J. Ashenden peter@ashenden.com.au Ashenden Designs Pty. Ltd. www.ashenden.com.au PO Box 640 Ph: +61 8 8339 7532 Stirling, SA 5152 Fax: +61 8 8339 2616 Australia Mobile: +61 414 70 9106
This archive was generated by hypermail 2b28 : Tue Feb 18 2003 - 22:47:13 PST