> If you view a struct as just a collection of objects then I would
> expect the object s.a to behave the same as (say) "reg s_a",
> so why would it be illegal?
>
> If you consider reg as a declaration of a driver & signal/signal-reference
> (which I do) then I think you would have disallow associating a struct
> with a net if it contains reg types, but I don't see a reason for not
> allowing references to it or other variable usage.
The struct is a data type that can be used to declare both nets and variables.
Using the 'var' keyword for variables and saying 'reg' is a data type we have:
typedef struct { reg a; } ST;
var ST sv;
wire ST sw;
Now sv.a is a variable with data type reg and sw.a is a net with a
resoultion function of a wire and a data type of reg.
On the other hand if we say that the 'reg' keyword is for variables,
then:
typedef struct { reg a; } ST;
reg ST sv;
wire ST sw;
This makes sv.a a variable of type 'logic' (default type for variables) and
sw.a a net with a resoultion function of a wire and a data type of 'logic'!!!
This seems wrong to me.
The fields of a struct are not variables unless the struct type is used in
a variable declaration.
-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org]On Behalf Of Kevin Cameron
Sent: Monday, November 15, 2004 2:35 PM
To: Mark Hartoog
Cc: Brad.Pierce@synopsys.COM; sv-bc@eda.org; sv-ec@eda.org
Subject: Re: [sv-bc] Deadline for detailed feedback on Data Types on Nets Proposal
Mark Hartoog wrote:
I tend to agree that 'reg' should not be a data type and that it
would be better to use 'reg' instead of 'var'.
Could someone please remind us again of the arguments for keeping
'reg' as a data type that is equivalent to 'logic'?
I think it was sloppy usage in SuperLog that got grandfathered into SV.
I'm not sure what the history of arguments on this are, but this
declaration, which is now legal would become illegal:
typedef struct { reg a; } ST;
ST s;
Since the fields of a struct are not variables but only data types.
I would have thought the struct is a data-type and if it is used as a variable then the individual
fields would also be variables?
If you view a struct as just a collection of objects then I would expect the object s.a to behave
the same as (say) "reg s_a", so why would it be illegal?
If you consider reg as a declaration of a driver & signal/signal-reference (which I do) then I
think you would have disallow associating a struct with a net if it contains reg types, but I
don't see a reason for not allowing references to it or other variable usage.
Kev.
-- Altera Corp, 101 Innovation Drv, San Jose, CA 95134. T# (408) 544 7126Received on Mon Nov 15 14:52:43 2004
This archive was generated by hypermail 2.1.8 : Mon Nov 15 2004 - 14:52:57 PST