1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
|
3 |
|
|
--
|
4 |
|
|
-- This source file may be used and distributed without
|
5 |
|
|
-- restriction provided that this copyright statement is not
|
6 |
|
|
-- removed from the file and that any derivative work contains
|
7 |
|
|
-- the original copyright notice and the associated disclaimer.
|
8 |
|
|
--
|
9 |
|
|
-- This source file is free software; you can redistribute it
|
10 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
11 |
|
|
-- Public License as published by the Free Software Foundation;
|
12 |
|
|
-- either version 2.1 of the License, or (at your option) any
|
13 |
|
|
-- later version.
|
14 |
|
|
--
|
15 |
|
|
-- This source is distributed in the hope that it will be
|
16 |
|
|
-- useful, but WITHOUT ANY WARRANTY; without even the implied
|
17 |
|
|
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
18 |
|
|
-- PURPOSE. See the GNU Lesser General Public License for more
|
19 |
|
|
-- details.
|
20 |
|
|
--
|
21 |
|
|
-- You should have received a copy of the GNU Lesser General
|
22 |
|
|
-- Public License along with this source; if not, download it
|
23 |
|
|
-- from http://www.opencores.org/lgpl.shtml
|
24 |
|
|
-------------------------------------------------------------------------------
|
25 |
|
|
-------------------------------------------------------------------------------
|
26 |
|
|
-- File : receiver.vhdl
|
27 |
|
|
-- Description :
|
28 |
|
|
-- Author : Vesa Lahtinen
|
29 |
|
|
-- e-mail : erno.salminen@tut.fi
|
30 |
|
|
-- Project : mikälie
|
31 |
|
|
-- Design : Do not use term design when you mean system
|
32 |
|
|
-- Date : 06.06.2002
|
33 |
|
|
-- Modified :
|
34 |
|
|
--
|
35 |
|
|
-- 01.04.2003 Fifo_Mux_Write added
|
36 |
|
|
-- 13.04 message stuff removed, es
|
37 |
|
|
-- 27.07.2004 Clk+Rst removed from addr_decoder, ES
|
38 |
|
|
--
|
39 |
|
|
-- 15.12.2004 ES names changed
|
40 |
|
|
-- 31.01.2005 ES signals changed to generics
|
41 |
|
|
-- 07.02.2005 ES new generics
|
42 |
|
|
-- 04.03.2005 ES new generic cfg_addr_width_g
|
43 |
|
|
--
|
44 |
|
|
-------------------------------------------------------------------------------
|
45 |
|
|
library ieee;
|
46 |
|
|
use ieee.std_logic_1164.all;
|
47 |
|
|
use ieee.std_logic_arith.all;
|
48 |
|
|
use ieee.std_logic_unsigned.all;
|
49 |
|
|
use work.hibiv2_pkg.all;
|
50 |
|
|
|
51 |
|
|
entity receiver is
|
52 |
|
|
generic (
|
53 |
|
|
id_g : integer := 5;
|
54 |
|
|
base_id_g : integer := 5;
|
55 |
|
|
addr_g : integer := 46;
|
56 |
|
|
id_width_g : integer := 4;
|
57 |
|
|
data_width_g : integer := 32;
|
58 |
|
|
addr_width_g : integer := 32; -- in bits
|
59 |
|
|
cfg_addr_width_g : integer := 16; -- in bits 04.03.2005
|
60 |
|
|
cfg_re_g : integer := 1; -- 07.02.05
|
61 |
|
|
cfg_we_g : integer := 1; -- 07.02.05
|
62 |
|
|
multicast_en_g : integer := 1; -- 07.02.05
|
63 |
|
|
inv_addr_en_g : integer := 0
|
64 |
|
|
);
|
65 |
|
|
port (
|
66 |
|
|
clk : in std_logic;
|
67 |
|
|
rst_n : in std_logic;
|
68 |
|
|
|
69 |
|
|
av_in : in std_logic;
|
70 |
|
|
data_in : in std_logic_vector ( data_width_g-1 downto 0);
|
71 |
|
|
comm_in : in std_logic_vector ( comm_width_c-1 downto 0);
|
72 |
|
|
cfg_rd_rdy_in : in std_logic;
|
73 |
|
|
|
74 |
|
|
av_out : out std_logic;
|
75 |
|
|
data_out : out std_logic_vector ( data_width_g-1 downto 0);
|
76 |
|
|
comm_out : out std_logic_vector ( comm_width_c-1 downto 0);
|
77 |
|
|
we_out : out std_logic;
|
78 |
|
|
full_in : in std_logic;
|
79 |
|
|
one_p_in : in std_logic;
|
80 |
|
|
|
81 |
|
|
cfg_we_out : out std_logic;
|
82 |
|
|
cfg_re_out : out std_logic;
|
83 |
|
|
cfg_data_out : out std_logic_vector ( data_width_g -1 downto 0);
|
84 |
|
|
cfg_addr_out : out std_logic_vector ( cfg_addr_width_g -1 downto 0); --03.04.05
|
85 |
|
|
cfg_ret_addr_out : out std_logic_vector ( addr_width_g -1 downto 0);
|
86 |
|
|
full_out : out std_logic
|
87 |
|
|
);
|
88 |
|
|
end receiver;
|
89 |
|
|
|
90 |
|
|
architecture structural of receiver is
|
91 |
|
|
|
92 |
|
|
component addr_decoder
|
93 |
|
|
generic (
|
94 |
|
|
data_width_g : integer := 32;
|
95 |
|
|
addr_width_g : integer := 32; -- in bits
|
96 |
|
|
id_width_g : integer := 4;
|
97 |
|
|
id_g : integer := 5;
|
98 |
|
|
base_id_g : integer := 5;
|
99 |
|
|
addr_g : integer := 46;
|
100 |
|
|
cfg_re_g : integer := 1; -- 07.02.05
|
101 |
|
|
cfg_we_g : integer := 1; -- 07.02.05
|
102 |
|
|
multicast_en_g : integer := 1; -- 07.02.05
|
103 |
|
|
inv_addr_en_g : integer := 0
|
104 |
|
|
);
|
105 |
|
|
port (
|
106 |
|
|
addr_in : in std_logic_vector ( addr_width_g -1 downto 0);
|
107 |
|
|
comm_in : in std_logic_vector ( comm_width_c -1 downto 0);
|
108 |
|
|
enable_in : in std_logic;
|
109 |
|
|
base_id_match_out : out std_logic;
|
110 |
|
|
addr_match_out : out std_logic
|
111 |
|
|
);
|
112 |
|
|
end component; --addr_decoder;
|
113 |
|
|
|
114 |
|
|
component rx_control
|
115 |
|
|
generic (
|
116 |
|
|
data_width_g : integer := 32;
|
117 |
|
|
addr_width_g : integer := 25; -- in bits!
|
118 |
|
|
id_width_g : integer := 5; -- 04.03.2005
|
119 |
|
|
cfg_addr_width_g : integer := 16; -- in bits 04.03.2005
|
120 |
|
|
cfg_re_g : integer := 1; -- 07.02.05
|
121 |
|
|
cfg_we_g : integer := 1 -- 07.02.05
|
122 |
|
|
);
|
123 |
|
|
port (
|
124 |
|
|
clk : in std_logic;
|
125 |
|
|
rst_n : in std_logic;
|
126 |
|
|
av_in : in std_logic;
|
127 |
|
|
data_in : in std_logic_vector ( data_width_g-1 downto 0);
|
128 |
|
|
comm_in : in std_logic_vector ( comm_width_c-1 downto 0);
|
129 |
|
|
full_in : in std_logic;
|
130 |
|
|
one_p_in : in std_logic;
|
131 |
|
|
cfg_rd_rdy_in : in std_logic; --16.05
|
132 |
|
|
addr_match_in : in std_logic;
|
133 |
|
|
decode_addr_out : out std_logic_vector ( addr_width_g -1 downto 0);
|
134 |
|
|
decode_comm_out : out std_logic_vector ( comm_width_c-1 downto 0);
|
135 |
|
|
decode_en_out : out std_logic;
|
136 |
|
|
data_out : out std_logic_vector ( data_width_g-1 downto 0);
|
137 |
|
|
comm_out : out std_logic_vector ( comm_width_c-1 downto 0);
|
138 |
|
|
av_Out : out std_logic;
|
139 |
|
|
we_Out : out std_logic;
|
140 |
|
|
full_Out : out std_logic;
|
141 |
|
|
cfg_we_Out : out std_logic;
|
142 |
|
|
cfg_re_Out : out std_logic;
|
143 |
|
|
cfg_data_out : out std_logic_vector ( data_width_g-1 downto 0);
|
144 |
|
|
cfg_addr_out : out std_logic_vector ( cfg_addr_width_g -1 downto 0);
|
145 |
|
|
cfg_ret_addr_out : out std_logic_vector ( addr_width_g -1 downto 0)
|
146 |
|
|
);
|
147 |
|
|
end component; --rx_control;
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
-- From rx_ctrl to addr decoder
|
151 |
|
|
signal addr_rx_dec : std_logic_vector ( addr_width_g-1 downto 0);
|
152 |
|
|
signal comm_rx_dec : std_logic_vector ( comm_width_c-1 downto 0);
|
153 |
|
|
signal enable_rx_dec : std_logic;
|
154 |
|
|
|
155 |
|
|
-- From addr decoder to rx_ctrl
|
156 |
|
|
signal addr_match_dec_rx : std_logic;
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
signal Tie_High : std_logic;
|
160 |
|
|
signal Tie_Low : std_logic;
|
161 |
|
|
|
162 |
|
|
begin -- structural
|
163 |
|
|
|
164 |
|
|
-- Concurrent assignments
|
165 |
|
|
Tie_High <= '1';
|
166 |
|
|
Tie_Low <= '0';
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
Control : rx_control -- for design compiler
|
170 |
|
|
-- Control : entity work.rx_control
|
171 |
|
|
generic map(
|
172 |
|
|
data_width_g => data_width_g,
|
173 |
|
|
addr_width_g => addr_width_g,
|
174 |
|
|
id_width_g => id_width_g, --04-03-05
|
175 |
|
|
cfg_addr_width_g => cfg_addr_width_g, -- 04.03.05
|
176 |
|
|
cfg_re_g => cfg_re_g,
|
177 |
|
|
cfg_we_g => cfg_we_g
|
178 |
|
|
)
|
179 |
|
|
port map(
|
180 |
|
|
clk => clk,
|
181 |
|
|
rst_n => rst_n,
|
182 |
|
|
av_in => av_in,
|
183 |
|
|
data_in => data_in,
|
184 |
|
|
comm_in => comm_in,
|
185 |
|
|
addr_Match_in => addr_match_dec_rx,
|
186 |
|
|
decode_addr_out => addr_rx_dec,
|
187 |
|
|
decode_comm_out => comm_rx_dec,
|
188 |
|
|
decode_en_out => enable_rx_dec,
|
189 |
|
|
cfg_rd_rdy_in => cfg_rd_rdy_in, --16.05
|
190 |
|
|
|
191 |
|
|
full_in => full_in,
|
192 |
|
|
one_p_in => one_p_in,
|
193 |
|
|
data_out => data_out,
|
194 |
|
|
comm_out => comm_out,
|
195 |
|
|
av_out => av_out,
|
196 |
|
|
we_out => we_out,
|
197 |
|
|
|
198 |
|
|
cfg_we_out => cfg_we_out,
|
199 |
|
|
cfg_re_out => cfg_re_out,
|
200 |
|
|
full_out => full_out,
|
201 |
|
|
cfg_data_out => cfg_data_out,
|
202 |
|
|
cfg_addr_out => cfg_addr_out,
|
203 |
|
|
cfg_ret_addr_out => cfg_ret_addr_out
|
204 |
|
|
);
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
Decoder : addr_decoder
|
208 |
|
|
-- Decoder : entity work.addr_decoder
|
209 |
|
|
generic map (
|
210 |
|
|
data_width_g => data_width_g,
|
211 |
|
|
addr_width_g => addr_width_g,
|
212 |
|
|
id_width_g => id_width_g,
|
213 |
|
|
id_g => id_g,
|
214 |
|
|
base_id_g => base_id_g,
|
215 |
|
|
addr_g => addr_g,
|
216 |
|
|
cfg_re_g => cfg_re_g, -- 07.02.05
|
217 |
|
|
cfg_we_g => cfg_we_g, -- 07.02.05
|
218 |
|
|
multicast_en_g => multicast_en_g, -- 07.02.05
|
219 |
|
|
inv_addr_en_g => inv_addr_en_g
|
220 |
|
|
)
|
221 |
|
|
port map (
|
222 |
|
|
addr_in => addr_rx_dec,
|
223 |
|
|
comm_in => comm_rx_dec,
|
224 |
|
|
enable_in => enable_rx_dec,
|
225 |
|
|
--base_id_match_out =>
|
226 |
|
|
addr_match_out => addr_match_dec_rx
|
227 |
|
|
);
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
end structural;
|