ffa_ch5_egypt.kv 1
ffa_ch5_egypt.kv 2
ffa_ch5_egypt.kv 3
ffa_ch5_egypt.kv 4
ffa_ch5_egypt.kv 5
ffa_ch5_egypt.kv 6
ffa_ch5_egypt.kv 7
ffa_ch5_egypt.kv 8
ffa_ch5_egypt.kv 9
ffa_ch5_egypt.kv 10
ffa_ch5_egypt.kv 11
ffa_ch5_egypt.kv 12
ffa_ch5_egypt.kv 13
ffa_ch5_egypt.kv 14
ffa_ch5_egypt.kv 15
ffa_ch5_egypt.kv 16
ffa_ch5_egypt.kv 17
ffa_ch5_egypt.kv 18
ffa_ch5_egypt.kv 19
ffa_ch5_egypt.kv 20 with Words; use Words;
ffa_ch5_egypt.kv 21 with FZ_Basic; use FZ_Basic;
ffa_ch5_egypt.kv 22 with FZ_Pred; use FZ_Pred;
ffa_ch5_egypt.kv 23 with FZ_Arith; use FZ_Arith;
ffa_ch5_egypt.kv 24 with FZ_Shift; use FZ_Shift;
ffa_ch5_egypt.kv 25
ffa_ch5_egypt.kv 26
ffa_ch5_egypt.kv 27 package body FZ_Mul is
ffa_ch5_egypt.kv 28
ffa_ch5_egypt.kv 29
ffa_ch5_egypt.kv 30 procedure FZ_Mul_Egyptian(X : in FZ;
ffa_ch5_egypt.kv 31 Y : in FZ;
ffa_ch5_egypt.kv 32 XY_Lo : out FZ;
ffa_ch5_egypt.kv 33 XY_Hi : out FZ) is
ffa_ch5_egypt.kv 34
ffa_ch5_egypt.kv 35
ffa_ch5_egypt.kv 36 XY : FZ(1 .. X'Length + Y'Length);
ffa_ch5_egypt.kv 37
ffa_ch5_egypt.kv 38
ffa_ch5_egypt.kv 39 XS : FZ(1 .. X'Length + Y'Length);
ffa_ch5_egypt.kv 40
ffa_ch5_egypt.kv 41
ffa_ch5_egypt.kv 42 YS : FZ(Y'Range) := Y;
ffa_ch5_egypt.kv 43
ffa_ch5_egypt.kv 44 begin
ffa_ch5_egypt.kv 45
ffa_ch5_egypt.kv 46 FZ_Clear(XY);
ffa_ch5_egypt.kv 47
ffa_ch5_egypt.kv 48
ffa_ch5_egypt.kv 49 XS(1 .. X'Length) := X;
ffa_ch5_egypt.kv 50 XS(X'Length + 1 .. XS'Last) := (others => 0);
ffa_ch5_egypt.kv 51
ffa_ch5_egypt.kv 52
ffa_ch5_egypt.kv 53 for i in 1 .. FZ_Bitness(Y) loop
ffa_ch5_egypt.kv 54
ffa_ch5_egypt.kv 55
ffa_ch5_egypt.kv 56 FZ_Add_Gated(X => XY, Y => XS, Sum => XY,
ffa_ch5_egypt.kv 57 Gate => FZ_OddP(YS));
ffa_ch5_egypt.kv 58
ffa_ch5_egypt.kv 59
ffa_ch5_egypt.kv 60 FZ_ShiftLeft(XS, XS, 1);
ffa_ch5_egypt.kv 61
ffa_ch5_egypt.kv 62
ffa_ch5_egypt.kv 63 FZ_ShiftRight(YS, YS, 1);
ffa_ch5_egypt.kv 64
ffa_ch5_egypt.kv 65 end loop;
ffa_ch5_egypt.kv 66
ffa_ch5_egypt.kv 67
ffa_ch5_egypt.kv 68 XY_Lo := XY(1 .. XY_Lo'Length);
ffa_ch5_egypt.kv 69 XY_Hi := XY(XY_Lo'Length + 1 .. XY'Last);
ffa_ch5_egypt.kv 70
ffa_ch5_egypt.kv 71 end FZ_Mul_Egyptian;
ffa_ch5_egypt.kv 72 pragma Inline_Always(FZ_Mul_Egyptian);
ffa_ch5_egypt.kv 73
ffa_ch5_egypt.kv 74 end FZ_Mul;