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_sa_store
|
43 |
|
|
-- Last modified : Mon Apr 14 12:50:14 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_sa_store is
|
55 |
|
|
port(
|
56 |
|
|
clk_search : in std_logic;
|
57 |
|
|
reset : in std_logic;
|
58 |
|
|
search_eof : in std_logic;
|
59 |
|
|
search_key : in std_logic_vector(63 downto 0);
|
60 |
|
|
search_sa_overload_cnt : out std_logic;
|
61 |
|
|
search_sa_store_d : out STD_LOGIC_VECTOR(79 downto 0);
|
62 |
|
|
search_sa_store_full : in STD_LOGIC;
|
63 |
|
|
search_sa_store_wr : out STD_LOGIC;
|
64 |
|
|
search_sof : in std_logic);
|
65 |
|
|
end entity esoc_search_engine_sa_store;
|
66 |
|
|
|
67 |
|
|
--------------------------------------------------------------------------------
|
68 |
|
|
-- Object : Architecture work.esoc_search_engine_sa_store.esoc_search_engine_sa_store
|
69 |
|
|
-- Last modified : Mon Apr 14 12:50:14 2014.
|
70 |
|
|
--------------------------------------------------------------------------------
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
architecture esoc_search_engine_sa_store of esoc_search_engine_sa_store is
|
74 |
|
|
|
75 |
|
|
type store_sa_states is (idle, wait_sa, wait_full);
|
76 |
|
|
signal store_sa_state: store_sa_states;
|
77 |
|
|
|
78 |
|
|
begin
|
79 |
|
|
|
80 |
|
|
--=============================================================================================================
|
81 |
|
|
-- Process : proces store SA address for further processing
|
82 |
|
|
-- Description :
|
83 |
|
|
--=============================================================================================================
|
84 |
|
|
store_sa: process(clk_search, reset)
|
85 |
|
|
begin
|
86 |
|
|
if reset = '1' then
|
87 |
|
|
search_sa_store_wr <= '0';
|
88 |
|
|
search_sa_store_d <= (others => '0');
|
89 |
|
|
search_sa_overload_cnt <= '0';
|
90 |
|
|
store_sa_state <= idle;
|
91 |
|
|
|
92 |
|
|
elsif clk_search'event and clk_search = '1' then
|
93 |
|
|
-- clear one-clock active signals
|
94 |
|
|
search_sa_store_wr <= '0';
|
95 |
|
|
search_sa_overload_cnt <= '0';
|
96 |
|
|
|
97 |
|
|
-- define unused bits to avoid inferred latch warning during analysis & synthesis
|
98 |
|
|
search_sa_store_d(esoc_search_entry_valid) <= '0';
|
99 |
|
|
search_sa_store_d(esoc_search_entry_update) <= '0';
|
100 |
|
|
search_sa_store_d(esoc_search_entry_unused2 downto esoc_search_entry_unused1) <= (others => '0');
|
101 |
|
|
|
102 |
|
|
case store_sa_state is
|
103 |
|
|
when idle => -- wait for start of frame, first data is VID + DA, skip DA, store VID, wait for SA and port number ... report when storage is full!
|
104 |
|
|
if search_sof = '1' then
|
105 |
|
|
if search_sa_store_full = '0' then
|
106 |
|
|
search_sa_store_d(esoc_search_entry_vlan+11 downto esoc_search_entry_vlan) <= search_key(esoc_search_bus_vlan+11 downto esoc_search_bus_vlan);
|
107 |
|
|
store_sa_state <= wait_sa;
|
108 |
|
|
else
|
109 |
|
|
search_sa_overload_cnt <= '1';
|
110 |
|
|
store_sa_state <= wait_full;
|
111 |
|
|
end if;
|
112 |
|
|
end if;
|
113 |
|
|
|
114 |
|
|
when wait_sa => -- get Source Port + SA and calculate hash pointer (additional delay may be required after synthesis, due to large XOR tree)
|
115 |
|
|
search_sa_store_d(esoc_search_entry_destination+15 downto esoc_search_entry_destination) <= search_key(esoc_search_bus_sport+15 downto esoc_search_bus_sport);
|
116 |
|
|
search_sa_store_d(esoc_search_entry_mac+47 downto esoc_search_entry_mac) <= search_key(esoc_search_bus_mac+47 downto esoc_search_bus_mac);
|
117 |
|
|
search_sa_store_wr <= '1';
|
118 |
|
|
store_sa_state <= idle;
|
119 |
|
|
|
120 |
|
|
when wait_full => if search_sa_store_full = '0' then
|
121 |
|
|
store_sa_state <= idle;
|
122 |
|
|
end if;
|
123 |
|
|
|
124 |
|
|
when others => store_sa_state <= idle;
|
125 |
|
|
end case;
|
126 |
|
|
end if;
|
127 |
|
|
end process;
|
128 |
|
|
end architecture esoc_search_engine_sa_store ; -- of esoc_search_engine_sa_store
|
129 |
|
|
|