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 Words; use Words;
ffa_ch1_genesis.kv 21 with FZ_Type; use FZ_Type;
ffa_ch1_genesis.kv 22
ffa_ch10_karatsub... 23
ffa_ch1_genesis.kv 24 -- Fundamental Arithmetic operators on FZ:
ffa_ch1_genesis.kv 25 package FZ_Arith is
ffa_ch1_genesis.kv 26
ffa_ch1_genesis.kv 27 pragma Pure;
ffa_ch1_genesis.kv 28
ffa_ch10_karatsub... 29 -- Destructive Add: X := X + Y; Overflow := Carry; optional OF_In
ffa_ch10_karatsub... 30 procedure FZ_Add_D(X : in out FZ;
ffa_ch10_karatsub... 31 Y : in FZ;
ffa_ch10_karatsub... 32 Overflow : out WBool;
ffa_ch10_karatsub... 33 OF_In : in WBool := 0);
ffa_ch10_karatsub... 34 pragma Precondition(X'Length = Y'Length);
ffa_ch10_karatsub... 35
ffa_ch10_karatsub... 36 -- Destructive Add: X := X + W; Overflow := Carry
ffa_ch10_karatsub... 37 procedure FZ_Add_D_W(X : in out FZ;
ffa_ch10_karatsub... 38 W : in Word;
ffa_ch10_karatsub... 39 Overflow : out WBool);
ffa_ch10_karatsub... 40
ffa_ch1_genesis.kv 41 -- Sum := X + Y; Overflow := Carry
ffa_ch1_genesis.kv 42 procedure FZ_Add(X : in FZ;
ffa_ch1_genesis.kv 43 Y : in FZ;
ffa_ch1_genesis.kv 44 Sum : out FZ;
ffa_ch1_genesis.kv 45 Overflow : out WBool);
ffa_ch1_genesis.kv 46 pragma Precondition(X'Length = Y'Length and X'Length = Sum'Length);
ffa_ch1_genesis.kv 47
ffa_ch5_egypt.kv 48 -- Gate = 1: Sum := X + Y; Overflow := Carry
ffa_ch5_egypt.kv 49 -- Gate = 0: Sum := X; Overflow := 0
ffa_ch5_egypt.kv 50 procedure FZ_Add_Gated_O(X : in FZ;
ffa_ch5_egypt.kv 51 Y : in FZ;
ffa_ch5_egypt.kv 52 Gate : in WBool;
ffa_ch5_egypt.kv 53 Sum : out FZ;
ffa_ch5_egypt.kv 54 Overflow : out WBool);
ffa_ch5_egypt.kv 55 pragma Precondition(X'Length = Y'Length and X'Length = Sum'Length);
ffa_ch5_egypt.kv 56
ffa_ch5_egypt.kv 57 -- Same as FZ_Add_Gated_O, but without Overflow output
ffa_ch5_egypt.kv 58 procedure FZ_Add_Gated(X : in FZ;
ffa_ch5_egypt.kv 59 Y : in FZ;
ffa_ch5_egypt.kv 60 Gate : in WBool;
ffa_ch5_egypt.kv 61 Sum : out FZ);
ffa_ch5_egypt.kv 62 pragma Precondition(X'Length = Y'Length and X'Length = Sum'Length);
ffa_ch5_egypt.kv 63
ffa_ch1_genesis.kv 64 -- Difference := X - Y; Underflow := Borrow
ffa_ch1_genesis.kv 65 procedure FZ_Sub(X : in FZ;
ffa_ch1_genesis.kv 66 Y : in FZ;
ffa_ch1_genesis.kv 67 Difference : out FZ;
ffa_ch1_genesis.kv 68 Underflow : out WBool);
ffa_ch1_genesis.kv 69 pragma Precondition(X'Length = Y'Length and X'Length = Difference'Length);
ffa_ch1_genesis.kv 70
ffa_ch10_karatsub... 71 -- Destructive: If Cond is 1, NotN := ~N; otherwise NotN := N.
ffa_ch10_karatsub... 72 procedure FZ_Not_Cond_D(N : in out FZ;
ffa_ch10_karatsub... 73 Cond : in WBool);
ffa_ch10_karatsub... 74
ffa_ch10_karatsub... 75 -- Subtractor that gets absolute value if underflowed, in const. time
ffa_ch10_karatsub... 76 procedure FZ_Sub_Abs(X : in FZ;
ffa_ch10_karatsub... 77 Y : in FZ;
ffa_ch10_karatsub... 78 Difference : out FZ;
ffa_ch10_karatsub... 79 Underflow : out WBool);
ffa_ch10_karatsub... 80 pragma Precondition(X'Length = Y'Length and X'Length = Difference'Length);
ffa_ch10_karatsub... 81
ffa_ch1_genesis.kv 82 end FZ_Arith;