Re: [sv-bc] left/right justified and patched with zero


Subject: Re: [sv-bc] left/right justified and patched with zero
From: Arturo Salz (Arturo.Salz@synopsys.com)
Date: Wed Nov 05 2003 - 00:16:02 PST


Andy,

The declaration "byte [0:13] pk " is illegal.
Packed arrays can only be made of the single bit types (bit, logic, reg, wire,...).
The legal version of what I believe you want is:
    bit [0:13][0:7] pk = "hello world\n";
And then
    pk[0] is 0
    pk[1] is 0
    ...
    pk[12] is "d"
    pk[13] is "\n"

The declaration "byte unpk[0:13]" is legal, but the assignment is illegal.
You could do the following:
    byte unpk[0:13] = { "h", "e", "l", "l", ... "d", 0, 0 };
But then the sizes have to match, which is why I added 0,0 at the end.

    Arturo

----- Original Message -----
From: "Andy Tsay" <andytsay@yahoo.com>
To: "Greg Jaxon" <Greg.Jaxon@synopsys.COM>
Cc: <sv-bc@eda.org>
Sent: Monday, November 03, 2003 5:13 PM
Subject: Re: [sv-bc] left/right justified and patched with zero

Hi,

Let me try to put it in another way.
For the following examples:
  byte unpk[0:13] = "hello world\n";
  byte [0:13] pk = "hello world\n";

What are the values for unpk[12], unpk[13], pk[0], and pk[1]?

Thanks,
Andy

--- Greg Jaxon <Greg.Jaxon@synopsys.com> wrote:
> Andy Tsay wrote:
>
> > byte unpk[0:13] = "hello world\n";
> > // same as unpk = {"hello world\n",8'b0, 8'b0}; ???
>
> Please ask this in the form
>
> // same as unpk = "hello world\n\0\0"; ???
>
> Since as posed it yields a length error trying to put three things into
> and array of 14 things.
>
> Greg Jaxon
>
>



This archive was generated by hypermail 2b28 : Wed Nov 05 2003 - 00:15:58 PST