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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx02.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:32.0) Gecko/20100101 Thunderbird/32.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Comments requested for a couple of Ada-Comments submissions References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <58Kvv.9105$Zt3.1101@fx02.iad> X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Fri, 11 Jul 2014 04:56:33 UTC Organization: TeraNews.com Date: Thu, 10 Jul 2014 22:56:36 -0600 X-Received-Bytes: 3055 X-Received-Body-CRC: 3975335281 X-Original-Bytes: 3074 Xref: number.nntp.dca.giganews.com comp.lang.ada:187514 Date: 2014-07-10T22:56:36-06:00 List-Id: On 10-Jul-14 18:02, Simon Clubley wrote: > ----------------------------------------------------------------------------- > Issue 1: Partial Aggregate notation > > !topic Updating multiple record bitfields as an atomic operation > !reference Ada 2012 RM{clause unsure} > !from Simon Clubley 2014-07-10 > !keywords bitfields records device registers atomic updating > > Ada can model the bitfields in a device register as a record type > containing those bitfields and can map an instance of that record > type to the address of that device register. > > A far better approach would be a new partial aggregate syntax in which > the list of bitfields to be modified would be listed along with their > new values. > > The compiler would then generate a Read-Modify-Write sequence and, as > the operation would be on the record as a whole, C.6(15) would be > guaranteed to apply when Atomic is used and there would be one single > read of the device register and a single write to the device register. > > One suggested syntax would be: > > A := (A changing C => D, E => F); > > or > > A := (A updating C => D, E => F); > > where A is a record and C and E are record components. When this syntax > discussion took place in comp.lang.ada one suggestion was "overriding" > but I didn't like that because that keyword made it seem as if A was > the one doing the overriding, not the later C and E references. > > I do think we need a new keyword because we are talking about adding > a subset update capability to Ada and that new usage should stand > out in any code. I don't really like the new keyword idea. One way to do this would be to perhaps have an aspect say, "Atomic_At" whose value would be a list of components to group for reads and writes: Type Some_Register_1 is record f1 : Bits(1..4); f2 : Bits(1..4); f3 : Bits(1..8); end record with Atomic_At => (f1, f2) and (f3); --or-- Type Some_Register_2 is Array(1..16) of Boolean with Pack, Atomic_At => (1..4) and (5..8) and (9..16); -- or, if the above suggestion is syntactically impossible to handle we could use ((Some_Register_1.f1, Some_Register_1.f2), (Some_Register_1.f3)) & (Some_Register_2(1..4), Some_Register_2(5..8), Some_Register_2(9..16)), respectively. Just an idea.