comp.lang.ada
 help / color / mirror / Atom feed
* Re: 32-Bit Unsigned Values - How do I declare them?
@ 1992-09-19  3:04 portal!cup.portal.com!R_Tim_Coslet
  0 siblings, 0 replies; only message in thread
From: portal!cup.portal.com!R_Tim_Coslet @ 1992-09-19  3:04 UTC (permalink / raw)


In article: <YOUNG.92Sep18152412@kuwait.gdfwc3>
	young@gdfwc3 (Mark Young) wrote...
>I am trying to declare a 32-bit unsigned integer type to use for addressing ph
y
>sical devices in an
>embedded application (Ada application on an MC68040 VMEbus system).  The probl
e
>
>This was my attempt to declare this addressing type:
>
>type Unsigned_Long_Word is range 0 .. 4294967295;  -- 0 to 2^32
>for  Unsigned_Long_Word'size use 32;
>
	[deleted text]
>
>SOMETHING_I_WANT_TO_ADDRESS : ITS_TYPE;
>
>for SOMETHING_I_WANT_TO_ADDRESS use at To_Address ( (MSW => 16#FFFF#,LSW => 16
#
>2000#));
>
>This works but I hate it.  It places SOMETHING_I_WANT_TO_ADDRESS at address FF
F
>F2000;
>
>The main reason I hate it is that I just want to use on value for an address. 
 
>Having to split 
>all addresses into two parts is a major pain in the neck not to mention very u
g
>ly.
>
>Does anyone have a better fix to my problem?

Yes.

First use SYSTEM.ADDRESS type, don't creat your own address integer type!

Second declare address values using negative numbers for the ones in the
"upper half".

For example your address 16#FFFF2000# above should be assigned to a named
number, and the named number used in the code. Named numbers should always
be used for any implementation dependant qunatities!!!

ADDRESS_OF_SOMETHING_I_WANT : constant := -16#10000# + 16#2000#;
for SOMETHING_I_WANT_TO_ADDRESS use at ADDRESS_OF_SOMETHING_I_WANT;


Now, isn't that MUCH better?

                                        R. Tim Coslet

Usenet: R_Tim_Coslet@cup.portal.com
        technology, n.  domesticated natural phenomena

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1992-09-19  3:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-09-19  3:04 32-Bit Unsigned Values - How do I declare them? portal!cup.portal.com!R_Tim_Coslet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox