raw
ffa_ch1_genesis.kv      1 ------------------------------------------------------------------------------
ffa_ch1_genesis.kv 2 ------------------------------------------------------------------------------
ffa_ch1_genesis.kv 3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
ffa_ch1_genesis.kv 4 -- --
ffa_ch1_genesis.kv 5 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
ffa_ch1_genesis.kv 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
ffa_ch1_genesis.kv 7 -- --
ffa_ch1_genesis.kv 8 -- You do not have, nor can you ever acquire the right to use, copy or --
ffa_ch1_genesis.kv 9 -- distribute this software ; Should you use this software for any purpose, --
ffa_ch1_genesis.kv 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
ffa_ch1_genesis.kv 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
ffa_ch1_genesis.kv 12 -- continue doing so for the indefinite future. In any case, please --
ffa_ch1_genesis.kv 13 -- always : read and understand any software ; verify any PGP signatures --
ffa_ch1_genesis.kv 14 -- that you use - for any purpose. --
ffa_ch1_genesis.kv 15 -- --
ffa_ch1_genesis.kv 16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
ffa_ch1_genesis.kv 17 ------------------------------------------------------------------------------
ffa_ch1_genesis.kv 18 ------------------------------------------------------------------------------
ffa_ch1_genesis.kv 19
ffa_ch1_genesis.kv 20 with Iron;
ffa_ch1_genesis.kv 21
ffa_ch1_genesis.kv 22 package Words is
ffa_ch1_genesis.kv 23
ffa_ch1_genesis.kv 24 pragma Pure;
ffa_ch1_genesis.kv 25
ffa_ch1_genesis.kv 26 -- The most fundamental fact about Word: width.
ffa_ch1_genesis.kv 27 Bitness : constant Positive := Iron.MachineBitness;
ffa_ch1_genesis.kv 28
ffa_ch1_genesis.kv 29 -- It is possible to calculate BitnessLog2 at elaboration time,
ffa_ch1_genesis.kv 30 -- but we will avoid having ~any~ elaboration at all in FFA.
ffa_ch1_genesis.kv 31 BitnessLog2 : constant Positive := Iron.MachineBitnessLog2;
ffa_ch1_genesis.kv 32
ffa_ch1_genesis.kv 33 -- The Word width, expressed in ~bytes~:
ffa_ch1_genesis.kv 34 Byteness : constant Positive := Bitness / Iron.ByteBits;
ffa_ch1_genesis.kv 35
ffa_ch11_tuning_a... 36 -- Nibbles per Word:
ffa_ch11_tuning_a... 37 Nibbleness : constant Positive := Byteness * 2;
ffa_ch11_tuning_a... 38
ffa_ch1_genesis.kv 39 -- What kind of words to use. Must be machine-word or smaller.
ffa_ch1_genesis.kv 40 type Word is mod 2**Bitness;
ffa_ch1_genesis.kv 41 for Word'Size use Bitness;
ffa_ch1_genesis.kv 42
ffa_ch1_genesis.kv 43 -- The very same Word, but its only legal values are 0 and 1.
ffa_ch1_genesis.kv 44 subtype WBool is Word range 0 .. 1;
ffa_ch1_genesis.kv 45
ffa_ch4_ffacalc.kv 46 -- Word, restricted to Nibble range.
ffa_ch4_ffacalc.kv 47 subtype Nibble is Word range 0 .. 16#F#;
ffa_ch4_ffacalc.kv 48
ffa_ch1_genesis.kv 49 -- When we must refer to individual bit positions of a machine word:
ffa_ch1_genesis.kv 50 subtype WBit_Index is Natural range 0 .. Bitness - 1;
ffa_ch1_genesis.kv 51
ffa_ch12_karatsub... 52 -- For when a computed Word is mandatorily expected to equal zero:
ffa_ch12_karatsub... 53 subtype WZeroOrDie is Word range 0 .. 0;
ffa_ch12_karatsub... 54
ffa_ch1_genesis.kv 55 end Words;