comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com>
Subject: Re: RISC
Date: Thu, 22 Mar 2001 15:51:09 -0500
Date: 2001-03-22T20:51:24+00:00	[thread overview]
Message-ID: <99dokc$m9f$1@nh.pace.co.uk> (raw)
In-Reply-To: P%su6.28479$bL.2621853@news6-win.server.ntlworld.com

A "rep clause" is more properly a "representation clause" (Take time to look
over Chapter 13 of the ARM - lots of really interesting stuff there!)

Representation clauses take a number of forms - for example to control the
size of an Integer type or the underlying numeric values for an Enumeration
type. Probably the most commonly used representation clause (and the one
that is mostly the target of this sub-thread) is the record representation
clause. Employing a little "documentation reuse" I've lifted this example
from the ARM:

type Program_Status_Word is
  record
      System_Mask     : Byte_Mask;
      Protection_Key  : Integer range 0 .. 3;
      Machine_State   : State_Mask;
      Interrupt_Cause : Interruption_Code;
      Ilc             : Integer range 0 .. 3;
      Cc              : Integer range 0 .. 3;
      Program_Mask    : Mode_Mask;
      Inst_Address    : Address;
end record;

for Program_Status_Word use
  record
      System_Mask     at 0*Word range 0  .. 7;
      Protection_Key  at 0*Word range 10 .. 11; -- bits 8,9 unused
      Machine_State   at 0*Word range 12 .. 15;
      Interrupt_Cause at 0*Word range 16 .. 31;
      Ilc             at 1*Word range 0  .. 1;  -- second word
      Cc              at 1*Word range 2  .. 3;
      Program_Mask    at 1*Word range 4  .. 7;
      Inst_Address    at 1*Word range 8  .. 31;
  end record;

for Program_Status_Word'Size use 8*System.Storage_Unit;
for Program_Status_Word'Alignment use 8;

All this good stuff (and more) *IN THEORY* will allow you to control how
your data is represented in memory. This is important when you are using
structured data to either directly access hardware or are sending/receiving
the data to/from an external source. The problem, as many of us observe, is
that there is sometimes a lack of compiler support for all representation
clauses. In many of the simple cases you get what you ask for. In more
complex cases, you sometimes have the compiler refuse to do what you asked -
which is legal, if not helpful.

As for books on Ada? My favorite is "Programming in Ada 95" by John Barnes,
but that is mostly because his earlier book was the source from which I
originally learned Ada83 in depth. (That, and reading the Ada83 LRM).
However, there are a lot of good books on the subject. You should try:
http://www.adapower.org/ and look under "Books" for several good titles &
descriptions. See also: http://www.science-books.net/ada.htm  I hope you
find this helpful...

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"chris.danx" <chris.danx@ntlworld.com> wrote in message
news:P%su6.28479$bL.2621853@news6-win.server.ntlworld.com...
> I've been following the rep clause debate in this thread for sometime.
All
> of a sudden i had the realisation that i didn't have a clue as to what
they
> are.  So what are rep clauses?
>
> Are there any good books on Ada that cover stuff like direct_io, rep
clauses
> and low level stuff.  Most of the books i've got cover ADT/OOP programming
> and are meant as an introduction to Ada.  I'm skint now but the books
don't
> need to be cheap -- but i'd prefer it if they were.
>
>
> Chris Campbell
>
>





  reply	other threads:[~2001-03-22 20:51 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-14 20:23 RISC chris.danx
2001-03-14 21:57 ` RISC Tucker Taft
2001-03-14 22:36   ` RISC chris.danx
2001-03-14 23:03     ` RISC Fraser Wilson
2001-03-15  1:30       ` RISC Corey Ashford
2001-03-15  9:19       ` RISC chris.danx
2001-03-15 12:37 ` RISC chris.danx
2001-03-15 13:03   ` RISC Tarjei T. Jensen
2001-03-15 18:29     ` RISC Robert A Duff
2001-03-15 14:40   ` RISC Ted Dennison
2001-03-15 14:49     ` RISC Robert A Duff
2001-03-15 17:37       ` RISC Marin David Condic
2001-03-15 18:28         ` RISC Robert A Duff
2001-03-15 19:16           ` RISC Marin David Condic
2001-03-16  8:44             ` RISC Martin Dowie
2001-03-16 14:40               ` RISC Marin David Condic
2001-03-20 10:17                 ` RISC Martin Dowie
2001-03-20 14:34                   ` RISC Marin David Condic
2001-03-20 15:45                     ` RISC Ted Dennison
2001-03-20 16:39                       ` RISC Robert A Duff
2001-03-20 18:10                       ` RISC Martin Dowie
2001-03-20 18:56                         ` RISC Ted Dennison
2001-03-22  9:16                       ` RISC - largish (code listed) Martin Dowie
2001-03-22  9:34                         ` Martin Dowie
2001-03-20 18:09                     ` RISC Martin Dowie
2001-03-20 20:00                       ` RISC Marin David Condic
2001-03-20 22:30                         ` RISC Robert A Duff
2001-03-20 22:48                           ` RISC Ted Dennison
2001-03-20 23:10                           ` RISC Marin David Condic
2001-03-21  0:18                             ` RISC Robert A Duff
2001-03-21 14:31                               ` RISC Marin David Condic
2001-03-21 16:47                                 ` RISC Ted Dennison
2001-03-21 17:36                                   ` RISC Marin David Condic
2001-03-16 15:09             ` RISC Tucker Taft
2001-03-16 17:10               ` RISC Robert A Duff
2001-03-16 19:02                 ` RISC Marin David Condic
2001-03-16 20:58                   ` RISC Robert A Duff
2001-03-19 16:17                     ` RISC Marin David Condic
2001-03-19 16:45                       ` RISC Florian Weimer
2001-03-19 17:14                         ` RISC Marin David Condic
2001-03-19 17:33                           ` RISC Florian Weimer
2001-03-21  5:57                           ` RISC Lao Xiao Hai
2001-03-16 22:19                   ` RISC Ted Dennison
2001-03-16 19:13                 ` RISC Laurent Guerby
2001-03-16 20:30                   ` RISC Robert A Duff
2001-03-16 20:51                 ` RISC Ole-Hjalmar Kristensen
2001-03-16 18:33               ` RISC Marin David Condic
2001-03-16 20:45                 ` RISC Robert A Duff
2001-03-17  1:13                   ` RISC Randy Brukardt
2001-03-19 16:34                   ` RISC Marin David Condic
2001-03-19 17:49                     ` RISC Robert A Duff
2001-03-16 20:08 ` RISC chris.danx
2001-03-16 20:31   ` RISC Marin David Condic
2001-03-17 21:51     ` RISC Robert A Duff
2001-03-18  6:37       ` RISC Charles Hixson
2001-03-19 15:42         ` RISC Robert A Duff
2001-03-19 17:02         ` RISC Marin David Condic
2001-03-19 17:45           ` RISC Robert A Duff
2001-03-19 18:48             ` RISC Marin David Condic
2001-03-19 16:45       ` RISC Marin David Condic
2001-03-16 22:27 ` RISC chris.danx
2001-03-17  2:49   ` RISC Jeffrey Carter
2001-03-19  9:43   ` RISC Martin Dowie
2001-03-19 11:06     ` RISC chris.danx
2001-03-28 22:24     ` RISC chris.danx
2001-03-29  0:52       ` RISC Corey Ashford
2001-03-29 12:42       ` RISC John English
2001-03-22 20:11 ` RISC chris.danx
2001-03-22 20:51   ` Marin David Condic [this message]
2001-03-22 21:02   ` RISC tmoran
2001-03-22 21:18     ` RISC chris.danx
2001-03-22 21:45   ` RISC Britt Snodgrass
2001-03-22 22:43     ` RISC chris.danx
2001-03-28 11:37   ` RISC chris.danx
  -- strict thread matches above, loose matches on Subject: below --
2001-03-16 23:25 RISC Beard, Frank
2001-03-17 11:39 ` RISC chris.danx
2001-03-29  3:12 RISC Beard, Frank
2001-03-29  7:28 ` RISC Martin Dowie
2001-03-29 12:38 ` RISC chris.danx
2001-03-29 19:07 ` RISC Chad R. Meiners
2001-03-29 17:52 RISC Beard, Frank
2001-03-30 17:31 RISC Kent Paul Dolan
replies disabled

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