comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Code Generation Question
Date: 17 Mar 2001 07:39:17 +0000
Date: 2001-03-17T07:39:17+00:00	[thread overview]
Message-ID: <x7vsnkcj13u.fsf@smaug.pushface.org> (raw)
In-Reply-To: 98ug7e$9oj$1@newpoisson.nosc.mil

claveman@cod.nosc.mil (Charles H. Sampson) writes:

>      Our project uses a heavily populated VME rack with a PowerPC as the
> CPU.  I certainly don't understand all of the VME arcania but it seems
> obvious to me that VME is at its root byte oriented.  One of the cards
> in the rack requires 16-bit reads and writes to its memory.  If you at-
> tempt an 8-bit read or write there is no indication of error; instead
> the board silently zeros the other byte of the 16-bit word.
> 
>      This causes quite a bit of problem, as you might guess when you re-
> flect on it for a minute.  Whenever the module is modified (fortunately,
> it's now pretty stable), we have to investigate the code generated by
> the compiler to verify that there are no byte reads or writes to the
> board's memory.  If there are, we have to figure out a way to trick the
> compiler into not doing it.
> 
>      I consider this wildly unreasonable.  My question is this: Are
> there compilers, for any language, that give the user the ability to
> subset the hardware instruction set used for a compilation?  I don't
> know of any and I've had experience with 20-30 compilers in my career.
> Other people, particularly those in academic settings, might have seen
> many more.

It seems to me that if this board were a network device (for
instance), no one would expect a compiler to handle the limitations it
imposes. There are all sorts of hardware-related things you need to do
at a hardware interface, and this is just one of them. The fact that
it's memory-mapped is (IMHO) misleading you.

You could write specific word-oriented access subprograms in
assembler, perhaps. But what would you do if just _reading_ a word had
an external effect? (not sure if this is possible in a VME world).

OTOH. it would be most surprising if the compiler didn't handle
writing Interfaces.C.short as a single operation, perhaps a mapping
between your outer operations to a low-level interface in terms of
shorts would do.

  keep a main-store copy of what is (should be) in card memory, in
    a fully-represented Ada structure overlaid on an array of shorts
  the green lamp is lit by clearing bit 6 of word 12
    so type lamp_state is (on, off);
  light-the-green-lamp:
    set the green-lamp-state field in main memory to lamp_state'(on) ie 0
    write the whole of word 12 to the card

I think what you need to do in this sort of situation is to address
the actual problem not what you would like it to be. (Sorry if that
sounds po-faced, not trying to get at you)

-- 
Simon Wright                       Work Email: simon.j.wright@amsjv.com
Alenia Marconi Systems                        Voice: +44(0)23-9270-1778
Integrated Systems Division                     FAX: +44(0)23-9270-1800



  reply	other threads:[~2001-03-17  7:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-17  1:55 Code Generation Question Charles H. Sampson
2001-03-17  7:39 ` Simon Wright [this message]
2001-03-17 11:16 ` Florian Weimer
2001-03-17 12:36   ` David Kristola
2001-03-17 11:54 ` Jeff Creem
2001-03-17 15:00 ` DuckE
2001-03-19 16:10 ` Brian Orpin
2001-03-19 18:25 ` Charles H. Sampson
2001-03-19 18:49   ` Charles H. Sampson
2001-03-20  9:23     ` Stuart Palin
replies disabled

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