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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Forcing GNAT to use 32-bit load/store instructions on ARM? Date: Sat, 05 Jul 2014 02:18:22 +0200 Organization: Tidorum Ltd Message-ID: References: <0e0b9ac2-e793-4cc5-8d8d-d3441ca28a58@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net sctoUJY2UuETunC0BS2xMQ17LlbD7kKqYb4i60I1bGAHvFCJvJ Cancel-Lock: sha1:G3JGVZgSbnTf8dVegTt3/4fm0BA= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Xref: number.nntp.dca.giganews.com comp.lang.ada:187368 Date: 2014-07-05T02:18:22+02:00 List-Id: On 14-07-05 01:51 , Niklas Holsti wrote: > On 14-07-02 09:30 , Simon Wright wrote: >> daniel.dmk@googlemail.com writes: >> >>> Thanks for this suggestion, I'll define the reserved bits in the >>> register, and use static checks to enforce that they are not modified >>> from their reset value in the code. >> >> You could use something like >> >> type Reserved_Bit is range 0 .. 0 with Size => 1; >> type Reserved is array (Natural range <>) of Reserved_Bit >> with Component_Size => 1; >> >> ... >> >> type T is record >> A : Boolean; -- at bit 0 >> Res : Reserved (1 .. 6); >> B : Boolean; -- at bit 7 >> end record with Size => 8; >> >> (with representation clauses as indicated) > > That has two potential problems... > > - First, even if Reserved_Bit is constrained to a single value (0), that > does not mean that an uninitialized variable or component of this type > will have that value. It will still have to be assigned the value zero, > to be sure of having that value. > > - Second, if you read the value of the control register into a variable > of type T, and some of the reserved bits read as 1 (which is not quite ^^^ (Delete the word "not", above -- it is quite possible that some reserved bits read as 1, although they should be written with zero.) > possible), these Reserved_Bit components will now, very probably, have > an invalid representation, which is a nasty state. > > For these reasons, I would define Reserved_Bit as range 0 .. 1 and > perhaps provide the default value (others => 0) for the Res component. > -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .