Section 6.9.1, 6.9.2
Type compatibility
MODIFY Clause 6.9.1 as follows:
1) A simple bit vector type that does not have a predefined width
and one that does have a predefined width
match if both are 2-state or both are
4-state, both are signed or both are unsigned, both have the same width,
and the range of the simple bit
vector type without a predefined width is [width-1:0].right range bound of the
simple bit vector type without a predefined width is zero.
typedef bit signed [7:0] BYTE; // matches the byte type
typedef bit signed [0:7] ETYB; // does not match the byte type
7) Explicitly adding signed or unsigned modifiers to a
type that does not
change its default signing, does not create a non-matching
type.
Explicitly adding signed or
unsigned modifiers to a type that does not
change its default signing, creates a type which matches
the type
without the explicit signing specification.
MODIFY Clause 6.9.2 as follows:
Two data types shall be defined as equivalent data types
using the following inductive definition. If the two data
types are not defined equivalent using the following definition,
then they shall be defined to be non-equivalent.
1)
If two types match, they are equivalent. Any
built-in type is equivalent to every other occurrence of itself, in every
scope.
2) A simple typedef or type parameter override that renames a built-in
or user-defined type is equivalent to that
built-in or user-defined type within the scope of the type identifier.
typedef bit node; // 'bit'
and 'node' are equivalent types
typedef type1 type2; //
'type1' and 'type2' are equivalent types
2) 3) An anonymous enum, unpacked struct, or unpacked union type is equivalent to itself
among data objects
declared within the same declaration statement and no other data
types.
struct {int A; int B;} AB1, AB2; // AB1,
AB2 have equivalent types
struct {int A; int B;} AB3; // AB3 is not
type equivalent to AB1
4) A typedef for an enum, unpacked struct, or unpacked union, or a class is equivalent to
itself and to data
objects that are declared using that data type within the scope of the data
type identifier.
typedef struct
{int A; int B;} AB_t;
AB_t AB1; AB_t AB2; // AB1 and
AB2 have equivalent types
typedef struct
{int A; int B;} otherAB_t;
otherAB_t AB3; // AB3 is not type equivalent to AB1 or AB2
3) 5) Packed arrays,
packed structures, and built-in integral types are
equivalent if they contain the same number
of total bits, are either all 2-state or all 4-state, and are
either all signed or all unsigned. Note that if any bit of
a packed structure or union is 4-state, the entire structure
or union is considered 4-state.
typedef bit signed
[7:0] BYTE; // equivalent to the byte type
typedef struct packed signed {bit[3:0] a, b;} uint8;
// equivalent to the byte
type
4) 6) Unpacked
array types are equivalent by having equivalent element types and identical
shape. Shape is
defined as the number of dimensions and the number of elements in each
dimension, not the actual range of
the dimension.
bit [9:0] A [0:5];
bit [
typedef bit [10:1]
uint10;
uint10 C [6:1]; // A, B and C have equivalent types
typedef int anint [0:0]; // anint is not type equivalent to int
7) Explicitly
adding signed or unsigned modifiers to a type that does not change its default
signing, does not
create a non-equivalent type. Otherwise, the signing must match to have
equivalence
typedef bit unsigned ubit; // type equivalent to bit
8) A typedef for an enum, unpacked struct, or unpacked union, or a class type declared in a
package is always
equivalent to itself, regardless of the scope where the type is imported.
MODIFY Clause 5.2 as follows:
SystemVerilog accepts a single positive
number, as an alternative to a range, to specify the size of an unpacked array,
like
C. That is, [size] becomes the same as [0:size-1]. For example:
int
Array[8][32];
is the same as: int Array[0:7][0:31];