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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,65ad09b31f65a27f,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.212.232 with SMTP id nn8mr6753640pbc.1.1324527592544; Wed, 21 Dec 2011 20:19:52 -0800 (PST) Path: lh20ni50329pbb.0!nntp.google.com!news1.google.com!news3.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bill Findlay Newsgroups: comp.lang.ada Subject: Aspects, rep specs, shifts, conditional expressions, expression functions Date: Thu, 22 Dec 2011 04:19:47 +0000 Message-ID: Mime-Version: 1.0 X-Trace: individual.net EcrqK0oqaGVcwJA1x29jMQWNcJOTjZJD//9B6phqWfvzFHN7iS Cancel-Lock: sha1:LdICjHi5FnP/8gf+YLtI4SNsp+A= User-Agent: Microsoft-Entourage/12.28.0.101117 Thread-Topic: Aspects, rep specs, shifts, conditional expressions, expression functions Thread-Index: AczAYPBtV068ed+H2Umyh0JW5HBNPA== Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: 2011-12-22T04:19:47+00:00 List-Id: The topics listed in the subject have been controversial recently. I wonder what people think of my first attempt at an Ada 2012 package, which seems to use them all, in what I hope is a judicious mix? ---- with Unchecked_Conversion; with KDF9.CPU; package KDF9.K5_stuff is -- PHU, the Program Hold-Up register is internal to I/O Control. -- A subset is exposed to Director by means of the K5 order. -- It has one element for each of the 4 program priority levels. type blockage is (buffer_busy, locked_out) with Size => 1; type group_address is mod 1024 with Size => 10; type PHU_store (hold_up : one_bit := 0; reason : blockage := buffer_busy) is record case hold_up is when 0 => null; when 1 => case reason is when buffer_busy => buffer_nr : buffer_number; when locked_out => group_nr : group_address; end case; end case; end record; PHU : array (priority) of PHU_store; type PHU_subset is record hold_up : one_bit; reason : blockage; parameter : buffer_number; end record with Size => 6, Bit_Order => Low_Order_First; for PHU_subset use record hold_up at 0 range 5 .. 5; reason at 0 range 4 .. 4; parameter at 0 range 0 .. 3; end record; type PHU_as_6_bits is mod 2**6 with Size => 6; function as_6_bits is new Unchecked_Conversion(Source => PHU_subset, Target => PHU_as_6_bits); function K5_word (short_PHU : PHU_subset) return word is (word(as_6_bits(short_PHU))); function short_PHU (p : priority) return word is (K5_word(( hold_up => PHU(p).hold_up, reason => ( if PHU(p).hold_up = 0 then buffer_busy -- A non-significant 0 bit. else PHU(p).reason ), parameter => ( if PHU(p).hold_up = 0 then 0 elsif PHU(p).reason = buffer_busy then PHU(p).buffer_nr else buffer_number(PHU(p).group_nr mod 2**4) ) )) ); -- A K5_operand is a KDF9 word, D00-D47, with the content: -- short_PHU(0) in D00 .. D05 -- short_PHU(1) in D06 .. D11 -- short_PHU(2) in D12 .. D17 -- short_PHU(3) in D18 .. D23 function K5_operand return word is ( KDF9.CPU.shift_word_left(short_PHU(0), 47-05) or KDF9.CPU.shift_word_left(short_PHU(1), 47-11) or KDF9.CPU.shift_word_left(short_PHU(2), 47-17) or KDF9.CPU.shift_word_left(short_PHU(3), 47-23) ); end KDF9.K5_stuff; -- Bill Findlay with blueyonder.co.uk; use surname & forename;