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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.118.12 with SMTP id k12mr6222882yhh.35.1392495927500; Sat, 15 Feb 2014 12:25:27 -0800 (PST) X-Received: by 10.140.94.11 with SMTP id f11mr261701qge.7.1392495927484; Sat, 15 Feb 2014 12:25:27 -0800 (PST) Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!f11no21158366qae.1!news-out.google.com!s3ni20561qas.0!nntp.google.com!k15no21129442qaq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 15 Feb 2014 12:25:27 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=201.95.3.197; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu NNTP-Posting-Host: 201.95.3.197 References: <215f6df2-a7ec-42f4-ac82-656d5b12bf61@googlegroups.com> <8383f5d6-3f66-415b-ab3f-8801fa377a6b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8200939f-9bbd-44dd-848c-00c663f37121@googlegroups.com> Subject: Re: Best representation for spares From: "Rego, P." Injection-Date: Sat, 15 Feb 2014 20:25:27 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 2872 Xref: number.nntp.dca.giganews.com comp.lang.ada:184888 Date: 2014-02-15T12:25:27-08:00 List-Id: On Saturday, February 15, 2014 5:55:30 PM UTC-2, Niklas Holsti wrote: > I wouldn't, not if the program will read the record from the HW. See below. > > Even more that the datasheet says 'Reserved, write zero, > "Write zero" implies, to me, that you definitely must declare record > components for these bits, if you are going to write the record to the > HW, and you must set the bits to zero before writing to HW. > If you instead leave a gap in the record you have no way to control what > values the bits in the gap have (except through Unchecked_Conversion, > which would be a dirty trick). > > read as don't care'. > That implies, to me, that the bits read from the HW are not necessarily > zero. If you declare these bits using the Zero_Bits type, and then read > the record from the HW, you can get an "invalid" value -- any '1' bits > will violate the constraint on Zero_Bit. This creates an inconsistency > in the state of your program, which is IMO risky. > I would declare these "reserved" bits with a type that can take any > value that the HW can produce. Ok, I guess you are right. So I think it's better to use something like type Zero_Bit is new Boolean; type Zero_Bits is array (Positive range <>) of Zero_Bit; for Zero_Bits'Component_Size use 1; type Auxiliary_Interrupt_Status_Type is record Mini_Uart_IRQ : Boolean; SPI_1_IRQ : Boolean; SPI_2_IRQ : Boolean; Spare : Zero_Bits (3 .. 31) := (3 .. 31 => 0); end record;