Subject: Re: $sv-ec SVTestbench questions/comments.
From: Adam Krolnik (krolnik@lsil.com)
Date: Fri Nov 22 2002 - 08:21:23 PST
Good morning Mehdi;
You clarify the difference between an associative array and a hash table. I thank
you for the explanation. I did not know the difference.
You write:
"Perhaps, you make the case for a new requirement to provide a built-in list?"
Yes, I hope so. If we are proposing new language features, then I propose that
we build in lists as a first class type. To propose other types as built-ins
and then relegate a list as a second class citizen would be a shame. Those
who program perl and use lists as elements see the value of having full
support rather than have lists be mimiced by pointers, indexes, etc.
You also write about the efficiency of traversal of associative arrays.
"Adding a new method that copies the indices into a new structure might be
a worthwhile enhancement."
If a list is a first class type, then this should be directly possible. But you
can also define an iterator efficiently (for code and the user) that has the
form of a foreach(). This is more efficient for the programmer as they don't
have to worry about how many, when done, etc - you operate on each element.
You also speak that users requested casex() semantics. There are a few papers writing
about the dangers of using casex(). The SV-AC committee defined for SystemVerilog
a system function with casez() semantics (called $insetz() ) which compares
the first element to the remaining list of elements. I would recommend based on
this definition and the written papers that we support casez() semantics.
One could even go further (safer) and define the operation with this additional
twist (which shields one from even tristate values.)
a ?=? b
is equivalent to:
casez(~(~a)) // Convert Z's to X's
b: out = 1'b1;
default: out = 1'b0;
endcase
Here is the reference paper on casex vs. casez.
http://www.sunburst-design.com/papers/CummingsSNUG1999SJ_SynthMismatch_rev1_1.pdf
THanks
Adam Krolnik
Verification Mgr.
LSI Logic Corp.
Plano TX. 75074
This archive was generated by hypermail 2b28 : Fri Nov 22 2002 - 08:23:35 PST