1 -------------------------------------------------------------------------------
3 -- File : multadd_ctrl.vhd
4 -- Related files : multadd.vhd
6 -- Author(s) : stephane Domas (sdomas@univ-fcomte.fr)
8 -- Creation Date : 2015/04/27
10 -- Description : This component is generated automatically.
11 -- It contains processes to r/w registers defined for multadd
16 -------------------------------------------------------------------------------
19 use IEEE.std_logic_1164.all;
20 use IEEE.numeric_std.all;
22 -------------------------------------------------------------------------------
24 -------------------------------------------------------------------------------
25 -- name bits address R/W
26 -- wb_do_op 0 0x0000 W
27 -- wb_c (15 downto 0) 0x0001 W
28 -- wb_d (15 downto 0) 0x0002 R
29 -- wb_d (31 downto 0) 0x0003 R
31 -------------------------------------------------------------------------------
33 entity multadd_ctrl is
35 wb_data_width : integer := 16;
36 wb_addr_width : integer := 2
39 -- clk/rst from interconnector
43 -- addr/data from interconnector
44 addr_i : in std_logic_vector(wb_addr_width-1 downto 0);
45 dat_i : in std_logic_vector(wb_data_width-1 downto 0);
46 dat_o : out std_logic_vector(wb_data_width-1 downto 0);
50 ack_o : out std_logic;
52 -- registers r/w via wishbone that are forwarded to the block
53 wb_do_op : out std_logic;
54 wb_c : out std_logic_vector(wb_data_width-1 downto 0);
55 wb_d : in std_logic_vector(2*wb_data_width-1 downto 0)
61 architecture multadd_ctrl1 of multadd_ctrl is
63 -- signals : registers r/w via wishbone
64 signal wb_do_op_s : std_logic;
65 signal wb_c_s : std_logic_vector(wb_data_width-1 downto 0);
66 signal wb_d_s : std_logic_vector(2*wb_data_width-1 downto 0);
68 -- signals : wishbone related
69 signal read_data : std_logic_vector(wb_data_width-1 downto 0);
70 signal read_ack : std_logic;
71 signal write_ack : std_logic;
72 signal write_rise : std_logic;
75 -- ----------------------------------------------------------------------------
76 -- signals from/to ports
77 -- ----------------------------------------------------------------------------
80 wb_do_op <= wb_do_op_s;
82 -- ----------------------------------------------------------------------------
83 -- write rising edge detection
84 -- ----------------------------------------------------------------------------
85 detection_front : process(gls_clk, gls_reset)
86 variable signal_old : std_logic;
88 if (gls_reset = '1') then
91 elsif rising_edge(gls_clk) then
92 if (signal_old = '0' and stb_i = '1' and cyc_i = '1' and we_i = '1') then
99 end process detection_front;
101 -- ----------------------------------------------------------------------------
102 -- Register reading process
103 -- ----------------------------------------------------------------------------
104 reading_reg : process(clk, rst)
108 read_data <= (others => '0');
109 elsif(rising_edge(clk)) then
111 if (stb_i = '1' and cyc_i = '1' and we_i = '0') then
113 if(addr_i = "10") then
114 read_data <= wb_d_s(15 downto 0);
115 elsif(addr_i = "11") then
116 read_data <= wb_d_s(31 downto 16);
118 read_data <= (others => '0');
122 end process reading_reg;
124 -- ----------------------------------------------------------------------------
125 -- Register writing process
126 -- ----------------------------------------------------------------------------
127 writing_reg : process(clk, rst)
132 wb_c_s <= (others => '0');
133 elsif(rising_edge(clk)) then
136 if (write_rise = '1') then
138 if (addr_i = "00") then
140 elsif (addr_i = "01") then
145 end process writing_reg;
147 -- ----------------------------------------------------------------------------
148 -- assignations for wishbone outputs
149 -- ----------------------------------------------------------------------------
150 ack_o <= read_ack or write_ack;
151 dat_o <= read_data when (stb_i = '1' and cyc_i = '1' and we_i = '0') else (others => '0');