OpenCores
URL https://opencores.org/ocsvn/esoc/esoc/trunk

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_search_engine.vhd] - Blame information for rev 42

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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_search_engine
43
-- Last modified : Mon Apr 14 12:49:54 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_search_engine is
55
  port(
56
    clk_control         : in     std_logic;
57
    clk_search          : in     std_logic;
58
    ctrl_address        : in     std_logic_vector(15 downto 0);
59
    ctrl_rd             : in     std_logic;
60
    ctrl_rddata         : out    std_logic_vector(31 downto 0);
61
    ctrl_wait           : out    std_logic;
62
    ctrl_wr             : in     std_logic;
63
    ctrl_wrdata         : in     std_logic_vector(31 downto 0);
64
    reset               : in     std_logic;
65
    search_eof          : in     std_logic;
66
    search_key          : in     std_logic_vector(63 downto 0);
67
    search_port_stalled : in     std_logic_vector(esoc_port_count-1 downto 0);
68
    search_result       : out    std_logic_vector(esoc_port_count-1 downto 0);
69
    search_result_av    : out    std_logic;
70
    search_sof          : in     std_logic);
71
end entity esoc_search_engine;
72
 
73
--------------------------------------------------------------------------------
74
-- Object        : Architecture work.esoc_search_engine.esoc_search
75
-- Last modified : Mon Apr 14 12:49:54 2014.
76
--------------------------------------------------------------------------------
77
 
78
architecture esoc_search of esoc_search_engine is
79
 
80
  signal q_b                       : STD_LOGIC_VECTOR(79 downto 0);
81
  signal sa_wren                   : STD_LOGIC := '1';
82
  signal data_b                    : STD_LOGIC_VECTOR(79 downto 0);
83
  signal address_b                 : STD_LOGIC_VECTOR(12 downto 0);
84
  signal wren_a                    : STD_LOGIC := '1';
85
  signal address_a                 : STD_LOGIC_VECTOR(12 downto 0);
86
  signal data_a                    : STD_LOGIC_VECTOR(79 downto 0);
87
  signal q_a                       : STD_LOGIC_VECTOR(79 downto 0);
88
  signal search_sa_drop_cnt        : std_logic;
89
  signal search_entry_age_time     : std_logic_vector(11 downto 0);
90
  signal wrreq                     : STD_LOGIC;
91
  signal data                      : STD_LOGIC_VECTOR(79 downto 0);
92
  signal wrfull                    : STD_LOGIC;
93
  signal rdreq                     : std_logic;
94
  signal q                         : STD_LOGIC_VECTOR(79 downto 0);
95
  signal rdempty                   : STD_LOGIC;
96
  signal search_sa_overload_cnt    : std_logic;
97
  signal rdusedw                   : STD_LOGIC_VECTOR(6 downto 0);
98
  signal search_entry_age_time_ena : std_logic;
99
  signal clk_en                    : std_logic;
100
  signal esoc_clk_en_gen_div       : integer;
101
  signal Net_0                     : STD_LOGIC;
102
  signal rden_b                    : STD_LOGIC := '1';
103
 
104
  component esoc_search_engine_da
105
    port(
106
      clk_search           : in     std_logic;
107
      reset                : in     std_logic;
108
      search_eof           : in     std_logic;
109
      search_key           : in     std_logic_vector(63 downto 0);
110
      search_port_stalled  : in     std_logic_vector(esoc_port_count-1 downto 0);
111
      search_result        : out    std_logic_vector(esoc_port_count-1 downto 0);
112
      search_result_av     : out    std_logic;
113
      search_sof           : in     std_logic;
114
      search_table_address : out    STD_LOGIC_VECTOR(12 downto 0);
115
      search_table_data    : out    STD_LOGIC_VECTOR(79 downto 0);
116
      search_table_q       : in     STD_LOGIC_VECTOR(79 downto 0);
117
      search_table_rden    : out    STD_LOGIC;
118
      search_table_wren    : out    STD_LOGIC);
119
  end component esoc_search_engine_da;
120
 
121
  component esoc_search_engine_sa
122
    port(
123
      clk_search                : in     std_logic;
124
      reset                     : in     std_logic;
125
      search_aging_tick         : in     std_logic;
126
      search_entry_age_time     : in     std_logic_vector(11 downto 0);
127
      search_entry_age_time_ena : in     std_logic;
128
      search_sa_drop_cnt        : out    std_logic;
129
      search_sa_store_empty     : in     std_logic;
130
      search_sa_store_q         : in     std_logic_vector(79 downto 0);
131
      search_sa_store_rd        : out    std_logic;
132
      search_sa_store_words     : in     STD_LOGIC_VECTOR(6 downto 0);
133
      search_table_address      : out    STD_LOGIC_VECTOR(12 downto 0);
134
      search_table_data         : out    STD_LOGIC_VECTOR(79 downto 0);
135
      search_table_q            : in     STD_LOGIC_VECTOR(79 downto 0);
136
      search_table_rden         : out    STD_LOGIC;
137
      search_table_wren         : out    STD_LOGIC);
138
  end component esoc_search_engine_sa;
139
 
140
  component esoc_search_engine_control
141
    port(
142
      clk_control               : in     std_logic;
143
      clk_search                : in     std_logic;
144
      ctrl_address              : in     std_logic_vector(15 downto 0);
145
      ctrl_rd                   : in     std_logic;
146
      ctrl_rddata               : out    std_logic_vector(31 downto 0);
147
      ctrl_wait                 : out    std_logic;
148
      ctrl_wr                   : in     std_logic;
149
      ctrl_wrdata               : in     std_logic_vector(31 downto 0);
150
      reset                     : in     std_logic;
151
      search_entry_age_time     : out    std_logic_vector(11 downto 0);
152
      search_entry_age_time_ena : out    std_logic;
153
      search_sa_drop_cnt        : in     std_logic;
154
      search_sa_overload_cnt    : in     std_logic);
155
  end component esoc_search_engine_control;
156
 
157
  component esoc_ram_8kx80
158
    port(
159
      address_a : in     STD_LOGIC_VECTOR(12 downto 0);
160
      address_b : in     STD_LOGIC_VECTOR(12 downto 0);
161
      data_a    : in     STD_LOGIC_VECTOR(79 downto 0);
162
      data_b    : in     STD_LOGIC_VECTOR(79 downto 0);
163
      wren_a    : in     STD_LOGIC := '0';
164
      wren_b    : in     STD_LOGIC := '0';
165
      q_a       : out    STD_LOGIC_VECTOR(79 downto 0);
166
      q_b       : out    STD_LOGIC_VECTOR(79 downto 0);
167
      clock     : in     STD_LOGIC := '1';
168
      rden_a    : in     STD_LOGIC := '1';
169
      rden_b    : in     STD_LOGIC := '1');
170
  end component esoc_ram_8kx80;
171
 
172
  component esoc_search_engine_sa_store
173
    port(
174
      clk_search             : in     std_logic;
175
      reset                  : in     std_logic;
176
      search_eof             : in     std_logic;
177
      search_key             : in     std_logic_vector(63 downto 0);
178
      search_sa_overload_cnt : out    std_logic;
179
      search_sa_store_d      : out    STD_LOGIC_VECTOR(79 downto 0);
180
      search_sa_store_full   : in     STD_LOGIC;
181
      search_sa_store_wr     : out    STD_LOGIC;
182
      search_sof             : in     std_logic);
183
  end component esoc_search_engine_sa_store;
184
 
185
  component esoc_fifo_128x80
186
    port(
187
      aclr    : in     STD_LOGIC := '0';
188
      data    : in     STD_LOGIC_VECTOR(79 downto 0);
189
      rdclk   : in     STD_LOGIC;
190
      rdreq   : in     STD_LOGIC;
191
      wrclk   : in     STD_LOGIC;
192
      wrreq   : in     STD_LOGIC;
193
      q       : out    STD_LOGIC_VECTOR(79 downto 0);
194
      rdempty : out    STD_LOGIC;
195
      rdusedw : out    STD_LOGIC_VECTOR(6 downto 0);
196
      wrfull  : out    STD_LOGIC;
197
      wrusedw : out    STD_LOGIC_VECTOR(6 downto 0));
198
  end component esoc_fifo_128x80;
199
 
200
  component esoc_clk_en_gen
201
    port(
202
      clk     : in     std_logic;
203
      clk_div : in     integer;
204
      clk_en  : out    std_logic;
205
      reset   : in     std_logic);
206
  end component esoc_clk_en_gen;
207
 
208
begin
209
  --Destination MAC 
210
  --Address Processing
211
  --Source MAC Address 
212
  --Processing and aging control
213
  --MAC Address Table
214
  --Search Engine Control
215
  --SA, VID and 
216
  --Source port buffer 
217
  esoc_clk_en_gen_div <= clk_search_en_div_1s when esoc_mode = normal else clk_search_en_div_1s_sim;
218
 
219
  u0: esoc_search_engine_da
220
    port map(
221
      clk_search           => clk_search,
222
      reset                => reset,
223
      search_eof           => search_eof,
224
      search_key           => search_key,
225
      search_port_stalled  => search_port_stalled,
226
      search_result        => search_result,
227
      search_result_av     => search_result_av,
228
      search_sof           => search_sof,
229
      search_table_address => address_a,
230
      search_table_data    => data_a,
231
      search_table_q       => q_a,
232
      search_table_rden    => Net_0,
233
      search_table_wren    => wren_a);
234
 
235
  u1: esoc_search_engine_sa
236
    port map(
237
      clk_search                => clk_search,
238
      reset                     => reset,
239
      search_aging_tick         => clk_en,
240
      search_entry_age_time     => search_entry_age_time,
241
      search_entry_age_time_ena => search_entry_age_time_ena,
242
      search_sa_drop_cnt        => search_sa_drop_cnt,
243
      search_sa_store_empty     => rdempty,
244
      search_sa_store_q         => q,
245
      search_sa_store_rd        => rdreq,
246
      search_sa_store_words     => rdusedw,
247
      search_table_address      => address_b,
248
      search_table_data         => data_b,
249
      search_table_q            => q_b,
250
      search_table_rden         => rden_b,
251
      search_table_wren         => sa_wren);
252
 
253
  u3: esoc_search_engine_control
254
    port map(
255
      clk_control               => clk_control,
256
      clk_search                => clk_search,
257
      ctrl_address              => ctrl_address,
258
      ctrl_rd                   => ctrl_rd,
259
      ctrl_rddata               => ctrl_rddata,
260
      ctrl_wait                 => ctrl_wait,
261
      ctrl_wr                   => ctrl_wr,
262
      ctrl_wrdata               => ctrl_wrdata,
263
      reset                     => reset,
264
      search_entry_age_time     => search_entry_age_time,
265
      search_entry_age_time_ena => search_entry_age_time_ena,
266
      search_sa_drop_cnt        => search_sa_drop_cnt,
267
      search_sa_overload_cnt    => search_sa_overload_cnt);
268
 
269
  u2: esoc_ram_8kx80
270
    port map(
271
      address_a => address_a,
272
      address_b => address_b,
273
      data_a    => data_a,
274
      data_b    => data_b,
275
      wren_a    => wren_a,
276
      wren_b    => sa_wren,
277
      q_a       => q_a,
278
      q_b       => q_b,
279
      clock     => clk_search,
280
      rden_a    => Net_0,
281
      rden_b    => rden_b);
282
 
283
  u5: esoc_search_engine_sa_store
284
    port map(
285
      clk_search             => clk_search,
286
      reset                  => reset,
287
      search_eof             => search_eof,
288
      search_key             => search_key,
289
      search_sa_overload_cnt => search_sa_overload_cnt,
290
      search_sa_store_d      => data,
291
      search_sa_store_full   => wrfull,
292
      search_sa_store_wr     => wrreq,
293
      search_sof             => search_sof);
294
 
295
  u6: esoc_fifo_128x80
296
    port map(
297
      aclr    => reset,
298
      data    => data,
299
      rdclk   => clk_search,
300
      rdreq   => rdreq,
301
      wrclk   => clk_search,
302
      wrreq   => wrreq,
303
      q       => q,
304
      rdempty => rdempty,
305
      rdusedw => rdusedw,
306
      wrfull  => wrfull,
307
      wrusedw => open);
308
 
309
  u7: esoc_clk_en_gen
310
    port map(
311
      clk     => clk_search,
312
      clk_div => esoc_clk_en_gen_div,
313
      clk_en  => clk_en,
314
      reset   => reset);
315
 
316
end architecture esoc_search ; -- of esoc_search_engine
317
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.