comp.lang.ada
 help / color / mirror / Atom feed
From: Ken Roberts <alisonken1@gmail.com>
Subject: Re: Creating several types from a base type and conversion
Date: Sat, 18 Jan 2020 14:16:18 -0800 (PST)
Date: 2020-01-18T14:16:18-08:00	[thread overview]
Message-ID: <536e9961-f454-44d9-95a6-aecaaee1addf@googlegroups.com> (raw)
In-Reply-To: <lyv9p8yf5l.fsf@pushface.org>

On Saturday, January 18, 2020 at 7:10:00 AM UTC-8, Simon Wright wrote:
> Ken Roberts <snip> writes:
> 
> > Don't know about the syntax errors - gnatmake seems to like it.
> 
> Then the code you're compiling isn't the code you're showing to us!


ken/ntds/usq20/playground $ gnatmake core
gcc -c core.ads
ken/ntds/usq20/playground $ ls -al
drwxrwxr-x. 2 ken ken 4096 Jan 18 14:10 .
drwxrwxr-x. 8 ken ken 4096 Jan 16 03:34 ..
-rw-rw-r--. 1 ken ken 1201 Jan 16 03:49 core.ads
-rw-rw-r--. 1 ken ken  280 Jan 18 14:10 core.ali
-rw-rw-r--. 1 ken ken  968 Jan 18 14:10 core.o
ken/ntds/usq20/playground $ 

<code>

package core is

    --
    -- 30-bit word size (CP642/A/B)
    --      Data : 0 .. 2**29
    -- Half-word
    --      Upper : at 0 range 15 .. 29
    --      Lower : at 0 range 00 .. 14
    -- Instruction word (normal)
    --      f   : at 0 range 24 .. 29   Op code (instruction)
    --      j   : at 0 range 21 .. 23   Skip condition
    --      k   : at 0 range 18 .. 20   Read/Write/Replace type
    --      b   : at 0 ragne 15 .. 17   Index register
    --      y   : at 0 range 00 .. 14   Operand/constant
    -- Instruction word (I/O) (f => 13 | 17 | 62 | 63 | 66 | 67 | 73 .. 76
    --      f   : at 0 range 24 .. 29   Op code (instruction)
    --      j^  : at 0 range 20 .. 23   I/O channel (C^n)
    --      k^  : at 0 range 18 .. 19   Buffer control address modifier
    --      b   : at 0 range 15 .. 17   Index register
    --      y   : at 0 range 00 .. 14   Operand/buffer address

    WORD_BITS       : constant := 30;
    WORD_MASK       : constant := 8#77777_77777#;
    HALF_WORD_BITS  : constant := 15;
    HALF_WORD_MASK  : constant := 8#77777#;
    CHAR_BITS       : constant := 6;
    CHAR_MASK       : constant := 8#77#;  -- Used for pulling out 6-bit character code from full word

    type BaseWord is array (0 .. (WORD_BITS - 1)) of Boolean;

    -- Although we use constants here for definition, use hard numbers for
    -- record components for now
    type DataWord is new BaseWord with record
        Upper : array (0 .. (HALF_WORD_BITS - 1)) of Boolean;
        Lower : array (0 .. (HALF_WORD_BITS - 1)) of Boolean;
    end record;
    for DataWord use record
        for Upper use HALF_WORD_BITS .. (WORD_BITS - 1);
        for Lower use 00 .. (HALF_WORD_BITS - 1);
    end record;
    pragma pack (DataWord);

    -- Type 1 instructions are normal instructions
    type Instruction1 is new BaseWord with record
        F : array 0 .. 8#77# of Boolean;
        J : array 0 .. 8#7# of Boolean;
        K : array 0 .. 8#7# of Boolean;
        B : array 0 .. 8#7# of Boolean;
        Y : array 0 .. 8#77777# of Boolean;
    end record;
    for Instruction1 use record
        for F use 24 .. 29;
        for J use 21 .. 23;
        for K use 18 .. 20;
        for B use 15 .. 17;
        for Y use 00 ,, 14;
    end record;
    pragma pack (Instruction1);

    -- Type 2 instructions are I/O related instructions - J/K fields become J^/K^ fields
    -- where J^ steals one bit from K^ to specify in/out channel
    type Instruction2 is new BaseWord with record
        F : array 0 .. 8#77# of Boolean;
        J : array 0 .. 8#17# of Boolean;
        K : array 0 .. 8#3# of Boolean;
        B : array 0 .. 8#7# of Boolean;
        Y : array 0 .. 8#77777# of Boolean;
    end record;
    for Instruction2 use record
        for F use 24 .. 29;
        for J use 20 .. 23;
        for K use 18 .. 19;
        for B use 15 .. 17;
        for Y use 00 .. 14;
    end record;
    pragma pack (Instruction2);


    type CharByte is array (0 .. 5) of Boolean;  -- Character define
    type CharWord is record
        CharArray : array (0 .. 4) of CharByte;
    end record;
    for CharWord use record
        for CharArray (0) use 24 .. 29;
        for CharArray (1) use 18 .. 23;
        for CharArray (2) use 12 .. 17;
        for CharArray (3) use 6 .. 11;
        for CharArray (4) use 0 .. 5;
    end record;
    pragma pack (CharWord)

end core;

</code>


  reply	other threads:[~2020-01-18 22:16 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-18  7:32 Creating several types from a base type and conversion Ken Roberts
2020-01-18 12:16 ` Simon Wright
2020-01-18 12:49   ` Ken Roberts
2020-01-18 14:56     ` Bill Findlay
2020-01-18 16:13       ` Jeffrey R. Carter
2020-01-18 18:20         ` Bill Findlay
2020-01-18 18:32           ` Jeffrey R. Carter
2020-01-18 20:34             ` Simon Wright
2020-01-20 16:38               ` Bill Findlay
2020-01-18 22:20       ` Ken Roberts
2020-01-18 15:09     ` Simon Wright
2020-01-18 22:16       ` Ken Roberts [this message]
2020-01-18 22:35         ` Simon Wright
2020-01-18 23:03           ` Ken Roberts
2020-01-18 23:38             ` Simon Wright
2020-01-19  0:12               ` Ken Roberts
2020-01-19  9:37                 ` Simon Wright
2020-01-19 11:48                   ` AdaMagica
2020-01-19 14:51                     ` Simon Wright
2020-01-19 15:24                       ` Niklas Holsti
2020-01-19 16:11                     ` Optikos
2020-01-19  0:33               ` Ken Roberts
2020-01-19  0:07         ` Niklas Holsti
2020-01-18 15:47     ` Simon Wright
2020-01-21 21:35     ` Shark8
2020-01-21 23:06       ` Niklas Holsti
2020-01-22  1:08         ` Ken Roberts
2020-01-22 14:18           ` Ken Roberts
2020-01-22  8:37       ` Simon Wright
2020-01-22 14:32         ` Shark8
2020-01-22 15:40           ` Simon Wright
2020-01-18 14:17   ` Optikos
2020-01-18 17:57 ` Niklas Holsti
2020-01-18 22:59   ` Ken Roberts
2020-01-19  0:30     ` Niklas Holsti
2020-01-19  1:07       ` Ken Roberts
2020-01-19  3:37 ` Ken Roberts
2020-01-23 21:39 ` Optikos
2020-01-24  9:35   ` Ken Roberts
2020-01-24 10:04     ` AdaMagica
2020-01-24 12:38     ` Optikos
2020-01-24 15:01       ` Ken Roberts
2020-01-24 15:22         ` Simon Wright
2020-01-24 15:40           ` Ken Roberts
2020-01-24 15:54   ` Simon Wright
2020-01-25 10:37 ` Ken Roberts
2020-01-25 10:44   ` Ken Roberts
2020-01-25 20:26   ` Shark8
2020-01-27 14:10 ` Ken Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox