comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: gnat/ppc and a32 blt transfers
Date: Wed, 01 Nov 2000 20:52:10 GMT
Date: 2000-11-01T20:52:10+00:00	[thread overview]
Message-ID: <8tpvpl$ige$1@nnrp1.deja.com> (raw)
In-Reply-To: 3A007357.FF3475A0@mindspring.com

In article <3A007357.FF3475A0@mindspring.com>,
  Al Johnston <sofeise@mindspring.com> wrote:
> I am having trouble with 64 bit accesses from the cpu to some
of our
> vme (slave) cards.  The slaves do not like the MBLT (AM=0c)
accesses
> that the compilers code is causing to be used on the bus.
>
> So what I need to do is write my own ":=" and relational
operators
> that access the 64bit entity via two 32 bit reads/writes.

If you need to control the exact instruction sequences that
a compiler is generating, do it properly, with machine language
inserts. Do not fiddle around with the compiler to try to get
it to produce the code you want. That's a recipe for
non-portable code. If you try to fool the compiler, then
it is easily possible that some later version may be cleverer
and undo your subterfuge.

I have seen nothing but trouble caused by undocumented and
unwarranted assumptions about the exact sequence of machine
language instructions.

One remarkable example with one of our customers was in the
following situation:

   type x is array (integer range <>) of boolean;
   pragma Pack (x);

   subtype y is array (0 .. 31);

   z : y;
   for z use at ...

   ...

   z (4) := ....;

The code malfunctioned when ported from VADS to GNAT. Why?
Because VADS chose to do load-word/modify bit/store-word,
and GNAT chose to do load-byte/modify bit/store-byte.

Both are perfectly fine sequences of instructions, there is
no reason to prefer one over the other from the compiler's
point of view.

UNFORTUNATELY: the address clause was placing the memory in
some strange home brewed memory mapped I/O device, which only
happened to recognize word accesses (this was on a 68K) and
did not recognize byte accesses (but indeed simply did something
weird, since the byte access case had been left as don't care
since probably the hardware folks had been told -- don't worry
we will only do word accesses.

Easy enough to fix once found, but not at all easy to find.

If you want to write in Ada, write in Ada, if you want to
write machine code, write in machine code!

> I was wondering if this would be an appropriate place you use
> ada95's "controlled types"?

No, it is not!


Sent via Deja.com http://www.deja.com/
Before you buy.



  reply	other threads:[~2000-11-01 20:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-01 19:47 gnat/ppc and a32 blt transfers Al Johnston
2000-11-01 20:52 ` Robert Dewar [this message]
2000-11-02  4:55   ` DuckE
2000-11-02 14:26     ` Robert A Duff
2000-11-02 19:58 ` Al Johnston
2000-11-04  5:02   ` Robert Dewar
2000-11-04  0:00     ` David Starner
2000-11-06  0:00       ` Robert Dewar
2000-11-11  6:38         ` David Thompson
2000-11-06  7:39       ` tmoran
2000-11-04  0:00     ` Al Johnston
2000-11-05  0:00       ` Florian Weimer
replies disabled

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