Re: [sv-bc] Ambiguity with packed struct literals

From: Paul Graham <pgraham@cadence.com>
Date: Mon Dec 06 2004 - 11:29:13 PST

> Here are some examples from that proposal --
>
> typedef struct packed {shortint x, y;} my_int;
>
> int i = my_int'{8'hFA,8'hCE}; // i is assigned 32'h00FA00CE
> my_int j = '{8'hFA,8'hCE}; // {j.x,j.y} is assigned 32'h00FA00CE
> my_int k = {8'hFA,8'hCE}; // {k.x,k.y} is assigned 32'h0000FACE

How about:

    typedef struct packed {shortint x, y;} my_int;
    typedef struct packed {bit x; byte y;} your_int;

    my_int k = {x:8'hFA,y:8'hCE}; // {k.x,k.y} is assigned 32'h00FA00CE (?)

Is the presence of field names in a concat-like literal sufficient to
"cast" the literal into being a struct literal? I would guess not,
since this not mentioned in the amendment. Also, field names by
themselves don't uniquely determine a struct type. But if not,
then what is the meaning of the above concat? Is it illegal?

Paul
Received on Mon Dec 6 11:29:16 2004

This archive was generated by hypermail 2.1.8 : Mon Dec 06 2004 - 11:29:27 PST