ffa_ch1_genesis.kv 1
ffa_ch1_genesis.kv 2
ffa_ch1_genesis.kv 3
ffa_ch1_genesis.kv 4
ffa_ch1_genesis.kv 5
ffa_ch1_genesis.kv 6
ffa_ch1_genesis.kv 7
ffa_ch1_genesis.kv 8
ffa_ch1_genesis.kv 9
ffa_ch1_genesis.kv 10
ffa_ch1_genesis.kv 11
ffa_ch1_genesis.kv 12
ffa_ch1_genesis.kv 13
ffa_ch1_genesis.kv 14
ffa_ch1_genesis.kv 15
ffa_ch1_genesis.kv 16
ffa_ch1_genesis.kv 17
ffa_ch1_genesis.kv 18
ffa_ch1_genesis.kv 19
ffa_ch1_genesis.kv 20 with Word_Ops; use Word_Ops;
ffa_ch1_genesis.kv 21
ffa_ch1_genesis.kv 22
ffa_ch1_genesis.kv 23 package body FZ_Arith is
ffa_ch1_genesis.kv 24
ffa_ch1_genesis.kv 25
ffa_ch1_genesis.kv 26 procedure FZ_Add(X : in FZ;
ffa_ch1_genesis.kv 27 Y : in FZ;
ffa_ch1_genesis.kv 28 Sum : out FZ;
ffa_ch1_genesis.kv 29 Overflow : out WBool) is
ffa_ch1_genesis.kv 30 Carry : WBool := 0;
ffa_ch1_genesis.kv 31 begin
ffa_ch1_genesis.kv 32 for i in X'Range loop
ffa_ch1_genesis.kv 33 declare
ffa_ch1_genesis.kv 34 A : constant Word := X(I);
ffa_ch1_genesis.kv 35 B : constant Word := Y(I);
ffa_ch1_genesis.kv 36 S : constant Word := A + B + Carry;
ffa_ch1_genesis.kv 37 begin
ffa_ch1_genesis.kv 38 Sum(i) := S;
ffa_ch1_genesis.kv 39 Carry := W_Carry(A, B, S);
ffa_ch1_genesis.kv 40 end;
ffa_ch1_genesis.kv 41 end loop;
ffa_ch1_genesis.kv 42 Overflow := Carry;
ffa_ch1_genesis.kv 43 end FZ_Add;
ffa_ch1_genesis.kv 44 pragma Inline_Always(FZ_Add);
ffa_ch1_genesis.kv 45
ffa_ch1_genesis.kv 46
ffa_ch1_genesis.kv 47
ffa_ch1_genesis.kv 48 procedure FZ_Sub(X : in FZ;
ffa_ch1_genesis.kv 49 Y : in FZ;
ffa_ch1_genesis.kv 50 Difference : out FZ;
ffa_ch1_genesis.kv 51 Underflow : out WBool) is
ffa_ch1_genesis.kv 52 Borrow : WBool := 0;
ffa_ch1_genesis.kv 53 begin
ffa_ch1_genesis.kv 54 for i in 0 .. Word_Index(X'Length - 1) loop
ffa_ch1_genesis.kv 55 declare
ffa_ch1_genesis.kv 56 A : constant Word := X(X'First + i);
ffa_ch1_genesis.kv 57 B : constant Word := Y(Y'First + i);
ffa_ch1_genesis.kv 58 S : constant Word := A - B - Borrow;
ffa_ch1_genesis.kv 59 begin
ffa_ch1_genesis.kv 60 Difference(Difference'First + i) := S;
ffa_ch1_genesis.kv 61 Borrow := W_Borrow(A, B, S);
ffa_ch1_genesis.kv 62 end;
ffa_ch1_genesis.kv 63 end loop;
ffa_ch1_genesis.kv 64 Underflow := Borrow;
ffa_ch1_genesis.kv 65 end FZ_Sub;
ffa_ch1_genesis.kv 66 pragma Inline_Always(FZ_Sub);
ffa_ch1_genesis.kv 67
ffa_ch1_genesis.kv 68 end FZ_Arith;