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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [esoc_port_processor_search.vhd] - Blame information for rev 46

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_port_processor_search
43
-- Last modified : Mon Apr 14 12:49:39 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_processor_search is
55
  generic(
56
    esoc_port_nr : integer := 0);
57
  port(
58
    clk_search           : in     std_logic;
59
    inbound_header       : in     std_logic_vector(111 downto 0);
60
    inbound_header_empty : in     std_logic;
61
    inbound_header_read  : out    std_logic;
62
    inbound_vlan_member  : in     STD_LOGIC_VECTOR(0 downto 0);
63
    reset                : in     std_logic;
64
    search_data          : out    STD_LOGIC_VECTOR(15 downto 0);
65
    search_done_cnt      : out    std_logic;
66
    search_drop_cnt      : out    std_logic;
67
    search_eof           : out    std_logic;
68
    search_gnt_wr        : in     std_logic;
69
    search_key           : out    std_logic_vector(63 downto 0);
70
    search_req           : out    std_logic;
71
    search_result        : in     std_logic_vector(esoc_port_count-1 downto 0);
72
    search_result_av     : in     std_logic;
73
    search_sof           : out    std_logic;
74
    search_write         : out    STD_LOGIC);
75
end entity esoc_port_processor_search;
76
 
77
--------------------------------------------------------------------------------
78
-- Object        : Architecture work.esoc_port_processor_search.esoc_port_processor_search
79
-- Last modified : Mon Apr 14 12:49:39 2014.
80
--------------------------------------------------------------------------------
81
 
82
 
83
architecture esoc_port_processor_search of esoc_port_processor_search is
84
 
85
type   search_states is (idle, send_key_1, send_key_2, wait_for_result);
86
signal search_state: search_states;
87
 
88
signal search_sof_o: std_logic;
89
signal search_eof_o: std_logic;
90
signal search_key_o: std_logic_vector(search_key'high downto 0);
91
 
92
signal inbound_header_empty_i: std_logic;
93
 
94
begin
95
 
96
-- control the shared bus to the search engine
97
search_sof <=  search_sof_o  when search_gnt_wr = '1' else 'Z';
98
search_eof <=  search_eof_o  when search_gnt_wr = '1' else 'Z';
99
search_key <=  search_key_o  when search_gnt_wr = '1' else (others => 'Z');
100
 
101
--=============================================================================================================
102
-- Process                : 
103
-- Description  : 
104
--=============================================================================================================    
105
debug:      process(clk_search, reset)
106
            begin
107
              if reset = '1' then
108
                inbound_header_read    <= '0';
109
                inbound_header_empty_i <= '0';
110
 
111
                search_req          <= '0';
112
                search_sof_o        <= '0';
113
                search_eof_o        <= '0';
114
                search_key_o        <= (others => '0');
115
 
116
                search_data         <= (others => '0');
117
                search_write        <= '0';
118
 
119
                search_done_cnt     <= '0';
120
                search_drop_cnt     <= '0';
121
 
122
                search_state        <= idle;
123
 
124
              elsif clk_search'event and clk_search = '1' then
125
                -- reset one clock active signals
126
                search_eof_o        <= '0';
127
                search_done_cnt     <= '0';
128
                search_drop_cnt     <= '0';
129
                search_write        <= '0';
130
                inbound_header_read <= '0';
131
 
132
                -- delay the empty signal to proces the VLAN membership of the first packet correctly. When the header 
133
                -- data of first packet is written in de header FIFO the empty signal deasserts, but in parallel (outside 
134
                -- this entity) the VLAN ID RAM is addressed. This entity detects the deasserted EMTPY signal and expects 
135
                -- the corresponding VLAN membership info from the VLAN ID RAM, which is not available at that time!
136
                -- This is only applicable if the first header in the FIFO is from a tagged packet and the EMPTY latency of the
137
                -- FIFO is 0, the latter is not the case for Altera, so you can skip this delay by using the inbound_header_empty
138
                -- iso. the inbound_header_empty_i signal in the search_state idle .... check simulation!
139
                inbound_header_empty_i <= inbound_header_empty;
140
 
141
                case search_state is
142
                  when idle             =>  -- used to insert a clock delay
143
                                            search_state <= send_key_1;
144
 
145
                  when send_key_1       =>  -- check for new header data,new header data means new packet is coming or already available
146
                                            if inbound_header_empty = '0' then
147
                                              -- Is the inbound port member of the VID of the tagged packet or 
148
                                              -- is the packet untagged and does the switch use the port default VID?
149
                                              if inbound_header(esoc_inbound_header_vlan_flag) = '0' or inbound_vlan_member = "1" then
150
                                                -- Request bus to the search engine, prepare to transfer VID and DA
151
                                                search_req   <= '1';
152
                                                search_sof_o <= '1';
153
                                                search_key_o(esoc_search_bus_vlan+11 downto esoc_search_bus_vlan) <= inbound_header(esoc_inbound_header_vlan+11 downto esoc_inbound_header_vlan);
154
                                                search_key_o(esoc_search_bus_mac+47 downto esoc_search_bus_mac)   <= inbound_header(esoc_inbound_header_dmac_lo+47 downto esoc_inbound_header_dmac_lo);
155
                                                search_state <= send_key_2;
156
 
157
                                              -- Packet is tagged and the inbound port is not member of the packet VID 
158
                                              else
159
                                                -- Write destination port (none) and acknowledge header data
160
                                                search_data         <= (others => '0');
161
                                                search_write        <= '1';
162
                                                inbound_header_read <= '1';
163
                                                search_drop_cnt     <= '1';
164
                                                search_state        <= idle;
165
                                              end if;
166
                                            end if;
167
 
168
                  when send_key_2       =>  -- VID and DA Address accepted when granted, provide Port Number and SA Address for learning process
169
                                            if search_gnt_wr = '1' then
170
                                              search_key_o(esoc_search_bus_sport+15 downto esoc_search_bus_sport) <= (others => '0');
171
                                              search_key_o(esoc_search_bus_sport+esoc_port_nr) <= '1';
172
                                              search_key_o(esoc_search_bus_mac+47 downto esoc_search_bus_mac) <= inbound_header(esoc_inbound_header_smac_lo+47 downto esoc_inbound_header_smac_lo);
173
                                              search_sof_o <= '0';
174
                                              inbound_header_read <= '1';
175
                                              search_state <= wait_for_result;
176
                                            end if;
177
 
178
                  when wait_for_result  =>  -- Wait for result from search engine
179
                                            if search_result_av = '1' then
180
                                              -- Write destination ports, skip your self, acknowledge header data
181
                                              search_data(search_result'high downto 0) <= search_result;
182
                                              search_data(esoc_port_nr) <= '0';
183
                                              search_write        <= '1';
184
 
185
                                              search_done_cnt     <= '1';
186
                                              search_req          <= '0';
187
                                              search_eof_o        <= '1';
188
                                              search_state        <= send_key_1;
189
                                            end if;
190
 
191
                  when others           =>  search_state <= idle;
192
                end case;
193
              end if;
194
            end process;
195
end architecture esoc_port_processor_search ; -- of esoc_port_processor_search
196
 

powered by: WebSVN 2.1.0

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