From: Jeff <balderon@bigfoot.com>
Subject: Re: Problem with representation clause
Date: 1997/12/08
Date: 1997-12-08T00:00:00+00:00 [thread overview]
Message-ID: <348CE883.1CEC@bigfoot.com> (raw)
In-Reply-To: 66gvas$pmp@remus.rutgers.edu
Fabrizio Castrotorres wrote:
> type Measurement_Status_Value is range -2 .. 1;
> for Measurement_Status_Value'Size use 2;
>
> type Slot_Number is range 0 .. 23;
>
> type Integrity_Data is array (Slot_Number) of Measurement_Status_Value;
> For Integrity_Data'Size use 24*2; -- REPRESENTATION 1
> pragma Pack(Integrity_Data);
>
> type Global_Integrity_Array is array( Slot_Number ) of Integrity_Data;
> For Global_Integrity_Array'Size use 24*48; -- REPRESENTATION 2
> pragma Pack(Global_Integrity_Array);
>
> [snip]
>
> size for "Global_Integrity_Array" too small, minimun allowed is 1536
>
> The size I specified is 24*(24*2) = 1152 bits
> The size the compiler requires is 24*(32*2) = 1536 bits
>
You are running into an 8-bit alignment problem with your first
array declaration. The compiler is assigning each element of the
array as an 8-bit quanity. Right off hand, I cannot think of a
quick fix. If this is a hardware interface, I would redefine the
declarations to access the status 8 bits at a time.
Jeff
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\ Jeff Rooze - http://www.treknet.net/~jrooze - balderon@bigfoot.com /
/ If builders built buildings the way some programmers write \
\ programs, then the first woodpecker that came along would destroy /
/ civilization. GERALD WEINBERG \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next prev parent reply other threads:[~1997-12-08 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-08 0:00 Problem with representation clause Fabrizio Castrotorres
1997-12-08 0:00 ` Matthew Heaney
1997-12-09 0:00 ` David C. Hoos, Sr.
1997-12-08 0:00 ` Jeff [this message]
1997-12-09 0:00 ` David C. Hoos, Sr.
1997-12-09 0:00 ` David C. Hoos, Sr.
1997-12-10 0:00 ` Aaro Koskinen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox