RE: [vhdl-200x] Modular types

From: Jones, Andy D <andy.d.jones@lmco.com>
Date: Mon Jul 14 2014 - 18:22:56 PDT
I tend to agree with Ryan, especially since, if operators are aware of their arguments' moduli, then we have some very heavy lifting to implement: either compatibility between common operators and different types of modular integer, or ability to access operator actuals' and return values' subtypes (the latter of which is particularly thorny).

If on the other hand, we use integer operators and modulo the expression result upon assignment to, or association with, an object of a given modulus, then this gets much simpler. The user has the responsibility to see to it that intermediate values do not exceed the range of integer. Standard logical, rotation and arithmetic as well as logical shift operators can be defined in terms of existing integer operations, for all integers, and include automatic modulo to natural range. Like in Ada, these operations with a non-power-of-two modulus may be strange, but will be consistent, even if not particularly useful. 

Of course, a large extension to the minimum range of integer/natural goes along with this.

Andy



-----Original Message-----
From: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] On Behalf Of ryan.w.hinton@L-3com.com
Sent: Monday, July 14, 2014 2:20 PM
To: vhdl-200x@eda.org
Subject: EXTERNAL: RE: [vhdl-200x] Modular types

I guess I'm still thinking of them as "just integers," particularly when evaluating expressions.  So we could define shl, shr, and, xor, etc. for integers, and expressions involving modular types would have access to them just like all the other integer operations.

- Ryan

-----Original Message-----
From: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] On Behalf Of whygee@f-cpu.org
Sent: Monday, July 14, 2014 12:46 PM
To: vhdl-200x@eda.org
Subject: RE: [vhdl-200x] Modular types

Le 2014-07-14 20:35, ryan.w.hinton@L-3com.com a écrit :
> Can someone help me understand why the modulus affects the definition 
> of logical and shift operations?  I imagine logical and shift 
> operations applying to the twos-complement representation of the 
> integer.  I don't see how the modulus affects this definition.

Just to be explicit and clear, the operators
  - could be named shl2, sha2, shr2, rol2, ror2, and2, or2, ...
       (BTW, the boolean case for modulars is quite easy to manage,
       just mask the MSB, but the rotations are the trickiest of the lot)
  - would trigger a warning when used on non-binary modulars

or any combination of these possibilities.

Any other suggestion ?

yg

--
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.




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Jul 14 18:23:20 2014

This archive was generated by hypermail 2.1.8 : Mon Jul 14 2014 - 18:23:49 PDT