Re: Fwd: Genvars only positive?

From: Paul Graham (pgraham@cadence.com)
Date: Fri Jun 22 2001 - 14:26:35 PDT


Precedence: bulk

Cliff,

> Unfortunately I disagree with the "widely accepted definition" claim. To
> make sure I was not complete ancient, I looked for "natural" in my Java and
> even my old college Ada text. No such definition exists in either of these
> languages that I could find. I believe this is a term that was invented for
> VHDL.

Must not have been a very good Ada textbook. Ada's package standard defines
subtypes POSITIVE and NATURAL:

    subtype NATURAL is INTEGER range 0..INTEGER'LAST;
    subtype POSITIVE is INTEGER range 1..INTEGER'LAST;

> I equate positive to be >= 0, positive, non-zero to be >0, with similar
> definitions on the negative side. The Verilog standard has never had a
> definition for "natural" nor do I see a compelling reason to add one to
> the IEEE document.

Think about your definitions for a minute. If positive means >= 0, and
negative means <= 0, then what is 0? What is -0? Positive and negative are
disjoint sets. Natural and negative are also disjoint sets. There is an
asymmetry here, because people are not usually interested in the range
INTEGER'FIRST..0.

You'll also find the definitions of natural and positive in a high school
algebra textbook, if not earlier. I remember being introduced to them in
seventh grade :-) My Random House College Dictionary ((c) 1980) defines
positive (definition 19) as "noting a quantity greater than zero". Knuth
TAOCP vol. 1 ((c) 1973) defines "Positive: Greater than zero (*not* zero)".
I'm sure I could find more references in a library.

Anyway, I think anyone who *carefully* reads the text of the LRM will treat
genvars as being greater than zero, but not zero. But it's also likely that
implementors will follow the examples instead of reading the text, and make
genvars either natural (i.e., unsigned) or signed. It's also likely that
implementors will simply reuse some of their existing code for sequential
for loops and will treat genvars basically as integers (signed).

Paul



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:54:40 PDT and
sponsored by Boyd Technology, Inc.