13 USE ieee.std_logic_1164.
all;
21 sum : OUT (2 DOWNTO 0);
30 --------------------------------------------------------------------------------
32 --------------------------------------------------------------------------------
33 -- 3-bit by 2-value adder, saturates at 7
42 -- add two 3-bit numbers, return 3-bit result that saturates at 7.
44 variable isum: range 0 to 28;
45 variable vsum: (3 downto 0);
48 isum := to_integer((a))
50 vsum := (to_unsigned(isum, 4));
51 if (vsum(3) = '1') then
54 return vsum(2 downto 0);
59 --------------------------------------------------------------------------------
64 variable isum: range 0 to 14;
65 variable vsum: (3 downto 0);
68 if (clk'event and clk = '1') then
out sumstd_logic_vector (2 downto 0)
std_logic_vector add2a,b,
in bstd_logic_vector (2 downto 0)
in astd_logic_vector (2 downto 0)