Re: [sv-bc] RE: [sv-ec] svlog enum function usage

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Fri Apr 25 2008 - 09:45:13 PDT
No.  Color is a type_identifier.  Since first() could be
considered as a "static method", what you're doing is feasible,
but it's syntax would be clearer, in my opinion, if written

    color::first()

similarly it should be possible to refer to color::blue.
Neither of these are in the standard at present, but C++ programmers
might expect them.

The LRM specifies my_color.first() and (except for one
stray sentence about "variables") would support blue.first(),
but, for static methods this syntax is not "minimal".

Greg

Mirek Forczek wrote:
> But is the following statement valid:
>  
> 
> typedef enum {red, yellow, blue, green} color;
> 
> color my_color;
> 
>  
> 
> initial
> 
>     my_color = color.first;
> 
>  
> ?
>  
> Mirek
> ------------------------------------------------------------------------
> *From:* owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org]
> *On Behalf Of *Brad Pierce
> *Sent:* 24 kwietnia 2008 19:05
> *To:* sv-ec@server.eda.org; sv-bc@server.eda.org; sv-ac@server.eda-stds.org
> *Subject:* RE: [sv-ec] svlog enum function usage
> 
> I think an enum method can only be used with a variable, not with an
> anonymous value returned by some expression.
> 
>  
> 
> n  Brad
> 
>  
> 
> *From:* owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] *On Behalf Of
> *Kapil Kaushik
> *Sent:* Thursday, April 24, 2008 9:57 AM
> *To:* sv-ec@eda.org; sv-bc@eda.org; sv-ac@eda-stds.org
> *Subject:* [sv-ec] svlog enum function usage
> 
>  
> 
> Hi,
> 
>  
> 
> System Verilog provides some enum functions(section 4.10) like: next,
> prev, last, first etc. for use. I have a doubt whether the following
> statement (highlighted) is valid:
> 
>  
> 
> module test(input clk, input in, output out);
> 
>  
> 
> typedef enum {red, yellow, blue, green} color;
> 
> color my_color
> 
>  
> 
> always @(clk)
> 
> begin
> 
>  
> 
> my_color = blue;
> 
> *my_color = my_color.prev.next.next*
> 
>  
> 
> end
> 
> endmodule
> 
>  
> 
> i.e. are stacked up function calls valid? SVlog LRM does not mention
> anything about this, so it would be great to have some feedback on this.
> 
>  
> 
> Thanks,
> 
> Kapil
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
> 
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Apr 25 14:18:17 2008

This archive was generated by hypermail 2.1.8 : Fri Apr 25 2008 - 14:19:01 PDT