Re: [vhdl-200x] A compromise about modular type, boolean operations, integers...

From: Tristan Gingold <tgingold@free.fr>
Date: Mon Oct 27 2014 - 23:28:24 PDT
[Might be a duplicate]
 > If, on the other hand, we decide that modular is a new type, rather
 > than a subtype of integer, then we have to define operators for
 > every combination of integer and modular arguments and return types,
 > all the while avoiding ambiguity of return type in intermediate
 > expressions.

No, we don't have to define operators for every combination of integer
and modular arguments (this is simply not possible as the analyser
doesn't know all the integer and modular types).  We need to
define operators for each type.  Std.Standard defines real and integer,
but no combined operators (well except for "**").  Or simply see
how Ada handles modular types.

 > Thus, there is no minimally-invasive solution for modular behavior
 > unless we apply the modular behavior at assignment, which is also
 > where we currently assign bounds checking for subtypes.

I don't agree with that.  Defining a modular type class is minimally
invasive.

 > I get it; yes, modulo at assignment is different that modulo at each
 > operator result. Unfortunately, there aren't any good solutions to
 > the latter.  And while for some purposes, modulo at assignment is
 > less useful, it is still extremely useful (more so than what we have
 > now!)

Many languages have modular types.  See for example C (the unsigned
types) and Ada (modular type).  I think these solutions are far better
than what you propose.

Do you realize that with your solution you cannot have a 2**32 modular
type ?

 > And if the modular behavior is going to be applied at assignment, I'd
 > rather have a general solution (expand resolution functions to
 > variables) than a point solution (a language-defined super-subtype).

That doesn't work well.  First, it is not really compatible with
the existing language; second you need to have an heavy mechanism to
pass resolution function to subprograms; third, you need to define
precisely where the assignments are done (are they done when a
parameter is passed to a subprogram ?); fourth, I don't see clearly
how that would be synthetizable; and finally that's also crippled
(you cannot have a 2**32 modular subtype).

Tristan.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Oct 27 23:28:41 2014

This archive was generated by hypermail 2.1.8 : Mon Oct 27 2014 - 23:29:13 PDT