1 -------------------------------------------------------------------------------
6 -- Author(s) : stephane Domas (sdomas@univ-fcomte.fr)
8 -- Creation Date : 2015/04/27
10 -- Description : This component is a multadd
14 -------------------------------------------------------------------------------
17 use IEEE.std_logic_1164.all;
18 use IEEE.numeric_std.all;
22 wb_data_width : integer := 16;
23 wb_addr_width : integer := 12
26 -- clk/rst from multadd wrapper
30 -- registers r/w via wishbone
31 wb_do_op : in std_logic;
32 wb_c : in std_logic_vector(wb_data_width-1 downto 0);
33 wb_d : out std_logic_vector(2*wb_data_width-1 downto 0);
36 val1_i : in std_logic_vector(17 downto 0);
37 val2_i : in std_logic_vector(17 downto 0);
38 res_o : out std_logic_vector(35 downto 0)
43 architecture multadd_1 of multadd is
46 signal a_s : signed(17 downto 0);
47 signal b_s : signed(17 downto 0);
48 signal c_s : signed(35 downto 0);
49 signal result : signed(35 downto 0);
53 a_s <= signed(val1_i);
54 b_s <= signed(val2_i);
55 c_s <= resize(signed(wb_c), 36);
57 do_mult_process : process (clk, rst)
61 result <= to_signed(0, 36);
63 elsif (rising_edge(clk)) then
65 if wb_do_op = '1' then
66 result <= a_s * b_s + c_s;
70 end process do_mult_process;
72 res_o <= std_logic_vector(result);
73 wb_d <= std_logic_vector(resize(result, 2*wb_data_width));