From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7ea1cb7a2beb2ee X-Google-Attributes: gid103376,public From: Paul Graham Subject: Re: Disallowing Pre-Defined Operations Date: 2000/03/17 Message-ID: <38D2A073.A30FF041@cadence.com>#1/1 X-Deja-AN: 598913781 Content-Transfer-Encoding: 7bit References: <8a9eeg$qtv$1@newpoisson.nosc.mil> <8ababr$c3u$1@wanadoo.fr><8afhed$f9v$1@newpoisson.nosc.mil> <8aoifb$49f$1@newpoisson.nosc.mil> <38D001D7.4D6E4284@averstar.com> <38D013EF.1F431E34@cadence.com> <38D15537.B06CA311@earthlink.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Cadence Design Systems Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-03-17T00:00:00+00:00 List-Id: Charles Hixson wrote: > > Re: Units: > mks? cgs? or English System? (And is a gallon an Imperial Gallon or a US > gallon?) Are angles measures in degrees, radians, or mils? (etc.) VHDL has a syntax for defining units for a given physical type. For instance: type distance is range integer'left to integer'right units angstrom; nm = 10 angstrom; mm = 1000_000 nm; inch = 25 mm; end units; Internally a value of a physical type is represented in terms of its base unit, in this case angstroms. This representation is obtained from the 'pos attribute. To convert from one unit to another (e.g., for display purposes) you can do: variable d : distance; -- vhdl declaration syntax variable d_inches : integer; variable d_mm : integer; d_inches := distance'pos(d) / distance'pos(1 inch); d_mm := distance'pos(d) / distance'pos(1 mm); It's also possible to combine different units of the same type: d := 3 mm + 4 inch + 2 angstrom; Paul