RE: EXTERNAL: Re: [vhdl-200x] Modular types

From: Jones, Andy D <andy.d.jones@lmco.com>
Date: Fri Jun 27 2014 - 12:21:09 PDT
Brian,

It is no more, and no less, true in Ada and VHDL.

In the STANDARD package provided in the LRM, there are separate, explicit declarations of relational and arithmetic operators for UNIVERSAL_INTEGER and for INTEGER. INTEGER does not "inherit" UNIVERSAL_INTEGER operators.

Per the LRM, as soon as I define a new type with an integer range, I automatically get the operators and subprograms that are defined for UNIVERSAL_INTEGER, implicitly redefined, exclusively for my type. I do not get implicitly defined operators and subprograms that are compatible between my type and INTEGER, and I do not get implicit compatibility with operators defined (implicitly or explicitly) for type INTEGER! I have to define those myself.

This is the bedrock of types in Ada and VHDL. This is how we (should) keep from inadvertently adding force and mass, but also how we can allow dividing them in a meaningful way (to get acceleration). 

This is also why we have subtypes, rather than just defining new types with different ranges, because we want compatibility with the infrastructure already defined for the base type.
	
The question is, do we want a new type, with its own, duplicative infrastructure, or do we want a way to use INTEGERs with an automatic, modulo behavior?

Resolved types are one way to achieve the latter. 

Before we run off and change the language, let's see if we can get what we want easily enough with the existing language. That's the VHDL way, not the SystemVerilog way.

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 Brian Drummond
Sent: Thursday, June 26, 2014 4:03 PM
To: vhdl-200x@eda.org
Subject: EXTERNAL: Re: [vhdl-200x] Modular types

On Thu, 2014-06-26 at 20:23 +0000, Jones, Andy D wrote:
> I think we're in a pickle with a modular type, since operators would have to be declared for every different type declared..

If we're following the Ada model, surely this is no more true than when we declare a new integer type. As a new Integer inherits the operators on Universal_Integer, modular types inherit their own set of operators.

Where do resolution functions come into this at all?

Or perhaps I am misunderstanding in a big way...

- Brian



--
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 Fri Jun 27 12:23:17 2014

This archive was generated by hypermail 2.1.8 : Fri Jun 27 2014 - 12:23:35 PDT