[sv-bc] Manti 1457, 2374 revisited

From: <jonathan.bromley_at_.....>
Date: Fri Nov 21 2008 - 08:45:14 PST
hi SV-EC, SV-BC,

I've been reviewing all the Mantis items that have contributed 
to draft7a, for our own internal purposes (and, in doing so, 
gained a yet increased admiration for the Editor's massive 
efforts).  A few issues have somewhat taken me by surprise, 
notably these:

1457 (EC):
Associative arrays with [*] wildcard index type - the handling
of keys of diverse length has been altered since 1800-2005 
in a way that may break some existing code.  In 1800-2005 the 
two keys 2'b00 and 3'b000 would address different elements;
Mantis 1457 says they address the same element.  Was this
change intentional?

2374 et al (BC): 
enums are now permitted as members of packed arrays, unions,
and structs.  This has a self-evident and useful meaning 
for hardware design, and matches de facto tool behaviour. 
But there remains an issue about copying a regular vector
to a packed what-have-you that contains an enum.
It's an unchecked cast by the back door:

  typedef enum logic [1:0] {A = 2'b10, B = 2'b01} AB;
  typedef struct packed {AB ab; logic [5:0] c;} S;
  S s;
  s = 8'b0;       // legitimate???
  s[7:6] = 2'b11; // legitimate???
  s.ab = 2'b10;   // definitely illegal!
 
I know there was some discussion about this and I even have 
a recollection that, at one time, some tool(s?) forbade 
such usage.  Is everyone agreed that the copying of a 
vanilla vector to the packed struct 's' is legitimate? 
If so, doesn't it render the type safety of enums
rather toothless?

Disclaimer: I have code that uses exactly this idiom
and works as expected in tools I use.  I'm not trying 
to say the behaviour is wrong; merely that the current 
state of things is equivocal.
-- 
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

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 Fri Nov 21 08:46:20 2008

This archive was generated by hypermail 2.1.8 : Fri Nov 21 2008 - 08:50:21 PST