RE: [sv-ec] inline constraints -- things are not really quite right yet (perhaps)

From: Jonathan Bromley <jonathan.bromley_at_.....>
Date: Thu Nov 08 2007 - 02:47:30 PST
I hope this isn't a duplicate - my original message 
didn't seem to make it to the reflector.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[Gord]
> In the discussion regarding inline constraints, I am now Ok
> with the fact that there exists a mechanism for forcing a
> reference to resolve in an outwards manner.
> That isn't really very "tight" though.

I had hoped that the presence of a local:: qualifier 
anywhere in the constraint block would also force 
unqualified names to resolve as if they had been
written in a constraint inside the target class,
so that they can never leak out into the local context.
This would leave the old syntax as ambiguous as it
always has been, but would permit an even slightly
paranoid programmer to protect themself against
the problems you describe - I think.

I definitely agree that local::x should be sufficient
to wildcard-import x, and that undecorated references
should not.

If you can live with the idea that the presence of "local::"
forces unqualified names to be resolved as if written 
in a constraint inside the target class, then there is a 
remaining problem of how to write an unambiguous constraint
in which *only* class members participate.  The lack of
any local:: in such a constraint would make us lapse back
to the compatibility behaviour, allowing unqualified 
references to leak out of the class.  I guess you could
fix this (unpleasantly) thus:

  parameter TRUE = 1;
  c.randomize() with { x < y; local::TRUE; };

~~~~~~~~~~~~~~~~~~~~~~~~

As a convenience feature, I would also suggest that
*anything* with a local:: qualifier should be treated 
as a state variable for the constraint,
so that (as I suggested in an earlier post)

  c.randomize() with {x != local::c.x;}; 

would unambiguously mean "randomize c.x so that it
gets a value different from its present value".

Thanks
-- 
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223                   Email: jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573                           Web: http://www.doulos.com

The contents of this message may contain personal views which 
are not the views of Doulos Ltd., unless specifically stated.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Nov 8 02:47:51 2007

This archive was generated by hypermail 2.1.8 : Thu Nov 08 2007 - 02:48:33 PST