Re: [sv-ec] Re: [sv-bc] Musings on array assignment compatibility

From: <jonathan.bromley_at_.....>
Date: Wed Jun 03 2009 - 11:58:30 PDT
> [SB] 2611 does not seem to be relevant. Did you mean maybe 1447 or 1702? 

> [Greg Jaxon] Ooops.  Sorry.  I meant 2380.
> The one that relaxes the assignment compatibility definition for 
> packed elements of unpacked arrays - going from equivalent to 
> assignment compatible.

My understanding of the history here:

SV3.1a allowed assignment compatibility of unpacked arrays
if the elements were assignment compatible.  1800-2005 
tightened this to require element equivalence.

Mantis 1702 formally defined unpacked array concatenation
(UAC), primarily to legitimize some queue examples that 
had come from Superlog, but also to allow self-evidently
useful things like
  reg [3:0] digits [8];
  ...
  digits = {digits[1:7], digits[0]};
that cannot be expressed as '{} assignment patterns.
The definition of UAC specifies assignment compatibility
of elements; it would be much less usable had it
enforced type equivalence of elements.  At the time I
wrote 1702, I did not fully understand the impact of
the element equivalence requirement and therefore
was not aware of how disruptive this might be.

At roughly the same time, Mantis 1447 was trying to
straighten out a bunch of confusions concerning where
it is and is not legitimate to use an array.  I didn't
write 1447 (I think it was Mike Burns) but I suspect
the same kind of misunderstanding of the element
equivalence rules might have been at work there too.
Whatever the reason, some of the 1447 text introduced
the very explicit contradiction that gave rise to the
ballot feedback on this.

The tentative proposal that is currently attached to
Mantis 2380 puts things back to the SV3.1a state,
allowing assignment compatibility of unpacked arrays 
having assignment compatible elements.  I'm reasonably
confident that it is a consistent and implementable 
solution to the problem, but it doesn't meet the BC
call for type safety of unpacked array copy.

I have now reviewed all the relevant text (I think!) 
and I believe it would be fairly straightforward to
rework it to enforce element equivalence again. 
However, practical considerations mean that the
rules for UAC still need to allow element assignment
compatibility; consequently, UAC provides a loophole
when you want to do a "sloppy" array copy of any 
one-dimensional unpacked array.  It doesn't help
with multidimensional unpacked arrays, but Dave Rich
has pointed out that this is a much rarer situation
that can be handled by user-written code.

I really, really don't want to get involved in 
defining completely new features such as foreach'()
at this late stage, however great their merits.
-- 
Jonathan Bromley


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jun 3 12:00:10 2009

This archive was generated by hypermail 2.1.8 : Wed Jun 03 2009 - 12:02:36 PDT