>> enum [2:0] { A = 2'b11 + 2'b01, B } e; > >This is not a legal enum -- you may not use an explicitly >sized value that doesn't match the enum width. The value is not explicitly sized, because its size depends on which context the constant expression is evaluated in. Or, if the explicitly sized values here are 2'b11 and 2'b01, then the following is illegal enum [2:0] { A = {1'b0, 1'b0, 1'b0}, B } e; -- Brad ________________________________________ From: owner-sv-bc@eda.org [owner-sv-bc@eda.org] On Behalf Of Gordon Vreugdenhil [gordonv@model.com] Sent: Thursday, April 30, 2009 9:09 PM To: Mark Hartoog Cc: Maidment, Matthew R; sv-bc@eda.org Subject: Re: [sv-bc] RE: email ballot: Due 8am PDT Friday, May 1 Mark Hartoog wrote: > > SVDB 2477 ___Yes _X__No > http://www.eda.org/svdb/view.php?id=2477 > > If enum constants are evaluated in a self determined context it will make them > inconsistent with how expressions are evaluated elsewhere in system verilog. > > parameter [2:0] p = 2'b11 + 2'b01; > enum [2:0] { A = 2'b11 + 2'b01, B } e; This is not a legal enum -- you may not use an explicitly sized value that doesn't match the enum width. Given that either sizes have to match the enum base or be unsized, it isn't clear to me the circumstances under which there is really going to be a difference. I guess if you have a >32 bit enum base width and then added two unsized values that the implementation treated as 32 bits integers (legal) and that caused a 32 bit overflow you might get a difference. A bit obscure, but possible. Gord -- -------------------------------------------------------------------- Gordon Vreugdenhil 503-685-0808 Model Technology (Mentor Graphics) gordonv@model.com -- This message has been scanned for viruses and dangerous content by MailScanner, 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 Thu Apr 30 22:26:30 2009
This archive was generated by hypermail 2.1.8 : Thu Apr 30 2009 - 22:27:19 PDT