From: Dennis Marsa (drm@xilinx.com)
Date: Thu Feb 07 2002 - 10:56:11 PST
Precedence: bulk
Michael McNamara wrote:
>
> Dennis Marsa writes:
> >
> > The example I have in mind is different. It involves b being
> > defined in lower scope, so that b is either not defined at the
> > point of the @(*), or would be a reference to a different
> > b.
> >
> > reg [31:0] a, mem8x10[1024:0]; // no b defined here
> > always @(*) // b not visible from here
> > begin : named
> > reg [31:0] b; // b defined here
> > b = <something>;
> > a = mem8x10[b];
> > end
> >
> > This would seem to expand to something like:
> >
> > always @(<events from something> or <event involving mem8x10>)
> > begin : named
> > reg [31:0] b;
> > b = <something>;
> > a = mem8x10[b];
> > end
> >
> > But what is <event involving mem8x10>? Saying it is mem8x10[b] seems
> > suspect to me since the b used to index mem8x10 is not visible from
> > there.
> >
> > Dennis
> >
>
> The key bit is what is in the expression <something>.
>
> Again, you show everything in <something> getting moved up to the
> sensitivity list; as well as any change to any cell of the memory.
>
> This would certainly result in the correct simulation; but is
> conservative.
OK. If we can agree that:
always @(<events from something> or mem8x10)
is a valid, but conservative, interpretation of @(*) in the
above example, then I am content.
> For most efficient simulation (assuming the size of mem8x10 is large,
> and the expression <something> is small) this code would expand to:
>
> always @(mem8x10[<something>])
> begin : named
> reg [31:0] b;
> b = <something>;
> a = mem8x10[b];
> end
>
> To implement this simulators would need to preform reaching definition
> analysis; which is well defined [Chapter 14 of Principles of Compiler
> Design, Aho & Ullman, 1977 ISBN 0-201-00022-9, for one].
But if I am not writing a simulator, or I'm writing a really
slow simulator :-), then can't I still fall back on the
conservative interpretation and be sensitive to the entire
array?
I guess I am arguing that, from the point of view of the standard,
in the example in question:
@(*) means @(<events from something> or mem8x10)
and I would classify going beyond that to say:
@(*) really means @(mem8x10[<something>])
would be a optimization a particular implementation would be free
to exploit as long as it does so in a way that is consistent with
the (conservative) semantics defined in the standard.
Dennis
This archive was generated by hypermail 2.1.4
: Mon Jul 08 2002 - 12:55:35 PDT
and
sponsored by Boyd Technology, Inc.