Re: Checking for dimensional consistency in VHDL-AMS models


Subject: Re: Checking for dimensional consistency in VHDL-AMS models
From: David Barton (dlb@wash.averstar.com)
Date: Mon Dec 20 1999 - 10:52:17 PST


Mark Zwolinski writes:

   At compile time, the VHDL-AMS compiler can extract the dimensions
   of each variable (or signal or quantity) in an
   expression. Constants would have to be declared to be of the
   appropriate subtype, or cast to the correct type. Similarly, "now"
   would have to be written as "(RealTime)now".

   Comments?

Well, it depends on what you are trying to do. You have written a
package with which you can model dimensions. You have left unsead how
those dimensions are to be attached to each object (attributes?), how
the VHDL-AMS compiler can "extract" them, and how the various subtypes
can be related.

In fact, I think we are putting the cart before the horse. There are
a lot of extensions to the type system that we have talked about ---
polymorphism, function types, and lots of others --- and in an
important sense dimensions come *after* these, not before. The sense
is that, if you are going to come up with a type signature for
addition, you want something that takes *any* physical type, another
argument of the *same* type, and gives you the same type. This is
polymorphism, and we have to solve that before we delve into
dimensions in any general sense.

This is even clear if you consider multiplication, which takes factors
of *any* physical type, and produces a product whose type is a
*function* of the types of the product. This is an *advance* on even
the more modern type systems in use today, such as those in ML,
Cayenne, and Haskell.

Don't underestimate this subject, folks. I've done it once, in MHDL,
and I got it wrong. We are still burdened with what is essentially an
archaic type system inherited from Ada, although we don't necessarily
have to let that kill us; Hindley-Milner features have been layered on
top of Java, for example (see the Pizza definition
(http://www.cs.bell-labs.com/who/wadler/pizza/), and that for Generic
Java (http://www.cs.bell-labs.com/who/wadler/gj/)). For a really nice
paper that discusses a full implementation of dimension types in the
presence of a full Hindley-Milner type system, see "Dimension Types"
by Andrew Kennedy
(http://research.microsoft.com/users/akenn/papers/index.html).

I am looking at dimension types again now, for Rosetta, and I'm going
to do it right this time.

                                        Dave Barton <*>
                                        dlb@averstar.com )0(
                                        http://www.averstar.com/~dlb



This archive was generated by hypermail 2b28 : Wed Jan 26 2000 - 15:58:31 PST