RE: EXTERNAL: Re: [vhdl-200x] Sizing of variables and signals from initial values

From: Jones, Andy D <andy.d.jones@lmco.com>
Date: Thu Apr 25 2013 - 08:02:42 PDT
Jim,

Adding additional operators is often clumsy, unnecessarily adds bulk to the language, and needless implementation work for the tool vendors. (e.g. "which addition operator do I use here?"). I believe this is already handled admirably by overloading the same operator for different types. 

Adding ufixed works differently (lossless) than adding unsigned does (lossy). There are already mixed unsigned/ufixed and signed/sfixed operator definitions, although they always return ufixed/sfixed.

Given that unsigned and signed quantities can be faithfully represented by ufixed and sfixed, we have the choice of either lossless or lossy arithmetic for integral values. However, we do not have a standard type system for lossy arithmetic on rational values. Maybe one is needed, but I doubt it.

After thinking about it last night, my new-for-vhdl-2008 trick for counters might be (to borrow a page from your paper):

Variable count : ufixed(3 downto 0);

Variable overflow : ufixed(0 downto 0);

(overflow, count) := count + 1;  

(overflow, count) := count - 1; -- using fixed_wrap

As far as scalar literals are concerned, fixed point operators already allow one of the two arguments to be integer/natural or real, and convert the scalar literal to the range of the fixed point argument prior to the indicated operation.

Also, in 2008, one can use bit string literals and manage the index range:

a := b + (3 downto 0 => "1101");

Andy D Jones
Electrical Engineering
Lockheed Martin Missiles and Fire Control
Dallas TX



-----Original Message-----
From: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] On Behalf Of Jim Lewis
Sent: Thursday, April 25, 2013 12:33 AM
To: vhdl-200x@eda.org
Subject: Re: EXTERNAL: Re: [vhdl-200x] Sizing of variables and signals from initial values

Andy,
> I agree whole-heartedly with the "lossless" theory of operations (except for division).
 > I sometimes use ufixed instead of unsigned just because of the lossless arithmetic* ...

This just makes me think that we need two addition operators, one for accumulation and a lossless one for summing.


 > when integers won't handle the range.
I think someone (Ryan?) is taking a look at this.
Maybe you want to help?


Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training             mailto:Jim@SynthWorks.com
SynthWorks Design Inc.           http://www.SynthWorks.com
1-503-320-0782

Expert VHDL training with a focus on hardware design and test.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--
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 Thu Apr 25 08:04:05 2013

This archive was generated by hypermail 2.1.8 : Thu Apr 25 2013 - 08:04:45 PDT