14 USE ieee.std_logic_1164.
all;
17 --use work.CMXpackage.all;
18 --use work.CMX_CP_package.all;
27 sum : OUT (2 DOWNTO 0);
36 --------------------------------------------------------------------------------
38 --------------------------------------------------------------------------------
39 -- 3-bit by 2-value adder, saturates at 7
50 -- add two 3-bit numbers, return 3-bit result that saturates at 7.
52 variable isum: range 0 to 28;
53 variable vsum: (4 downto 0);
56 isum := to_integer((a))
60 vsum := (to_unsigned(isum, 5));
61 if (vsum(3) = '1' or vsum(4) = '1') then
64 return vsum(2 downto 0);
69 --------------------------------------------------------------------------------
74 variable vsum: (3 downto 0);
77 if (clk'event and clk = '1') then
in astd_logic_vector (2 downto 0)
out sumstd_logic_vector (2 downto 0)
in cstd_logic_vector (2 downto 0)
in dstd_logic_vector (2 downto 0)
in bstd_logic_vector (2 downto 0)
std_logic_vector add4a,b,c,d,