RE: [sv-ec] Re: [sv-bc] question on str.putc()

From: <Shalom.Bresticker@freescale.com>
Date: Mon Oct 18 2004 - 01:11:01 PDT

To the best of my understanding, there are 3 basic ways of representing a string.

1. A string literal ("abc")
2. A vector (reg [3*8:1] r = "abc")
3. A string variable (string s = "abc")

For consistency, I think their behavior should be as similar as possible.

Defining a string variable as a queue of bytes would make it more
different than the other two types of strings, and therefore more confusing.

I think that is a Bad Thing.

By the way, it is also a Bad Practice to refer to a string variable or
any other specific type of string as simply "string" with no modifier.
The unmodified word "string" should be reserved for situations where it
is equally applicable to all types of strings.

Gee, I did not think I was opening up such a big can of worms...

Shalom

On Sun, 17 Oct 2004, Rich, Dave wrote:

> BTW, let's keep this on the SV-EC for now since strings are a testbench
> issues and I don't think people want to keep reading this in two
> different reflectors.
>
> I think some confusion was created when the SV-EC/SV-BC eliminated the
> 'char' type instead 'byte'. (Something that I still do not agree with).
> Then defining a string in terms of an array of characters makes no
> sense, which is what proposal 197 is trying to do.
>
> I think it would be better to define a string as a queue of bytes, with
> implicit casting rules for string literals and integral values to string
> variables.
>
> What Surrendra is trying to say is that there are no implicit casting
> rules from string variables assigned to integral values, so the example
> 'r = a;' is illegal without an explicit cast. And 'a[0] = "hi";' should
> be the same as 'a[0] = "i";' Since a[0] is an integral byte type, and
> integral type rules apply, therefore the left-most 8 bits of "hi" are
> truncated.
>
> Back to the original question:
>
> Is str.putc(j, x) semantically equivalent to str[j] = x?
>
> I think yes, only if x is an integral value.
> Otherwise str.putc(j, x)is semantically equivalent to str[j] = x[0] if x
> is a string.

-- 
Shalom Bresticker                        Shalom.Bresticker @freescale.com
Design & Verification Methodology                    Tel: +972 9  9522268
Freescale Semiconductor Israel, Ltd.                 Fax: +972 9  9522890
POB 2208, Herzlia 46120, ISRAEL                     Cell: +972 50 5441478
  
[ ]Freescale Internal Use Only      [ ]Freescale Confidential Proprietary
Received on Mon Oct 18 01:11:12 2004

This archive was generated by hypermail 2.1.8 : Mon Oct 18 2004 - 01:11:44 PDT