Re: [sv-bc] Constant method calls

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Mon Feb 11 2008 - 11:09:13 PST
AH I see the "N" argument is unsigned!  Never mind the concern for negative counts.
But the question of V == V.next(0) is still open.

Greg Jaxon wrote:
Surya,

   You keep bringing up the idea that the result of an enum next() method
depends on the number of calls made to it.  I don't see any support for
that idea in the LRM or in the committee's discussions.  The Next() method
does not update the variable (or constant) to which it applied.  It has
no static storage with which it might "remember" how often it has been called.
It is simply a function of two arguments - an enum and an optional (positive?)
integer count, N.  It locates the enum's value in the list of legal values, then
it steps forward in that (declaration-ordered) list "N" places and returns that
as its functional result.

   The existing definition is incomplete in not specifying how negative values
of N affect Next().  The special case of Next() for an out-of-range enum value
is also not clear - is the answer the same as .First() for /all/ values of N,
or only for N=1 (the default)?  Is V.Next(0) == V for all V, or only for legal
value of the enum type of V?

typedef enum { A,B,C } Enum_t;
Enum_t V = Enum_t'(5);

$display( V.Next, V.Next(-1), V.Next(2) );

But it would have mentioned depending upon previous calls to Next if that
influenced the result.

Greg Jaxon



Surya Pratik Saha wrote:
  
Hi Steven,
Even 'e' is a constant like parameter -
parameter enum {A, B, C} e = A;

then also I think 'next' should not be a constant, because the result
will depend on the no. of call which is not constant. What do you think?

Regards
Surya



-------- Original Message  --------
Subject: Re:[sv-bc] Constant method calls
From: Steven Sharp <sharp@cadence.com>
To: Greg.Jaxon@synopsys.com, spsaha@cal.interrasystems.com
Cc: sharp@cadence.com, sarani@cal.interrasystems.com, sv-bc@eda.org,
sv-ec@eda.org
Date: Saturday, February 09, 2008 6:56:05 AM
    
From: Surya Pratik Saha <spsaha@cal.interrasystems.com>
    
        
 
      
module top;
   enum {A, B, C} e;
   initial begin
      for (int i = 0; i < e.next(); i ++) begin:b
         reg[e.next(): 0] r;
      end
   end
endmodule
    
        
Surya, e.next cannot be a constant expression because e is not a
constant. The case that could possibly be allowed would be something
like A.next, whose result would be the constant B (if it is legal to
apply an enum method to an enum literal, which is unclear).

Steven Sharp
sharp@cadence.com





  
      



    

  


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. Received on Mon Feb 11 11:10:57 2008

This archive was generated by hypermail 2.1.8 : Mon Feb 11 2008 - 11:11:22 PST