1 |
42 |
lmaarsen |
--------------------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- Ethernet Switch on Configurable Logic IP Core ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the ESoCL project ----
|
6 |
|
|
---- http://www.opencores.org/cores/esoc/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description: see design description ESoCL_dd_71022001.pdf ----
|
9 |
|
|
---- ----
|
10 |
|
|
---- To Do: see roadmap description ESoCL_dd_71022001.pdf ----
|
11 |
|
|
---- and/or release bulleting ESoCL_rb_71022001.pdf ----
|
12 |
|
|
---- ----
|
13 |
|
|
---- Author(s): L.Maarsen ----
|
14 |
|
|
---- Bert Maarsen, lmaarsen@opencores.org ----
|
15 |
|
|
---- ----
|
16 |
|
|
--------------------------------------------------------------------------------
|
17 |
|
|
---- ----
|
18 |
|
|
---- Copyright (C) 2009 Authors and OPENCORES.ORG ----
|
19 |
|
|
---- ----
|
20 |
|
|
---- This source file may be used and distributed without ----
|
21 |
|
|
---- restriction provided that this copyright statement is not ----
|
22 |
|
|
---- removed from the file and that any derivative work contains ----
|
23 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
24 |
|
|
---- ----
|
25 |
|
|
---- This source file is free software; you can redistribute it ----
|
26 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
27 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
28 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
29 |
|
|
---- later version. ----
|
30 |
|
|
---- ----
|
31 |
|
|
---- This source is distributed in the hope that it will be ----
|
32 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
33 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
34 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
35 |
|
|
---- details. ----
|
36 |
|
|
---- ----
|
37 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
38 |
|
|
---- Public License along with this source; if not, download it ----
|
39 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
40 |
|
|
---- ----
|
41 |
|
|
--------------------------------------------------------------------------------
|
42 |
|
|
-- Object : Entity work.esoc_port_storage
|
43 |
|
|
-- Last modified : Mon Apr 14 12:49:43 2014.
|
44 |
|
|
--------------------------------------------------------------------------------
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
library ieee, std, work;
|
49 |
|
|
use ieee.std_logic_1164.all;
|
50 |
|
|
use std.textio.all;
|
51 |
|
|
use ieee.numeric_std.all;
|
52 |
|
|
use work.package_esoc_configuration.all;
|
53 |
|
|
|
54 |
|
|
entity esoc_port_storage is
|
55 |
|
|
port(
|
56 |
|
|
clk_control : in std_logic;
|
57 |
|
|
clk_data : in std_logic;
|
58 |
|
|
clk_search : in std_logic;
|
59 |
|
|
inbound_port_data : in std_logic_vector(31 downto 0);
|
60 |
|
|
inbound_port_data_full : out std_logic;
|
61 |
|
|
inbound_port_data_write : in std_logic;
|
62 |
|
|
inbound_port_header : in std_logic_vector(111 downto 0);
|
63 |
|
|
inbound_port_header_write : in std_logic;
|
64 |
|
|
inbound_port_info : in std_logic_vector(31 downto 0);
|
65 |
|
|
inbound_port_info_write : in std_logic;
|
66 |
|
|
inbound_proc_data : out std_logic_vector(63 downto 0);
|
67 |
|
|
inbound_proc_data_full : out std_logic;
|
68 |
|
|
inbound_proc_data_read : in std_logic;
|
69 |
|
|
inbound_proc_header : out std_logic_vector(111 downto 0);
|
70 |
|
|
inbound_proc_header_empty : out std_logic;
|
71 |
|
|
inbound_proc_header_read : in std_logic;
|
72 |
|
|
inbound_proc_info : out std_logic_vector(31 downto 0);
|
73 |
|
|
inbound_proc_info_empty : out std_logic;
|
74 |
|
|
inbound_proc_info_read : in std_logic;
|
75 |
|
|
outbound_port_data : out std_logic_vector(31 downto 0);
|
76 |
|
|
outbound_port_data_read : in std_logic;
|
77 |
|
|
outbound_port_info : out std_logic_vector(15 downto 0);
|
78 |
|
|
outbound_port_info_empty : out std_logic;
|
79 |
|
|
outbound_port_info_read : in std_logic;
|
80 |
|
|
outbound_proc_data : in std_logic_vector(63 downto 0);
|
81 |
|
|
outbound_proc_data_full : out std_logic;
|
82 |
|
|
outbound_proc_data_write : in std_logic;
|
83 |
|
|
outbound_proc_info : in std_logic_vector(15 downto 0);
|
84 |
|
|
outbound_proc_info_write : in std_logic;
|
85 |
|
|
reset : in std_logic);
|
86 |
|
|
end entity esoc_port_storage;
|
87 |
|
|
|
88 |
|
|
--------------------------------------------------------------------------------
|
89 |
|
|
-- Object : Architecture work.esoc_port_storage.structure
|
90 |
|
|
-- Last modified : Mon Apr 14 12:49:43 2014.
|
91 |
|
|
--------------------------------------------------------------------------------
|
92 |
|
|
|
93 |
|
|
architecture structure of esoc_port_storage is
|
94 |
|
|
|
95 |
|
|
signal inbound_wrusedw : STD_LOGIC_VECTOR(10 downto 0);
|
96 |
|
|
signal inbound_rdusedw : STD_LOGIC_VECTOR(9 downto 0);
|
97 |
|
|
|
98 |
|
|
component esoc_fifo_256x32
|
99 |
|
|
port(
|
100 |
|
|
aclr : in STD_LOGIC := '0';
|
101 |
|
|
data : in STD_LOGIC_VECTOR(31 downto 0);
|
102 |
|
|
rdclk : in STD_LOGIC;
|
103 |
|
|
rdreq : in STD_LOGIC;
|
104 |
|
|
wrclk : in STD_LOGIC;
|
105 |
|
|
wrreq : in STD_LOGIC;
|
106 |
|
|
q : out STD_LOGIC_VECTOR(31 downto 0);
|
107 |
|
|
rdempty : out STD_LOGIC;
|
108 |
|
|
rdusedw : out STD_LOGIC_VECTOR(7 downto 0);
|
109 |
|
|
wrfull : out STD_LOGIC;
|
110 |
|
|
wrusedw : out STD_LOGIC_VECTOR(7 downto 0));
|
111 |
|
|
end component esoc_fifo_256x32;
|
112 |
|
|
|
113 |
|
|
component esoc_fifo_256x112
|
114 |
|
|
port(
|
115 |
|
|
aclr : in STD_LOGIC := '0';
|
116 |
|
|
data : in STD_LOGIC_VECTOR(111 downto 0);
|
117 |
|
|
rdclk : in STD_LOGIC;
|
118 |
|
|
rdreq : in STD_LOGIC;
|
119 |
|
|
wrclk : in STD_LOGIC;
|
120 |
|
|
wrreq : in STD_LOGIC;
|
121 |
|
|
q : out STD_LOGIC_VECTOR(111 downto 0);
|
122 |
|
|
rdempty : out STD_LOGIC;
|
123 |
|
|
rdusedw : out STD_LOGIC_VECTOR(7 downto 0);
|
124 |
|
|
wrfull : out STD_LOGIC;
|
125 |
|
|
wrusedw : out STD_LOGIC_VECTOR(7 downto 0));
|
126 |
|
|
end component esoc_fifo_256x112;
|
127 |
|
|
|
128 |
|
|
component esoc_fifo_256x16
|
129 |
|
|
port(
|
130 |
|
|
aclr : in STD_LOGIC := '0';
|
131 |
|
|
data : in STD_LOGIC_VECTOR(15 downto 0);
|
132 |
|
|
rdclk : in STD_LOGIC;
|
133 |
|
|
rdreq : in STD_LOGIC;
|
134 |
|
|
wrclk : in STD_LOGIC;
|
135 |
|
|
wrreq : in STD_LOGIC;
|
136 |
|
|
q : out STD_LOGIC_VECTOR(15 downto 0);
|
137 |
|
|
rdempty : out STD_LOGIC;
|
138 |
|
|
rdusedw : out STD_LOGIC_VECTOR(7 downto 0);
|
139 |
|
|
wrfull : out STD_LOGIC;
|
140 |
|
|
wrusedw : out STD_LOGIC_VECTOR(7 downto 0));
|
141 |
|
|
end component esoc_fifo_256x16;
|
142 |
|
|
|
143 |
|
|
component esoc_fifo_2kx32x64
|
144 |
|
|
port(
|
145 |
|
|
aclr : in STD_LOGIC := '0';
|
146 |
|
|
data : in STD_LOGIC_VECTOR(31 downto 0);
|
147 |
|
|
rdclk : in STD_LOGIC;
|
148 |
|
|
rdreq : in STD_LOGIC;
|
149 |
|
|
wrclk : in STD_LOGIC;
|
150 |
|
|
wrreq : in STD_LOGIC;
|
151 |
|
|
q : out STD_LOGIC_VECTOR(63 downto 0);
|
152 |
|
|
rdempty : out STD_LOGIC;
|
153 |
|
|
rdusedw : out STD_LOGIC_VECTOR(9 downto 0);
|
154 |
|
|
wrfull : out STD_LOGIC;
|
155 |
|
|
wrusedw : out STD_LOGIC_VECTOR(10 downto 0));
|
156 |
|
|
end component esoc_fifo_2kx32x64;
|
157 |
|
|
|
158 |
|
|
component esoc_fifo_2kx64x32
|
159 |
|
|
port(
|
160 |
|
|
aclr : in STD_LOGIC := '0';
|
161 |
|
|
data : in STD_LOGIC_VECTOR(63 downto 0);
|
162 |
|
|
rdclk : in STD_LOGIC;
|
163 |
|
|
rdreq : in STD_LOGIC;
|
164 |
|
|
wrclk : in STD_LOGIC;
|
165 |
|
|
wrreq : in STD_LOGIC;
|
166 |
|
|
q : out STD_LOGIC_VECTOR(31 downto 0);
|
167 |
|
|
rdempty : out STD_LOGIC;
|
168 |
|
|
rdusedw : out STD_LOGIC_VECTOR(10 downto 0);
|
169 |
|
|
wrfull : out STD_LOGIC;
|
170 |
|
|
wrusedw : out STD_LOGIC_VECTOR(9 downto 0));
|
171 |
|
|
end component esoc_fifo_2kx64x32;
|
172 |
|
|
|
173 |
|
|
begin
|
174 |
|
|
--Inbound FIFO's
|
175 |
|
|
--- Data Fifo
|
176 |
|
|
--- Info Fifo
|
177 |
|
|
--- Header Fifo
|
178 |
|
|
--Outbound FIFO's
|
179 |
|
|
--- Data Fifo
|
180 |
|
|
--- Info Fifo
|
181 |
|
|
u1: esoc_fifo_256x32
|
182 |
|
|
port map(
|
183 |
|
|
aclr => reset,
|
184 |
|
|
data => inbound_port_info,
|
185 |
|
|
rdclk => clk_data,
|
186 |
|
|
rdreq => inbound_proc_info_read,
|
187 |
|
|
wrclk => clk_control,
|
188 |
|
|
wrreq => inbound_port_info_write,
|
189 |
|
|
q => inbound_proc_info,
|
190 |
|
|
rdempty => inbound_proc_info_empty,
|
191 |
|
|
rdusedw => open,
|
192 |
|
|
wrfull => open,
|
193 |
|
|
wrusedw => open);
|
194 |
|
|
|
195 |
|
|
u4: esoc_fifo_256x112
|
196 |
|
|
port map(
|
197 |
|
|
aclr => reset,
|
198 |
|
|
data => inbound_port_header,
|
199 |
|
|
rdclk => clk_search,
|
200 |
|
|
rdreq => inbound_proc_header_read,
|
201 |
|
|
wrclk => clk_control,
|
202 |
|
|
wrreq => inbound_port_header_write,
|
203 |
|
|
q => inbound_proc_header,
|
204 |
|
|
rdempty => inbound_proc_header_empty,
|
205 |
|
|
rdusedw => open,
|
206 |
|
|
wrfull => open,
|
207 |
|
|
wrusedw => open);
|
208 |
|
|
|
209 |
|
|
u5: esoc_fifo_256x16
|
210 |
|
|
port map(
|
211 |
|
|
aclr => reset,
|
212 |
|
|
data => outbound_proc_info,
|
213 |
|
|
rdclk => clk_control,
|
214 |
|
|
rdreq => outbound_port_info_read,
|
215 |
|
|
wrclk => clk_data,
|
216 |
|
|
wrreq => outbound_proc_info_write,
|
217 |
|
|
q => outbound_port_info,
|
218 |
|
|
rdempty => outbound_port_info_empty,
|
219 |
|
|
rdusedw => open,
|
220 |
|
|
wrfull => open,
|
221 |
|
|
wrusedw => open);
|
222 |
|
|
|
223 |
|
|
u6: esoc_fifo_2kx32x64
|
224 |
|
|
port map(
|
225 |
|
|
aclr => reset,
|
226 |
|
|
data => inbound_port_data,
|
227 |
|
|
rdclk => clk_data,
|
228 |
|
|
rdreq => inbound_proc_data_read,
|
229 |
|
|
wrclk => clk_control,
|
230 |
|
|
wrreq => inbound_port_data_write,
|
231 |
|
|
q => inbound_proc_data,
|
232 |
|
|
rdempty => open,
|
233 |
|
|
rdusedw => inbound_rdusedw,
|
234 |
|
|
wrfull => open,
|
235 |
|
|
wrusedw => inbound_wrusedw);
|
236 |
|
|
|
237 |
|
|
u0: esoc_fifo_2kx64x32
|
238 |
|
|
port map(
|
239 |
|
|
aclr => reset,
|
240 |
|
|
data => outbound_proc_data,
|
241 |
|
|
rdclk => clk_control,
|
242 |
|
|
rdreq => outbound_port_data_read,
|
243 |
|
|
wrclk => clk_data,
|
244 |
|
|
wrreq => outbound_proc_data_write,
|
245 |
|
|
q => outbound_port_data,
|
246 |
|
|
rdempty => open,
|
247 |
|
|
rdusedw => open,
|
248 |
|
|
wrfull => outbound_proc_data_full,
|
249 |
|
|
wrusedw => open);
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
-- FIFO Behaviour: ST to Write FIFO latency is 1 clock cycle, take this into account
|
253 |
|
|
-- WRUSEDW latency is 1 clock cycle, take this into account
|
254 |
|
|
-- WRUSEDW becomes 2047 -> 0 when FIFO is completely full, take this into account
|
255 |
|
|
-- WRUSEDW must end on an even number of words due to 32/64 conversion, take this into account
|
256 |
|
|
-- Conclusion: set Almost Full threshold offset on 3
|
257 |
|
|
--
|
258 |
|
|
-- Ready Latency @ ST Interface is 2
|
259 |
|
|
--
|
260 |
|
|
-- Required Almost Full threshold: 1 + 1 + 1 + 1 + 2 = 6
|
261 |
|
|
--
|
262 |
|
|
inbound_port_data_full <= '1' when (2**inbound_wrusedw'length - to_integer(unsigned(inbound_wrusedw))) <= 6 else '0';
|
263 |
|
|
|
264 |
|
|
--
|
265 |
|
|
inbound_proc_data_full <= '1' when to_integer(unsigned(inbound_rdusedw)) = ((2**inbound_rdusedw'length)-1) else '0';
|
266 |
|
|
end architecture structure ; -- of esoc_port_storage
|
267 |
|
|
|