On Tue, 02 Jan 2007 08:26:20 -0800, Jim Lewis
Jim, thanks for the interesting thought-provokers.
"Drongo" must be one of those British English terms
that doesn't translate to American English.
Aw, let me have my little New Year rant

I suspect
"lamebrain" comes close, but it's a bit too literal for
Brit tastes so we go for "drongo" or "numpty". Anyways,
enough of this before I fall foul of the Equal-Respect-For-
Std_logic_unsigned-Users political correctness police.
For testbenches, where one needs to add to the address as part
of the algorithm, what do you do? Note that address is only a
collection of bits and, hence, is std_logic_vector.
Indeed. But I suggest that it should be a collection of bits
ONLY at the level of a BFM that's tying the (more abstract)
testbench to the DUT and its life-support systems.
Inside the testbench, where our reference model for
the address-manipulating algorithm exists, the address
is (I hope) most definitely NOT represented as a
std_logic_vector. Instead I hope that I have some
sensible data structure (record) capturing a fairly
abstract view of the transaction that I'm pushing
around the testbench. Inside that record, the address
may well be represented as an integer - or something
quite else. The representation, I hope, is fairly well
hidden behind various access and manipulation
procedures that work on variables of this record type.
That kind of structuring gets me some way towards
an object-oriented view of the testbench - OK, the
syntax isn't as pretty as it would be in a proper OO
language, and inheritance isn't a serious proposition,
but I can make information-hiding work bearably well.
If some of my access procedures need to do fiddly
type conversions, so be it - I write them once only.
Methodology wise, is it ok to use a different data type in the
testbench just because you want to do math?
Absolutely. I want my TB to look as much like software
as I can possibly make it. I want to throw transaction
records to and fro across the boundary between a rather
abstract TB and a collection of BFMs that do the dirty work
of translating between abstract records and concrete
bit patterns. Sadly that's tougher in VHDL than in
Verilog because I can't call a (BFM) procedure in one
instance from a process in a different instance, but
by sensible use of record ports and handshaking
procedures I can make it all manageable.
By the way, this has long been by far the top of
my VHDL wish-list: something like the Ada
rendezvous mechanism, or 'e' method
ports, allowing me to call a procedure from
out-of-module.
3) Use std_logic_unsigned:
address <= address + 1 ;
Your friend
I can choose my friends, but I can't easily choose my
prejudices
OTOH, in RTL code if you don't use std_logic_unsigned and
you are accustomed to writing:
if unsigned(Address) > "01001" then
What happens if you forget the type conversion:
if Address > "01001" then
Yikes - both of these compile, however, if Address is not
5 bits this is a potential bug.
Yikes indeed. But numeric_std beautifully rescues us from
this by allowing comparison between unsigned and integer.
I would *always* regard magnitude comparison with a
vector literal as being questionable style - there are too
many things that can go wrong, as you say.
My point being that this is not as crystal clear problem as
many wish it to be.
Sure; and, of course, if you're bilingual in VHDL and
Verilog the crystal is even foggier, because so many
of the key methodology decisions are likely to go
different ways in the two languages.
Nice. However, even VHDL Evangelists have to admit
that SystemVerilog packed unions are pretty cool and
make it rather easy to solve some of these problems

--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.