1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Title : HIBI Receiver block
|
3 |
|
|
-- Project : HIBI
|
4 |
|
|
-------------------------------------------------------------------------------
|
5 |
|
|
-- File : receiver.vhd
|
6 |
|
|
-- Authors : Vesa Lahtinen,
|
7 |
|
|
-- Erno Salminen,
|
8 |
|
|
-- Lasse Lehtonen
|
9 |
|
|
-- Company : Tampere University of Technology
|
10 |
|
|
-- Created :
|
11 |
|
|
-- Last update: 2011-11-28
|
12 |
|
|
-- Platform :
|
13 |
|
|
-- Standard : VHDL'93
|
14 |
|
|
-------------------------------------------------------------------------------
|
15 |
|
|
-- Description: Receive side structural block
|
16 |
|
|
--
|
17 |
|
|
-- Contains addr_decoder and rx_control
|
18 |
|
|
--
|
19 |
|
|
-------------------------------------------------------------------------------
|
20 |
|
|
-- Copyright (c) 2010 Tampere University of Technology
|
21 |
|
|
--
|
22 |
|
|
--
|
23 |
|
|
-------------------------------------------------------------------------------
|
24 |
|
|
-- Revisions :
|
25 |
|
|
-- Date Version Author Description
|
26 |
|
|
--
|
27 |
|
|
-- 2001-04-01 1.0 VL Created
|
28 |
|
|
-- 2004-2005 ege Many changes
|
29 |
|
|
-- 2010-10-15 ase Modified for new addr_decoder and rx_control
|
30 |
|
|
-------------------------------------------------------------------------------
|
31 |
|
|
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
|
32 |
|
|
--
|
33 |
|
|
-- This file is part of HIBI
|
34 |
|
|
--
|
35 |
|
|
-- This source file may be used and distributed without
|
36 |
|
|
-- restriction provided that this copyright statement is not
|
37 |
|
|
-- removed from the file and that any derivative work contains
|
38 |
|
|
-- the original copyright notice and the associated disclaimer.
|
39 |
|
|
--
|
40 |
|
|
-- This source file is free software; you can redistribute it
|
41 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
42 |
|
|
-- Public License as published by the Free Software Foundation;
|
43 |
|
|
-- either version 2.1 of the License, or (at your option) any
|
44 |
|
|
-- later version.
|
45 |
|
|
--
|
46 |
|
|
-- This source is distributed in the hope that it will be
|
47 |
|
|
-- useful, but WITHOUT ANY WARRANTY; without even the implied
|
48 |
|
|
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
49 |
|
|
-- PURPOSE. See the GNU Lesser General Public License for more
|
50 |
|
|
-- details.
|
51 |
|
|
--
|
52 |
|
|
-- You should have received a copy of the GNU Lesser General
|
53 |
|
|
-- Public License along with this source; if not, download it
|
54 |
|
|
-- from http://www.opencores.org/lgpl.shtml
|
55 |
|
|
-------------------------------------------------------------------------------
|
56 |
|
|
|
57 |
|
|
library ieee;
|
58 |
|
|
use ieee.std_logic_1164.all;
|
59 |
|
|
|
60 |
|
|
use work.hibiv3_pkg.all;
|
61 |
|
|
|
62 |
|
|
entity receiver is
|
63 |
|
|
generic (
|
64 |
|
|
id_g : integer;
|
65 |
|
|
id_min_g : integer := 0; -- Only for bridges, zero for others!
|
66 |
|
|
id_max_g : integer := 0; -- Only for bridges, zero for others!
|
67 |
|
|
addr_base_g : integer;
|
68 |
|
|
addr_limit_g : integer := 0;
|
69 |
|
|
id_width_g : integer;
|
70 |
|
|
data_width_g : integer;
|
71 |
|
|
addr_width_g : integer;
|
72 |
|
|
cfg_addr_width_g : integer;
|
73 |
|
|
cfg_re_g : integer;
|
74 |
|
|
cfg_we_g : integer;
|
75 |
|
|
inv_addr_en_g : integer;
|
76 |
|
|
separate_addr_g : integer := 0
|
77 |
|
|
);
|
78 |
|
|
port (
|
79 |
|
|
clk : in std_logic;
|
80 |
|
|
rst_n : in std_logic;
|
81 |
|
|
|
82 |
|
|
av_in : in std_logic;
|
83 |
|
|
data_in : in std_logic_vector(data_width_g-1 downto 0);
|
84 |
|
|
comm_in : in std_logic_vector(comm_width_c-1 downto 0);
|
85 |
|
|
cfg_rd_rdy_in : in std_logic;
|
86 |
|
|
|
87 |
|
|
av_0_out : out std_logic;
|
88 |
|
|
data_0_out : out std_logic_vector(data_width_g-1 downto 0);
|
89 |
|
|
comm_0_out : out std_logic_vector(comm_width_c-1 downto 0);
|
90 |
|
|
we_0_out : out std_logic;
|
91 |
|
|
full_0_in : in std_logic;
|
92 |
|
|
one_p_0_in : in std_logic;
|
93 |
|
|
|
94 |
|
|
av_1_out : out std_logic;
|
95 |
|
|
data_1_out : out std_logic_vector(data_width_g-1 downto 0);
|
96 |
|
|
comm_1_out : out std_logic_vector(comm_width_c-1 downto 0);
|
97 |
|
|
we_1_out : out std_logic;
|
98 |
|
|
full_1_in : in std_logic;
|
99 |
|
|
one_p_1_in : in std_logic;
|
100 |
|
|
|
101 |
|
|
bus_full_in : in std_logic;
|
102 |
|
|
|
103 |
|
|
cfg_we_out : out std_logic;
|
104 |
|
|
cfg_re_out : out std_logic;
|
105 |
|
|
cfg_data_out : out std_logic_vector
|
106 |
|
|
(data_width_g-1-(separate_addr_g*addr_width_g) downto 0);
|
107 |
|
|
cfg_addr_out : out std_logic_vector(cfg_addr_width_g-1 downto 0);
|
108 |
|
|
cfg_ret_addr_out : out std_logic_vector(addr_width_g-1 downto 0);
|
109 |
|
|
full_out : out std_logic
|
110 |
|
|
);
|
111 |
|
|
end receiver;
|
112 |
|
|
|
113 |
|
|
architecture structural of receiver is
|
114 |
|
|
|
115 |
|
|
component addr_decoder is
|
116 |
|
|
generic (
|
117 |
|
|
data_width_g : integer;
|
118 |
|
|
addr_width_g : integer;
|
119 |
|
|
id_width_g : integer;
|
120 |
|
|
id_g : integer;
|
121 |
|
|
id_min_g : integer;
|
122 |
|
|
id_max_g : integer;
|
123 |
|
|
addr_base_g : integer;
|
124 |
|
|
addr_limit_g : integer;
|
125 |
|
|
invert_addr_g : integer;
|
126 |
|
|
cfg_re_g : integer;
|
127 |
|
|
cfg_we_g : integer;
|
128 |
|
|
separate_addr_g : integer);
|
129 |
|
|
port (
|
130 |
|
|
clk : in std_logic;
|
131 |
|
|
rst_n : in std_logic;
|
132 |
|
|
av_in : in std_logic;
|
133 |
|
|
addr_in : in std_logic_vector(addr_width_g-1 downto 0);
|
134 |
|
|
comm_in : in std_logic_vector(comm_width_c-1 downto 0);
|
135 |
|
|
bus_full_in : in std_logic;
|
136 |
|
|
addr_match_out : out std_logic;
|
137 |
|
|
id_match_out : out std_logic;
|
138 |
|
|
norm_cmd_out : out std_logic;
|
139 |
|
|
msg_cmd_out : out std_logic;
|
140 |
|
|
conf_re_cmd_out : out std_logic;
|
141 |
|
|
conf_we_cmd_out : out std_logic;
|
142 |
|
|
excl_lock_cmd_out : out std_logic;
|
143 |
|
|
excl_data_cmd_out : out std_logic;
|
144 |
|
|
excl_release_cmd_out : out std_logic);
|
145 |
|
|
end component addr_decoder;
|
146 |
|
|
|
147 |
|
|
component rx_control is
|
148 |
|
|
generic (
|
149 |
|
|
data_width_g : integer;
|
150 |
|
|
addr_width_g : integer;
|
151 |
|
|
id_width_g : integer;
|
152 |
|
|
cfg_addr_width_g : integer;
|
153 |
|
|
cfg_re_g : integer;
|
154 |
|
|
cfg_we_g : integer;
|
155 |
|
|
separate_addr_g : integer;
|
156 |
|
|
is_bridge_g : integer);
|
157 |
|
|
port (
|
158 |
|
|
clk : in std_logic;
|
159 |
|
|
rst_n : in std_logic;
|
160 |
|
|
av_in : in std_logic;
|
161 |
|
|
data_in : in std_logic_vector(data_width_g-1 downto 0);
|
162 |
|
|
comm_in : in std_logic_vector(comm_width_c-1 downto 0);
|
163 |
|
|
full_out : out std_logic;
|
164 |
|
|
|
165 |
|
|
data_0_out : out std_logic_vector(data_width_g-1 downto 0);
|
166 |
|
|
comm_0_out : out std_logic_vector(comm_width_c-1 downto 0);
|
167 |
|
|
av_0_out : out std_logic;
|
168 |
|
|
we_0_out : out std_logic;
|
169 |
|
|
full_0_in : in std_logic;
|
170 |
|
|
one_p_0_in : in std_logic;
|
171 |
|
|
|
172 |
|
|
data_1_out : out std_logic_vector(data_width_g-1 downto 0);
|
173 |
|
|
comm_1_out : out std_logic_vector(comm_width_c-1 downto 0);
|
174 |
|
|
av_1_out : out std_logic;
|
175 |
|
|
we_1_out : out std_logic;
|
176 |
|
|
full_1_in : in std_logic;
|
177 |
|
|
one_p_1_in : in std_logic;
|
178 |
|
|
|
179 |
|
|
addr_match_in : in std_logic;
|
180 |
|
|
id_match_in : in std_logic;
|
181 |
|
|
norm_cmd_in : in std_logic;
|
182 |
|
|
msg_cmd_in : in std_logic;
|
183 |
|
|
conf_re_cmd_in : in std_logic;
|
184 |
|
|
conf_we_cmd_in : in std_logic;
|
185 |
|
|
excl_lock_cmd_in : in std_logic;
|
186 |
|
|
excl_data_cmd_in : in std_logic;
|
187 |
|
|
excl_release_cmd_in : in std_logic;
|
188 |
|
|
cfg_rd_rdy_in : in std_logic;
|
189 |
|
|
cfg_we_out : out std_logic;
|
190 |
|
|
cfg_re_out : out std_logic;
|
191 |
|
|
cfg_addr_out : out std_logic_vector(cfg_addr_width_g-1 downto 0);
|
192 |
|
|
cfg_data_out : out std_logic_vector
|
193 |
|
|
(data_width_g-1-(separate_addr_g*addr_width_g) downto 0);
|
194 |
|
|
cfg_ret_addr_out : out std_logic_vector(addr_width_g-1 downto 0));
|
195 |
|
|
end component rx_control;
|
196 |
|
|
|
197 |
|
|
function amIbridge (
|
198 |
|
|
constant id_max : integer)
|
199 |
|
|
return integer is
|
200 |
|
|
begin -- function amIbridge
|
201 |
|
|
if id_max /= 0 then
|
202 |
|
|
return 1;
|
203 |
|
|
else
|
204 |
|
|
return 0;
|
205 |
|
|
end if;
|
206 |
|
|
end function amIbridge;
|
207 |
|
|
|
208 |
|
|
-- only bridges if have id_ranges
|
209 |
|
|
constant iAmBridge_c : integer := amIbridge(id_max_g);
|
210 |
|
|
|
211 |
|
|
signal addr_match_dc_rx : std_logic;
|
212 |
|
|
signal id_match_dc_rx : std_logic;
|
213 |
|
|
signal norm_cmd_dc_rx : std_logic;
|
214 |
|
|
signal msg_cmd_dc_rx : std_logic;
|
215 |
|
|
signal conf_re_cmd_dc_rx : std_logic;
|
216 |
|
|
signal conf_we_cmd_dc_rx : std_logic;
|
217 |
|
|
signal excl_lock_cmd_dc_rx : std_logic;
|
218 |
|
|
signal excl_data_cmd_dc_rx : std_logic;
|
219 |
|
|
signal excl_release_cmd_dc_rx : std_logic;
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
begin -- structural
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
addr_decoder_1 : addr_decoder
|
226 |
|
|
generic map (
|
227 |
|
|
data_width_g => data_width_g,
|
228 |
|
|
addr_width_g => addr_width_g,
|
229 |
|
|
id_width_g => id_width_g,
|
230 |
|
|
id_g => id_g,
|
231 |
|
|
id_min_g => id_min_g,
|
232 |
|
|
id_max_g => id_max_g,
|
233 |
|
|
addr_base_g => addr_base_g,
|
234 |
|
|
addr_limit_g => addr_limit_g,
|
235 |
|
|
invert_addr_g => inv_addr_en_g,
|
236 |
|
|
cfg_re_g => cfg_re_g,
|
237 |
|
|
cfg_we_g => cfg_we_g,
|
238 |
|
|
separate_addr_g => separate_addr_g)
|
239 |
|
|
port map (
|
240 |
|
|
clk => clk,
|
241 |
|
|
rst_n => rst_n,
|
242 |
|
|
av_in => av_in,
|
243 |
|
|
addr_in => data_in
|
244 |
|
|
(addr_width_g-1+(separate_addr_g*(data_width_g-addr_width_g)) downto
|
245 |
|
|
separate_addr_g*(data_width_g-addr_width_g)),
|
246 |
|
|
comm_in => comm_in,
|
247 |
|
|
bus_full_in => bus_full_in,
|
248 |
|
|
addr_match_out => addr_match_dc_rx,
|
249 |
|
|
id_match_out => id_match_dc_rx,
|
250 |
|
|
norm_cmd_out => norm_cmd_dc_rx,
|
251 |
|
|
msg_cmd_out => msg_cmd_dc_rx,
|
252 |
|
|
conf_re_cmd_out => conf_re_cmd_dc_rx,
|
253 |
|
|
conf_we_cmd_out => conf_we_cmd_dc_rx,
|
254 |
|
|
excl_lock_cmd_out => excl_lock_cmd_dc_rx,
|
255 |
|
|
excl_data_cmd_out => excl_data_cmd_dc_rx,
|
256 |
|
|
excl_release_cmd_out => excl_release_cmd_dc_rx);
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
rx_control_1 : rx_control
|
260 |
|
|
generic map (
|
261 |
|
|
data_width_g => data_width_g,
|
262 |
|
|
addr_width_g => addr_width_g,
|
263 |
|
|
id_width_g => id_width_g,
|
264 |
|
|
cfg_addr_width_g => cfg_addr_width_g,
|
265 |
|
|
cfg_re_g => cfg_re_g,
|
266 |
|
|
cfg_we_g => cfg_we_g,
|
267 |
|
|
separate_addr_g => separate_addr_g,
|
268 |
|
|
is_bridge_g => iAmBridge_c)
|
269 |
|
|
port map (
|
270 |
|
|
clk => clk,
|
271 |
|
|
rst_n => rst_n,
|
272 |
|
|
av_in => av_in,
|
273 |
|
|
data_in => data_in,
|
274 |
|
|
comm_in => comm_in,
|
275 |
|
|
full_out => full_out,
|
276 |
|
|
|
277 |
|
|
data_0_out => data_0_out,
|
278 |
|
|
comm_0_out => comm_0_out,
|
279 |
|
|
av_0_out => av_0_out,
|
280 |
|
|
we_0_out => we_0_out,
|
281 |
|
|
full_0_in => full_0_in,
|
282 |
|
|
one_p_0_in => one_p_0_in,
|
283 |
|
|
|
284 |
|
|
data_1_out => data_1_out,
|
285 |
|
|
comm_1_out => comm_1_out,
|
286 |
|
|
av_1_out => av_1_out,
|
287 |
|
|
we_1_out => we_1_out,
|
288 |
|
|
full_1_in => full_1_in,
|
289 |
|
|
one_p_1_in => one_p_1_in,
|
290 |
|
|
|
291 |
|
|
addr_match_in => addr_match_dc_rx,
|
292 |
|
|
id_match_in => id_match_dc_rx,
|
293 |
|
|
norm_cmd_in => norm_cmd_dc_rx,
|
294 |
|
|
msg_cmd_in => msg_cmd_dc_rx,
|
295 |
|
|
conf_re_cmd_in => conf_re_cmd_dc_rx,
|
296 |
|
|
conf_we_cmd_in => conf_we_cmd_dc_rx,
|
297 |
|
|
excl_lock_cmd_in => excl_lock_cmd_dc_rx,
|
298 |
|
|
excl_data_cmd_in => excl_data_cmd_dc_rx,
|
299 |
|
|
excl_release_cmd_in => excl_release_cmd_dc_rx,
|
300 |
|
|
cfg_rd_rdy_in => cfg_rd_rdy_in,
|
301 |
|
|
cfg_we_out => cfg_we_out,
|
302 |
|
|
cfg_re_out => cfg_re_out,
|
303 |
|
|
cfg_addr_out => cfg_addr_out,
|
304 |
|
|
cfg_data_out => cfg_data_out,
|
305 |
|
|
cfg_ret_addr_out => cfg_ret_addr_out);
|
306 |
|
|
|
307 |
|
|
end structural;
|