RE: [sv-bc] part selects on arbitrary expressions

From: Bresticker, Shalom <shalom.bresticker_at_.....>
Date: Sun Mar 11 2007 - 07:43:03 PDT
This is actually not clear to me.

> No it hasn't been specified.  You'll likely be unhappy about
> what "type(...) == type(...)" means in any case.
> 
> 6.10 says:
>    Two type references shall be considered equal in such comparisons
>    if, and only if, the types to which they refer match (see 6.9.1).
> 
> 6.9.1 boils down to saying that a packed vector can match
> a predefined but it is NEVER the case that two "anonymous"
> packed vectors will match.  So, for a packed item "bit [1:0] a",
> even the trivial condition
>     type(a[1:0]) == type(a[1:0])
> will be false.
> 
> Such types are equivalent but not matching.

[SB] 6.9 says,
"SystemVerilog does not require a category for identical types to be
defined here because there is no construct in the SystemVerilog language
that requires it. For example, as defined below, int can be interchanged
with bit signed [31:0] wherever it is syntactically legal to do so."

Well, if 'int' can be interchanged with 'bit signed [31:0]', and two
int's match, then so should two 'bit signed [31:0]'s.

It also says,
"To have type matching or equivalence among multiple instances of the
same module, interface, or program, a class, enum, unpacked structure,
or unpacked union type must be declared at a higher level in the
compilation-unit scope than the declaration of the module, interface, or
program, or imported from a package. For type matching, this is true
even for packed structure and packed union types."

The last sentence, by specifying structures and unions, implies that the
statement is not true for packed arrays.

Even using the same paragraph from 6.9.1, the example,
"typedef bit signed [7:0] BYTE; // matches the byte type", 
I would certainly expect two 'bit signed [7:0]'s to be as least as close
as one of them and a 'byte'. If each of them matches a byte, which is
less identical, then I would certainly expect them to match each other,
which are more identical to each other.

By the way, is matching transitive?

Shalom

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Mar 11 07:43:27 2007

This archive was generated by hypermail 2.1.8 : Sun Mar 11 2007 - 07:43:57 PDT