Re: [vhdl-200x] Modular types

From: Brian Drummond <brian@shapes.demon.co.uk>
Date: Wed Jun 25 2014 - 08:05:37 PDT
On Wed, 2014-06-25 at 14:17 +0000, Martin.J Thompson wrote:
> Greetings all,

> In the last teleconference I was asked to look at what VHDL might be
> able to implement for “modular types”, so I’ve taken a look at how Ada
> does it (quotes below are taken from the LRM
> http://www.ada-auth.org/standards/ada12.html). 

> Ada defines a modular type from the base integer type (there are
> “signed integers” and “modular integers”).

I am in favour of this.

(I am usually in favour of convergent evolution between the two
languages)

One use case is to simplify mixing logical and arithmetic operations on
the same datatype.

Another is implementing modular counters - FIFO addressing for example,
which wrap around to 0 without raising overflow errors.

The former is usually modulo power-of-two, the latter is not, so I find
the two use cases are disjoint, so (IMO) the properties of logical
operations on non-power of 2 turn out to be a curiosity rather than a
nuisance.

> So, are there any features you would like which are not mentioned?
> Constraints which do not make sense?

I would just ask if it's worth also adding Ada's fixed point syntax. I
find it quite useful for algorithm development, e.g. comparing the
accuracy of an algorithm with the same code in floating point. It's
possible to write a generic subprogram and instantiate it with different
fixed and float types.

- Brian



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jun 25 08:06:01 2014

This archive was generated by hypermail 2.1.8 : Wed Jun 25 2014 - 08:06:11 PDT