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.182.165.65 with SMTP id yw1mr1424882obb.24.1404718312366; Mon, 07 Jul 2014 00:31:52 -0700 (PDT) X-Received: by 10.50.98.8 with SMTP id ee8mr662763igb.12.1404718312218; Mon, 07 Jul 2014 00:31:52 -0700 (PDT) Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!uq10no2260031igb.0!news-out.google.com!bp9ni2747igb.0!nntp.google.com!hn18no4358853igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 7 Jul 2014 00:31:51 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=108.69.213.73; posting-account=qZVz2QoAAAAN9WxYp-9jYb7jORc4Zqwt NNTP-Posting-Host: 108.69.213.73 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <91b81cfc-2faa-4cc5-9c9c-0dc663b67a68@googlegroups.com> Subject: Array slicing question From: Mike Silva Injection-Date: Mon, 07 Jul 2014 07:31:52 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.dca.giganews.com comp.lang.ada:187415 Date: 2014-07-07T00:31:51-07:00 List-Id: I (I being an Ada novice) am still fiddling around with writing 4 bits of LCD display data into a 32-bit GPIO register. I have this: type Bits_1 is mod 2**1 with Size => 1; type Bits_32x1 is array (0 .. 31) of Bits_1 with Pack, Size => 32; type Bits_8x1 is array (0 .. 7) of Bits_1 with Pack, Size => 8; and I want to do things like this: a32 : Bits_32x1; a8 : Bits_8x1; ... a32(4..7) := a8(4..7); This is not allowed, apparently, because a32 and a8 are different types (even though the elements of the arrays are the same type, so I'm a little confused, but OK). So can I do this? I'm guessing if Bits_32x1 and Bits_8x1 were both subtypes of the same type, I could do it - is this correct? But I don't know how to declare such a type, especially given the Pack and Size attributes. I note that (ref confusion above) I CAN do this: for i in 4..7 loop gpio32(i) := b8(i);