Section 3.7, 3.8, 8.13, 8.13.1, 8.13.2, 32.39, A.6.8, A.8.5, Index
Assignment patterns as lvalues

In 8.13, REPLACE

 

            An assignment pattern is built from braces, keys, and expressions and is prefixed with an apostrophe. For example:

 

var int A[N] = '{default:1};

var integer i = '{31:1, 23:1, 15:1, 8:1, default:0};

 

typedef struct {real r, th;} C;

var C x = '{th:PI/2.0, r:1.0};

 

                A positional notation without keys can also be used.  For example:

 

              var int B[4] = '{a, b, c, d};

              var C y = '{1.0, PI/2.0};

WITH

 

            An assignment pattern specifies a correspondence between a collection of expressions and the fields and elements in a data object or data value.  An assignment pattern has no self-determined data type, but can be used as one of the sides in an assignment-like context (see below) when the other side has a self-determined data type.  An assignment pattern is built from braces, keys, and expressions and is prefixed with an apostrophe. For example:

 

var int A[N] = '{default:1};

var integer i = '{31:1, 23:1, 15:1, 8:1, default:0};

 

typedef struct {real r, th;} C;

var C x = '{th:PI/2.0, r:1.0};

var real y, z;

 

                A positional notation without keys can also be used.  For example:

 

              var int B[4] = '{a, b, c, d};

              var C y = '{1.0, PI/2.0};

              '{a, b, c, d} = B;

            When an assignment pattern is used as the left-hand side of an assignment-like context, the positional notation shall be required and each member expression shall have a bit-stream data type that is assignment compatible with and has the same number of bits as the data type of the corresponding element on the right-hand side.

 

In 8.13, REPLACE

 

            Neither a static cast nor a default correspondence between an expression in an assignment pattern and a field or element in a data object shall be considered an assignment-like context.

           

            An assignment pattern can be used to construct a structure or array value by prefixing the pattern with the name of a data type to form an assignment pattern expression that yields the value that a variable of the data type would hold if it were initialized using the assignment pattern.

 

                typedef logic [1:0] [3:0] T;

shortint'({T'{1,2}, T'{3,4}}) // yields 16'sh1234

 

 

WITH

 

            Neither a static cast nor a default correspondence between an expression in an assignment pattern and a field or element in a data object shall be considered an assignment-like context. No other contexts shall be considered assignment-like contexts.  In particular, none of the following shall be considered assignment-like contexts:

 

-- A static cast

-- A default correspondence between an expression in an assignment pattern and a field or element in a data object

-- A port expression in a module, interface or program declaration

-- The passing of a value to a subroutine ref port

-- A port connection to an inout or ref port of a module, interface or program

 

 

An assignment pattern can be used to construct a structure or array value by prefixing the pattern with the name of a data type to form an assignment pattern expression that yields the value that a variable of the data type would hold if it were initialized using the assignment pattern.  An assignment pattern can be used to construct or deconstruct a structure or array by prefixing the pattern with the name of a data type to form an assignment pattern expression.  Unlike an assignment pattern, an assignment pattern expression has a self-determined data type and is not restricted to being one of the sides in an assignment-like context.   When an assignment pattern expression is used in a right-hand side expression, it shall yield the value that a variable of the data type would hold if it were initialized using the assignment pattern.

 

typedef logic [1:0] [3:0] T;

shortint'({T'{1,2}, T'{3,4}}) // yields 16'sh1234

 

When an assignment pattern expression is used in a left-hand side expression, the positional notation shall be required and each member expression shall have a bit-stream data type that is assignment compatible with and has the same number of bits as the corresponding element in the data type of the assignment pattern expression. If the right-hand side expression has a self-determined data type, then it shall be assignment compatible with and have the same number of bits as the data type of the assignment pattern expression.

 

typedef byte U[3];

var U A = '{1, 2, 3};

var byte a, b, c;

U'{a, b, c} = A;

U'{c, a, b} = '{a+1, b+1, c+1};

 

An assignment pattern expression shall not be used in a port expression in a module, interface or program declaration.  

 

 

In A.6.8, ADD

            assignment_pattern_net_lvalue ::=

                        '{ net_lvalue {, net_value } }

 

assignment_pattern_variable_lvalue ::=

                        '{ variable_lvalue {, variable_value } }

 

 

In A.8.5, in net_lvalue, ADD

            |           [ assignment_pattern_expression_type ] assignment_pattern_net_lvalue

 

In A.8.5, in variable_lvalue, ADD

            |           [ assignment_pattern_expression_type ] assignment_pattern_variable_lvalue

 

In 8.13, in the definition of assignment-like context, REPLACE

 

A port connection to an input port of a module, interface, or program

 

WITH

 

A port connection to an input or output port of a module, interface, or program

 

AND REPLACE

 

            The passing of a value to a subroutine input port

 

WITH

 

            The passing of a value to a subroutine input, output or inout port

 

AND REPLACE

 

            A non-default correspondence between an expression in an assignment pattern and a field or element in a data object

 

WITH

 

            A non-default correspondence between an expression in an assignment pattern and a field or element in a data object or data value

 

           

In 8.13, REPLACE

 

nor a default correspondence between an expression in an assignment pattern and a field or element in a data object

 

           

WITH

 

nor a default correspondence between an expression in an assignment pattern and a field or element in a data object or data value

 

 

 

In 8.13.1, REPLACE

 

Verilog uses concatenation braces to construct simple bit vectors. SystemVerilog adds a similar syntax to support the construction of arrays.

 

WITH

 

Verilog uses concatenation braces to construct and deconstruct simple bit vectors. SystemVerilog adds a similar syntax to support the construction and deconstruction of arrays.

 

 

In 8.13.2, REPLACE

 

A structure value can be constructed with a structure assignment pattern built from member expressions using braces and commas, with the members in declaration order.

 

 

WITH

 

A structure value can be constructed and deconstructed with a structure assignment pattern built from member expressions using braces and commas, with the members in declaration order.

 

 

 

In 3.7, REPLACE

 

            Array literals are array assignment patterns with constant member expressions (see 8.13.1). An array literal must have a type, which may be either explicitly indicated with a prefix or implicitly indicated by an assignment-like context.

 

WITH

            Array literals are array assignment patterns or pattern expressions with constant member expressions (see 8.13.1). An array literal must have a type, which may be either explicitly indicated with a prefix or implicitly indicated by an assignment-like context.

 

In 3.8, REPLACE

 

            Structure literals are structure assignment patterns with constant member expressions (see 8.13.2). A structure literal must have a type, which may be either explicitly indicated with a prefix or implicitly indicated by an assignment-like context (see 4.14).

 

WITH

            Structure literals are structure assignment patterns or pattern expressions with constant member expressions (see 8.13.2). A structure literal must have a type, which may be either explicitly indicated with a prefix or implicitly indicated by an assignment-like context (see 4.14).

 

 

In 32.39, in bullet 5, REPLACE

 

            when the curly braces of the assignment pattern are prefixed by a data type name.

WITH

            when the curly braces of the assignment pattern are prefixed by a data type name to form an assignment pattern expression.

 

In 32.39, in bullet 6, REPLACE

 

            Nesting of assignment pattern expressions shall be preserved.

 

WITH

            Nesting of assignment pattern expressions patterns shall be preserved.

 

In 32.39, in bullet 6, REPLACE

 

            The assignment pattern that initializes the struct variable ABC uses member, type and default keys. The vpiOperand traversal would represent this assignment pattern expression as:

 

 

WITH

            The assignment pattern that initializes the struct variable ABC uses member, type and default keys. The vpiOperand traversal would represent this assignment pattern expression as:

 

In 32.39, in bullet 6, REPLACE

 

            or some other equivalent positional assignment pattern expression.

 

WITH

            or some other equivalent positional assignment pattern expression.

 

 

In 32.39, in bullet 6, REPLACE

 

            The assignment pattern which initializes the array variable varr uses index and default keys. The vpiOperand traversal would represent this assignment pattern expression

 

WITH

            The assignment pattern which initializes the array variable varr uses index and default keys. The vpiOperand traversal would represent this assignment pattern expression

 

 

In 32.39, in bullet 7, REPLACE

 

            For the assignment pattern expression ’{2{y}},

 

WITH

            For the assignment pattern expression ’{2{y}},

 

 

In the Index, ADD references to "assignment pattern" and "assignment pattern expression" that point to 8.13.