[sv-bc] RE: [sv-ec] Manti 1457, 2374 revisited

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Fri Nov 21 2008 - 16:26:02 PST
Jonathan,

Mantis 1457 does not change the semantics of associative arrays with
wildcard indices. In 1800-2205 states:

	The array can be indexed by any integral data type. Because the
indices can be of different sizes, the
	same numerical value can have multiple representations, each of
a different size. SystemVerilog
	resolves this ambiguity by detecting the number of leading zeros
and computing a unique length and
	representation for every value.

The new LRM is more specific, namely it details how to compute the
unique-length representation mentioned above. Namely:

	... by removing the leading zeros and computing the minimal
length and using that representation for the value.

This change should not cause any user-observable change in semantics.

	Arturo

-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
jonathan.bromley@doulos.com
Sent: Friday, November 21, 2008 8:45 AM
To: sv-ec@eda.org; sv-bc@eda.org
Subject: [sv-ec] Manti 1457, 2374 revisited

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.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Nov 21 16:26:42 2008

This archive was generated by hypermail 2.1.8 : Fri Nov 21 2008 - 16:28:56 PST