Re: [sv-bc] Fwd: RE: 6.20.2 Value parameters - partially defined type - unpacked array

From: Daniel Mlynek <danielm@aldec.com.pl>
Date: Wed Aug 31 2011 - 23:21:41 PDT

So there 2 unresolved mantises on this subject
What can be assigned to parametr if it type is not defined :
http://www.verilog.org/mantis/view.php?id=3173
is it legal to assign untyped literal to untyped parameter
http://www.verilog.org/mantis/view.php?id=3287

As I understand at the for both those mantises there is no accepted by
all solution and they are controversial

Maybe it would be nice to add example to each rule for range and type of
parametrs in 6.20.2
It would be also nice if LRM explicitly will say which types are allowed
for parameter (only integral, real, unpacked array and unpacked struct)
others are illegal(class, dynamic associative arrays. queues, events...)

DANiel

On 8/31/2011 8:00 PM, Steven Sharp wrote:
>
> The first bullet in 6.20.2 lists only two possible cases: the
> expression being real and the expression being integral. I believe
> the intent was that these were the only two cases in which these rules
> applied. This was explicit in the 1800-2005 LRM, but that text seems
> to have been lost when the two LRMs were merged. In that LRM, 6.3.2 said
>
> "In an assignment to, or override of, a parameter without an explicit
> type declaration, the type of the right-hand expression shall be real
> or integral."
>
> My interpretation is that this declaration does not satisfy the
> requirements to be a parameter without an explicit type declaration.
> Therefore, it has an explicit type declaration. Just as "var v[2]"
> would be an unpacked array of 2 logic elements, "parameter p[2]" would
> be an unpacked array of 2 logic elements. Then you would apply the
> assignment rules. I believe that these no longer require equivalent
> element types, so this would be legal and would truncate each of the
> shortints to 1 bit during assignment.
>
> *From:*owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] *On Behalf Of
> *Daniel Mlynek
> *Sent:* Wednesday, August 31, 2011 4:04 AM
> *To:* sv-bc@eda.org
> *Subject:* [sv-bc] Fwd: RE: 6.20.2 Value parameters - partially
> defined type - unpacked array
>
> In chapter 6.20.2 LRM defines how should be the type parameter if its
> type is not fully defined.
> This description misses the unpacked array type parameters.
> Lets assume situation where there is only unpacked dimension defined -
> like below how it shuld behave. IMHO LRM should add description for
> such cases and similar cases ie only singes and unpacked dim defined,
> only packed range and unpacked dimension defined etc...
>
> typedef shortint T[2];
> module name;
> parameter p[2]=T'{1,2}; //LRM do not describe how this case should
> work while BNF allows such code.
> initial $display("%p", p);
> initial $display("%b", p[0], p[1]);
> endmodule
>
> module top;
> parameter int tp[2]= '{1,-1};
> name #(tp)uut2();
> endmodule
>
> DANiel
>
> --
> 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 Wed Aug 31 23:59:45 2011

This archive was generated by hypermail 2.1.8 : Wed Aug 31 2011 - 23:59:57 PDT