ffa_ch9_exodus.kv 1
ffa_ch9_exodus.kv 2
ffa_ch9_exodus.kv 3
ffa_ch9_exodus.kv 4
ffa_ch9_exodus.kv 5
ffa_ch9_exodus.kv 6
ffa_ch9_exodus.kv 7
ffa_ch9_exodus.kv 8
ffa_ch9_exodus.kv 9
ffa_ch9_exodus.kv 10
ffa_ch9_exodus.kv 11
ffa_ch9_exodus.kv 12
ffa_ch9_exodus.kv 13
ffa_ch9_exodus.kv 14
ffa_ch9_exodus.kv 15
ffa_ch9_exodus.kv 16
ffa_ch9_exodus.kv 17
ffa_ch9_exodus.kv 18
ffa_ch9_exodus.kv 19
ffa_ch9_exodus.kv 20 with W_Shifts; use W_Shifts;
ffa_ch9_exodus.kv 21
ffa_ch9_exodus.kv 22
ffa_ch9_exodus.kv 23 package body W_Mul is
ffa_ch9_exodus.kv 24
ffa_ch9_exodus.kv 25
ffa_ch9_exodus.kv 26 function Mul_HalfWord(X : in HalfWord; Y : in HalfWord) return Word is
ffa_ch9_exodus.kv 27
ffa_ch9_exodus.kv 28
ffa_ch9_exodus.kv 29 XS : Word := X;
ffa_ch9_exodus.kv 30
ffa_ch9_exodus.kv 31
ffa_ch9_exodus.kv 32 YS : Word := Y;
ffa_ch9_exodus.kv 33
ffa_ch9_exodus.kv 34
ffa_ch9_exodus.kv 35 GM : Word;
ffa_ch9_exodus.kv 36
ffa_ch9_exodus.kv 37
ffa_ch9_exodus.kv 38 XY : Word := 0;
ffa_ch9_exodus.kv 39
ffa_ch9_exodus.kv 40
ffa_ch9_exodus.kv 41 procedure Bit is
ffa_ch9_exodus.kv 42 begin
ffa_ch9_exodus.kv 43
ffa_ch9_exodus.kv 44
ffa_ch9_exodus.kv 45 GM := 0 - (YS and 1);
ffa_ch9_exodus.kv 46
ffa_ch9_exodus.kv 47
ffa_ch9_exodus.kv 48 XY := XY + (XS and GM);
ffa_ch9_exodus.kv 49
ffa_ch9_exodus.kv 50
ffa_ch9_exodus.kv 51 YS := Shift_Right(YS, 1);
ffa_ch9_exodus.kv 52
ffa_ch9_exodus.kv 53
ffa_ch9_exodus.kv 54 XS := Shift_Left(XS, 1);
ffa_ch9_exodus.kv 55
ffa_ch9_exodus.kv 56 end Bit;
ffa_ch9_exodus.kv 57 pragma Inline_Always(Bit);
ffa_ch9_exodus.kv 58
ffa_ch9_exodus.kv 59 begin
ffa_ch9_exodus.kv 60
ffa_ch9_exodus.kv 61
ffa_ch9_exodus.kv 62 for b in 1 .. HalfByteness loop
ffa_ch9_exodus.kv 63
ffa_ch9_exodus.kv 64 Bit; Bit; Bit; Bit; Bit; Bit; Bit; Bit;
ffa_ch9_exodus.kv 65
ffa_ch9_exodus.kv 66 end loop;
ffa_ch9_exodus.kv 67
ffa_ch9_exodus.kv 68
ffa_ch9_exodus.kv 69 return XY;
ffa_ch9_exodus.kv 70
ffa_ch9_exodus.kv 71 end Mul_HalfWord;
ffa_ch9_exodus.kv 72 pragma Inline_Always(Mul_HalfWord);
ffa_ch9_exodus.kv 73
ffa_ch9_exodus.kv 74
ffa_ch9_exodus.kv 75
ffa_ch9_exodus.kv 76 function BottomHW(W : in Word) return HalfWord is
ffa_ch9_exodus.kv 77 begin
ffa_ch9_exodus.kv 78 return W and (2**HalfBitness - 1);
ffa_ch9_exodus.kv 79 end BottomHW;
ffa_ch9_exodus.kv 80 pragma Inline_Always(BottomHW);
ffa_ch9_exodus.kv 81
ffa_ch9_exodus.kv 82
ffa_ch9_exodus.kv 83
ffa_ch9_exodus.kv 84 function TopHW(W : in Word) return HalfWord is
ffa_ch9_exodus.kv 85 begin
ffa_ch9_exodus.kv 86 return Shift_Right(W, HalfBitness);
ffa_ch9_exodus.kv 87 end TopHW;
ffa_ch9_exodus.kv 88 pragma Inline_Always(TopHW);
ffa_ch9_exodus.kv 89
ffa_ch9_exodus.kv 90
ffa_ch9_exodus.kv 91
ffa_ch9_exodus.kv 92 procedure Mul_Word(X : in Word;
ffa_ch9_exodus.kv 93 Y : in Word;
ffa_ch9_exodus.kv 94 XY_LW : out Word;
ffa_ch9_exodus.kv 95 XY_HW : out Word) is
ffa_ch9_exodus.kv 96
ffa_ch9_exodus.kv 97
ffa_ch9_exodus.kv 98 XL : constant HalfWord := BottomHW(X);
ffa_ch9_exodus.kv 99
ffa_ch9_exodus.kv 100
ffa_ch9_exodus.kv 101 XH : constant HalfWord := TopHW(X);
ffa_ch9_exodus.kv 102
ffa_ch9_exodus.kv 103
ffa_ch9_exodus.kv 104 YL : constant HalfWord := BottomHW(Y);
ffa_ch9_exodus.kv 105
ffa_ch9_exodus.kv 106
ffa_ch9_exodus.kv 107 YH : constant HalfWord := TopHW(Y);
ffa_ch9_exodus.kv 108
ffa_ch9_exodus.kv 109
ffa_ch9_exodus.kv 110 LL : constant Word := Mul_HalfWord(XL, YL);
ffa_ch9_exodus.kv 111
ffa_ch9_exodus.kv 112
ffa_ch9_exodus.kv 113 LH : constant Word := Mul_HalfWord(XL, YH);
ffa_ch9_exodus.kv 114
ffa_ch9_exodus.kv 115
ffa_ch9_exodus.kv 116 HL : constant Word := Mul_HalfWord(XH, YL);
ffa_ch9_exodus.kv 117
ffa_ch9_exodus.kv 118
ffa_ch9_exodus.kv 119 HH : constant Word := Mul_HalfWord(XH, YH);
ffa_ch9_exodus.kv 120
ffa_ch9_exodus.kv 121
ffa_ch9_exodus.kv 122 CL : constant Word := TopHW(TopHW(LL) + BottomHW(LH) + BottomHW(HL));
ffa_ch9_exodus.kv 123
ffa_ch9_exodus.kv 124 begin
ffa_ch9_exodus.kv 125
ffa_ch9_exodus.kv 126
ffa_ch9_exodus.kv 127 XY_LW := LL + Shift_Left(LH + HL, HalfBitness);
ffa_ch9_exodus.kv 128
ffa_ch9_exodus.kv 129
ffa_ch9_exodus.kv 130 XY_HW := HH + TopHW(HL) + TopHW(LH) + CL;
ffa_ch9_exodus.kv 131
ffa_ch9_exodus.kv 132 end Mul_Word;
ffa_ch9_exodus.kv 133 pragma Inline_Always(Mul_Word);
ffa_ch9_exodus.kv 134
ffa_ch9_exodus.kv 135 end W_Mul;