Re: Why is type for string parameters mandatory?

From: Marq Kole <marq.kole_at_.....>
Date: Thu Nov 16 2006 - 00:28:49 PST

Geoffrey,

> things like
>   if (myParam == "nmos")
> since both sides would be (converted from string literal to)
> the same 24-bit integer value.

I would say that the string "nmos" would be converted to a 32-bit integer value.

If these string literals are converted to packed arrays of 8 bits, are these 24-bit and 32-bit integers interchangeable with ordinary integers?

Cheers,
Marq


Marq Kole
Competence Leader Robust Design

Research
NXP Semiconductors








"Geoffrey.Coram" <Geoffrey.Coram@analog.com>

Sent by:
owner-verilog-ams@server.eda.org

15-11-2006 15:21

To
Dave Miller <David.L.Miller@freescale.com>
cc
verilog-ams <verilog-ams@server.eda-stds.org>
Subject
Re: Why is type for string parameters mandatory?
Classification





Dave -
If you did
 parameter myParam = "abc";
and AMS didn't disallow this, it would still have to convert this
to a 24-bit integer.  I guess you would still be able to test
things like
 if (myParam == "nmos")
since both sides would be (converted from string literal to)
the same 24-bit integer value.

I would say, though, that AMS allows you to do
 parameter string myParam = "abc";
since it extends digital 1364, and also you should be able to
use the == and != operators, I don't think they're restricted
to the analog block.

-Geoffrey


Dave Miller wrote:
>
> Okay so Shalom's comment that parameter myParam = "abc" declares a 24bit
> vector makes sense as to why it works in digital. I just looked at it as
> they have allowed string parameters without declaring the type which was
> not quite right.
>
> Digital explicitly disallows me to declare a string parameter as:
> parameter string myParam = "abc";
>
> Analog currently explicitly disallows me to declare a string parameter as:
> parameter myParam = "abc";
>
> Because parameters are at module scope and hence domain less (well thats
> how I look at them) this creates some conflict if I happen to want to
> use the same parameter in both domains.
> The biggest use I am seeing for string parameters today in my work is in
> test benches where they are being used for error messages and to store
> the filename of a file to be used in a $fopen() statement.
>
> Dave

--
Geoffrey J. Coram, Ph.D.    Senior CAD Engineer    
Analog Devices, Inc.        Geoffrey.Coram@analog.com
804 Woburn St., MS-422,     Tel (781) 937-1924
Wilmington, MA 01887        Fax (781) 937-1014

Received on Thu Nov 16 00:36:49 2006

This archive was generated by hypermail 2.1.8 : Thu Nov 16 2006 - 00:37:26 PST