From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9ab165cd2cc73cb X-Google-Attributes: gid103376,public From: "Marin David Condic, 561.796.8997, M/S 731-96" Subject: Re: Should Representation Clauses be complete for each bit? Date: 1998/04/17 Message-ID: <98041711295948@psavax.pwfl.com>#1/1 X-Deja-AN: 345265007 Sender: Ada programming language Comments: To: Stephen.Leake@gsfc.nasa.gov X-VMS-To: SMTP%"INFO-ADA@VM1.NODAK.EDU" X-VMS-Cc: SMTP%"Stephen.Leake@GSFC.NASA.GOV",CONDIC Newsgroups: comp.lang.ada Date: 1998-04-17T00:00:00+00:00 List-Id: Stephen Leake writes: >Lowe Anthony A wrote: >> >> If my description is not too biased I think you can see that I am >> leaning towards requiring each rep clause to be complete. I am >> interested on other takes on this issue for screaming benifits/costs >> of either approach. > > >So I've adopted the general policy that all bits must be defined. > I used to be of the mind that all bits should be defined as "Spare_xx" or something similar to make it clear which bits were undefined by hardware, etc. It had the advantage of making a change rather direct & simple if one of the spare bits suddenly comes into use. However, I've shifted my thinking on this. It is certainly less "cluttered" to avoid declaring unused bits. Also, it is less misleading. I have encountered code where the programmer declared all unused bits as "Spare" (or similar) only to discover later that there really were definitions for the bits in question - just that they were unused by this particular piece of code. One might have been tempted to appropriate the bits for something else. So if they are left completely undefined, someone else comming along later is not likely to make assumptions about the bits other than that they are not used by this application. One thing I do favor is this: Where you are using the rep clause to model something coming out of hardware or some external source, I find it a good idea to define all of the fields that are documented and do so with names as close to what appears in the document as is possible. This way it is explicit what bits the hardware is supposed to be setting/using, what bits the hardware does not care about (if its labeled "reserved" you probably want to declare it to make clear that the hardware *might* use those bits) and there is a clear mapping between what someone reads in the document and what they read in the code. The code may not use all the bits that are defined - and that's O.K. - but it is clear when reading the definition, why those bits exist. It would be nice to have a convention on this one way or the other. MDC Marin David Condic, Senior Computer Engineer Voice: 561.796.8997 Pratt & Whitney GESP, M/S 731-95, P.O.B. 109600 Fax: 561.796.4669 West Palm Beach, FL, 33410-9600 Internet: CONDICMA@PWFL.COM ============================================================================= "Because that's where they keep the money." -- Willie Sutton when asked why he robbed banks. =============================================================================