Re: [sv-bc] FW: [sv-ec] Question on compilation units & compiler directives

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Wed Jan 25 2006 - 08:43:48 PST
C doesn't use structural equivalence even for struct types.  The
following C program has an illegal assignment --

#include <stdio.h>
main() {
  struct {int i;} a;
  struct {int i;} b;
  a.i = 0;
  b = a;
}

-- Brad

-----Original Message-----
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Rich, Dave
Sent: Wednesday, January 25, 2006 8:08 AM
To: pgraham@cadence.com
Cc: sv-bc@eda.org
Subject: RE: [sv-bc] FW: [sv-ec] Question on compilation units &
compiler directives

Do we really want to get into type matching by structural layout, I
don't think so.

But its get's even more complicated with generate statements.

module foo;
  parameter W=4;
  generate if (W <4)
    class bar;
      int A[W];
    endclass
  else
    class bar;
      string B[W];
    endclass     
 endgenerate
  bar B=new;
endmodule

> -----Original Message-----
> From: Paul Graham [mailto:pgraham@cadence.com]
> Sent: Wednesday, January 25, 2006 7:53 AM
> To: Rich, Dave
> Subject: Re: [sv-bc] FW: [sv-ec] Question on compilation units &
compiler
> directives
> 
> > initial f1.B.A = f2.B.A; // Not legal
> 
> Couldn't this be resolved by resort to structural
> equivalence?  In this case the two classes have
> different sizes, due to the different parameter values.
> But if you had:
> 
>     foo #(3) f1();
>     foo #(3) f2();
> 
>     initial f1.B.A = f2.B.A;
> 
> then the two A vectors would have the same size.  Yet
> you're saying this assignment is illegal?
> 
> Paul
Received on Wed Jan 25 08:45:39 2006

This archive was generated by hypermail 2.1.8 : Wed Jan 25 2006 - 08:45:42 PST