1 |
19 |
mcwaccent |
----------------------------------------------------------------------------------
|
2 |
|
|
--
|
3 |
|
|
-- This file is a part of Technica Corporation Wizardry Project
|
4 |
|
|
--
|
5 |
|
|
-- Copyright (C) 2004-2009, Technica Corporation
|
6 |
|
|
--
|
7 |
|
|
-- This program is free software: you can redistribute it and/or modify
|
8 |
|
|
-- it under the terms of the GNU General Public License as published by
|
9 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
10 |
|
|
-- (at your option) any later version.
|
11 |
|
|
--
|
12 |
|
|
-- This program is distributed in the hope that it will be useful,
|
13 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
-- GNU General Public License for more details.
|
16 |
|
|
--
|
17 |
|
|
-- You should have received a copy of the GNU General Public License
|
18 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19 |
|
|
--
|
20 |
|
|
----------------------------------------------------------------------------------
|
21 |
|
|
----------------------------------------------------------------------------------
|
22 |
|
|
-- Module Name: port_block - Structural
|
23 |
|
|
-- Project Name: Wizardry
|
24 |
|
|
-- Target Devices: Virtex 4 ML401
|
25 |
|
|
-- Description: Keeps track of which ports have been encountered
|
26 |
|
|
-- Revision: 1.0
|
27 |
|
|
-- Additional Comments:
|
28 |
|
|
--
|
29 |
|
|
----------------------------------------------------------------------------------
|
30 |
|
|
library IEEE;
|
31 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
32 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
33 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
34 |
|
|
use work.port_block_Constants.all;
|
35 |
|
|
---- Uncomment the following library declaration if instantiating
|
36 |
|
|
---- any Xilinx primitives in this code.
|
37 |
|
|
--library UNISIM;
|
38 |
|
|
--use UNISIM.VComponents.all;
|
39 |
|
|
|
40 |
|
|
entity port_block is
|
41 |
|
|
Port ( sys_clock : in std_logic;
|
42 |
|
|
clock : in STD_LOGIC;
|
43 |
|
|
reset : in STD_LOGIC;
|
44 |
|
|
reset_100 : in std_logic;
|
45 |
|
|
fifo_empty_out : out std_logic;
|
46 |
|
|
fifo_full_out : out std_logic;
|
47 |
|
|
field_data : in std_logic_vector(31 downto 0);
|
48 |
|
|
field_type : in std_logic_vector(7 downto 0);
|
49 |
|
|
data_ready : in std_logic;
|
50 |
|
|
-- config_trig : in std_logic;
|
51 |
|
|
frame_counters : in frame_counters_type;
|
52 |
|
|
ack_i : in STD_LOGIC;
|
53 |
|
|
dat_i : in STD_LOGIC_vector(31 downto 0);
|
54 |
|
|
dat_o : out STD_LOGIC_VECTOR (31 downto 0);
|
55 |
|
|
adr_o : out STD_LOGIC_VECTOR (21 downto 0);
|
56 |
|
|
we_o : out STD_LOGIC;
|
57 |
|
|
cyc_o : out STD_LOGIC;
|
58 |
|
|
stb_o : out STD_LOGIC;
|
59 |
|
|
fifo_push_count : out std_logic_vector(11 downto 0));
|
60 |
|
|
end port_block;
|
61 |
|
|
|
62 |
|
|
architecture Behavioral of port_block is
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
signal lut_ptr : integer range 0 to MAX_NUM_PORTS_2_FIND-1 := 0;
|
66 |
|
|
signal lut_info : lut_check;
|
67 |
|
|
signal fifo_push,fifo_pop,fifo_full,fifo_empty : std_logic;
|
68 |
|
|
signal fifo_push_s : std_logic;
|
69 |
|
|
signal fifo_empty_delay_0,fifo_empty_delay_1,fifo_empty_delay_2 : std_logic := '1';
|
70 |
|
|
signal fifo_data_out,fifo_data_in : std_logic_vector(24 downto 0);
|
71 |
|
|
signal fifo_data_in_s : std_logic_vector(24 downto 0);
|
72 |
|
|
signal ready_check : std_logic;
|
73 |
|
|
signal fifo0 : std_logic := '1';
|
74 |
|
|
signal load_lut : std_logic;
|
75 |
|
|
signal enable_lut_search : std_logic;
|
76 |
|
|
signal counter_data : std_Logic_Vector(31 downto 0);
|
77 |
|
|
--signal fifo_push_count : std_logic_vector(11 downto 0);
|
78 |
|
|
|
79 |
|
|
component fifo_ppt is
|
80 |
|
|
Port ( reset : in STD_LOGIC;
|
81 |
|
|
push_clock : in STD_LOGIC;
|
82 |
|
|
push : in STD_LOGIC;
|
83 |
|
|
fifo_data_in : in std_logic_vector(24 downto 0);
|
84 |
|
|
full : out STD_LOGIC;
|
85 |
|
|
pop_clock : in STD_LOGIC;
|
86 |
|
|
pop : in STD_LOGIC;
|
87 |
|
|
fifo_data_out : out std_logic_vector(24 downto 0);
|
88 |
|
|
empty : out STD_LOGIC;
|
89 |
|
|
fifo_push_count : out std_logic_vector(11 downto 0));
|
90 |
|
|
end component;
|
91 |
|
|
|
92 |
|
|
component lut_ppt is
|
93 |
|
|
port(
|
94 |
|
|
clock : in std_logic;
|
95 |
|
|
reset : in std_logic;
|
96 |
|
|
enable_lut_search : in std_logic;
|
97 |
|
|
load_lut : in std_logic;
|
98 |
|
|
lut_data : in std_Logic_vector(16 downto 0);
|
99 |
|
|
lut_info : out lut_check;
|
100 |
|
|
lut_ptr : out integer range 0 to MAX_NUM_PORTS_2_FIND-1
|
101 |
|
|
);
|
102 |
|
|
end component;
|
103 |
|
|
|
104 |
|
|
component fsm_ppt is
|
105 |
|
|
Port ( clock : in STD_LOGIC;
|
106 |
|
|
reset : in STD_LOGIC;
|
107 |
|
|
frame_counters : in frame_counters_type;
|
108 |
|
|
fifo_empty : in STD_LOGIC;
|
109 |
|
|
lut_info : in lut_check;
|
110 |
|
|
lut_ptr : in integer range 0 to MAX_NUM_PORTS_2_FIND-1;
|
111 |
|
|
fifo_data_out : in STD_LOGIC_VECTOR (16 downto 0);
|
112 |
|
|
ack_i : in STD_LOGIC;
|
113 |
|
|
dat_i : in STD_LOGIC_VECTOR (31 downto 0);
|
114 |
|
|
dat_o : out STD_LOGIC_VECTOR (31 downto 0);
|
115 |
|
|
adr_o : out STD_LOGIC_VECTOR (21 downto 0);
|
116 |
|
|
cyc_o : out STD_LOGIC;
|
117 |
|
|
stb_o : out STD_LOGIC;
|
118 |
|
|
we_o : out STD_LOGIC;
|
119 |
|
|
fifo_pop : out STD_LOGIC;
|
120 |
|
|
load_lut : out STD_LOGIC;
|
121 |
|
|
enable_lut_search : out STD_LOGIC);
|
122 |
|
|
end component;
|
123 |
|
|
|
124 |
|
|
begin
|
125 |
|
|
fifo_empty_out <= fifo_empty;
|
126 |
|
|
fifo_full_out <= fifo_full;
|
127 |
|
|
|
128 |
|
|
fifo: fifo_ppt
|
129 |
|
|
Port map( reset => reset,
|
130 |
|
|
push_clock => clock,
|
131 |
|
|
push => fifo_push,
|
132 |
|
|
fifo_data_in => fifo_data_in,
|
133 |
|
|
full => fifo_full,
|
134 |
|
|
pop_clock => sys_clock,
|
135 |
|
|
pop => fifo_pop,
|
136 |
|
|
fifo_data_out => fifo_data_out,
|
137 |
|
|
empty => fifo_empty,
|
138 |
|
|
fifo_push_count => fifo_push_count);
|
139 |
|
|
|
140 |
|
|
fifo_store:process(clock,reset,field_type,field_data,data_ready,fifo_full)
|
141 |
|
|
begin
|
142 |
|
|
if reset = '1' then
|
143 |
|
|
fifo_push_s <= '0';
|
144 |
|
|
fifo_data_in_s <= (others => '0');
|
145 |
|
|
elsif rising_Edge(Clock) then
|
146 |
|
|
if ((data_ready = '1' and fifo_full = '0') and (field_type = TCP_SOURCE OR field_type = UDP_SOURCE)) then
|
147 |
|
|
fifo_push_s <= '1';
|
148 |
|
|
fifo_data_in_s <= field_type & '0' & field_data(15 downto 0);
|
149 |
|
|
elsif ((data_ready = '1' and fifo_full = '0') and (field_type = TCP_destination OR field_type = UDP_destination)) then
|
150 |
|
|
fifo_push_s <= '1';
|
151 |
|
|
fifo_data_in_s <= field_type & '1' & field_data(15 downto 0);
|
152 |
|
|
else
|
153 |
|
|
fifo_push_s <= '0';
|
154 |
|
|
fifo_data_in_s <= fifo_data_in_s;
|
155 |
|
|
end if;
|
156 |
|
|
end if;
|
157 |
|
|
end process;
|
158 |
|
|
|
159 |
|
|
process(clock)
|
160 |
|
|
begin
|
161 |
|
|
if rising_edge(clock) then
|
162 |
|
|
fifo_push <= fifo_push_s;
|
163 |
|
|
fifo_data_in <= fifo_data_in_s;
|
164 |
|
|
end if;
|
165 |
|
|
end process;
|
166 |
|
|
|
167 |
|
|
lut_cmp: lut_ppt
|
168 |
|
|
port map(
|
169 |
|
|
clock => sys_clock,
|
170 |
|
|
reset => reset_100,
|
171 |
|
|
enable_lut_search => enable_lut_search,
|
172 |
|
|
load_lut => load_lut,
|
173 |
|
|
lut_data => fifo_data_out(16 downto 0),
|
174 |
|
|
lut_info => lut_info,
|
175 |
|
|
lut_ptr => lut_ptr
|
176 |
|
|
);
|
177 |
|
|
|
178 |
|
|
fsm_cmp: fsm_ppt
|
179 |
|
|
Port map( clock => sys_clock,
|
180 |
|
|
reset => reset_100,
|
181 |
|
|
frame_counters => frame_counters,
|
182 |
|
|
fifo_empty => fifo_empty,
|
183 |
|
|
lut_info => lut_info,
|
184 |
|
|
lut_ptr => lut_ptr,
|
185 |
|
|
fifo_data_out => fifo_data_out(16 downto 0),
|
186 |
|
|
ack_i => ack_i,
|
187 |
|
|
dat_i => dat_i,
|
188 |
|
|
dat_o => dat_o,
|
189 |
|
|
adr_o => adr_o,
|
190 |
|
|
cyc_o => cyc_o,
|
191 |
|
|
stb_o => stb_o,
|
192 |
|
|
we_o => we_o,
|
193 |
|
|
fifo_pop => fifo_pop,
|
194 |
|
|
load_lut => load_lut,
|
195 |
|
|
enable_lut_search => enable_lut_search);
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
end Behavioral;
|
199 |
|
|
|