Re: [sv-ec] Question about the definition of New for dynamic arrays.

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Tue Apr 04 2006 - 21:41:57 PDT
Maybe no restrictions are necessary.  How about the following?

 In 5.6.1, REPLACE

   "Must be a non-negative integral expression."

 WITH 

   "The type of this operand is longint unsigned."

 WHERE

   "longint unsigned" is in a boldface constant-width font.

-- Brad

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
francoise martinolle
Sent: Tuesday, April 04, 2006 8:21 PM
To: sv-ec@eda.org
Subject: [sv-ec] Question about the definition of New for dynamic
arrays.

 
Section 5.6.1 states that the expression inside the [] for a dynamic
array
allocation
needs to be a non negative integral expression. This means that the
expression can be 0
and can contain x and z.
This presumably makes the following legal:
What is the value of v after each default pattern assignments?



module sample ();

  logic v[];

  initial begin
    v = new[0];
    v = '{default: 1'b0};
    v = new [4'bxzxz]
    v = '{default: 1'b0};
    
  end
endmodule // sample


Intuitively new[0] is like malloc(0) and I do agree that we should
accept
that.
But why should we accept 4 state values? Shouldn't we change the
definition
that the expression
inside the [] should be a non negative 2 state value? Another solution
is to
say that
a 4 state valued expression is implicitly converted to a 2 state value
x=>0,
z=> 0
hence any expression containing x and z is equivalent to 0.



Francoise
    '
Received on Tue Apr 4 21:42:05 2006

This archive was generated by hypermail 2.1.8 : Tue Apr 04 2006 - 21:42:15 PDT