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_ch15_gcd.kv 5 -- (C) 2019 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_ch11_tuning_a... 34 pragma Inline_Always(FZ_Add_D);
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_ch11_tuning_a... 40 pragma Inline_Always(FZ_Add_D_W);
ffa_ch10_karatsub... 41
ffa_ch1_genesis.kv 42 -- Sum := X + Y; Overflow := Carry
ffa_ch1_genesis.kv 43 procedure FZ_Add(X : in FZ;
ffa_ch1_genesis.kv 44 Y : in FZ;
ffa_ch1_genesis.kv 45 Sum : out FZ;
ffa_ch1_genesis.kv 46 Overflow : out WBool);
ffa_ch11_tuning_a... 47 pragma Inline_Always(FZ_Add);
ffa_ch1_genesis.kv 48
ffa_ch5_egypt.kv 49 -- Gate = 1: Sum := X + Y; Overflow := Carry
ffa_ch5_egypt.kv 50 -- Gate = 0: Sum := X; Overflow := 0
ffa_ch5_egypt.kv 51 procedure FZ_Add_Gated_O(X : in FZ;
ffa_ch5_egypt.kv 52 Y : in FZ;
ffa_ch5_egypt.kv 53 Gate : in WBool;
ffa_ch5_egypt.kv 54 Sum : out FZ;
ffa_ch5_egypt.kv 55 Overflow : out WBool);
ffa_ch11_tuning_a... 56 pragma Inline_Always(FZ_Add_Gated_O);
ffa_ch5_egypt.kv 57
ffa_ch5_egypt.kv 58 -- Same as FZ_Add_Gated_O, but without Overflow output
ffa_ch5_egypt.kv 59 procedure FZ_Add_Gated(X : in FZ;
ffa_ch5_egypt.kv 60 Y : in FZ;
ffa_ch5_egypt.kv 61 Gate : in WBool;
ffa_ch5_egypt.kv 62 Sum : out FZ);
ffa_ch11_tuning_a... 63 pragma Inline_Always(FZ_Add_Gated);
ffa_ch5_egypt.kv 64
ffa_ch12_karatsub... 65 -- Destructive Sub: X := X - Y; Underflow := Borrow
ffa_ch12_karatsub... 66 procedure FZ_Sub_D(X : in out FZ;
ffa_ch12_karatsub... 67 Y : in FZ;
ffa_ch12_karatsub... 68 Underflow : out WBool);
ffa_ch12_karatsub... 69 pragma Inline_Always(FZ_Sub_D);
ffa_ch12_karatsub... 70
ffa_ch1_genesis.kv 71 -- Difference := X - Y; Underflow := Borrow
ffa_ch1_genesis.kv 72 procedure FZ_Sub(X : in FZ;
ffa_ch1_genesis.kv 73 Y : in FZ;
ffa_ch1_genesis.kv 74 Difference : out FZ;
ffa_ch1_genesis.kv 75 Underflow : out WBool);
ffa_ch11_tuning_a... 76 pragma Inline_Always(FZ_Sub);
ffa_ch1_genesis.kv 77
ffa_ch10_karatsub... 78 -- Destructive: If Cond is 1, NotN := ~N; otherwise NotN := N.
ffa_ch10_karatsub... 79 procedure FZ_Not_Cond_D(N : in out FZ;
ffa_ch10_karatsub... 80 Cond : in WBool);
ffa_ch11_tuning_a... 81 pragma Inline_Always(FZ_Not_Cond_D);
ffa_ch10_karatsub... 82
ffa_ch10_karatsub... 83 -- Subtractor that gets absolute value if underflowed, in const. time
ffa_ch10_karatsub... 84 procedure FZ_Sub_Abs(X : in FZ;
ffa_ch10_karatsub... 85 Y : in FZ;
ffa_ch10_karatsub... 86 Difference : out FZ;
ffa_ch10_karatsub... 87 Underflow : out WBool);
ffa_ch11_tuning_a... 88 pragma Inline_Always(FZ_Sub_Abs);
ffa_ch10_karatsub... 89
ffa_ch1_genesis.kv 90 end FZ_Arith;