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

From: francoise martinolle <fm_at_.....>
Date: Tue Apr 04 2006 - 20:20:35 PDT
 
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 20:20:40 2006

This archive was generated by hypermail 2.1.8 : Tue Apr 04 2006 - 20:21:03 PDT