1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Title : ring toplevel with packet encoder-decoders.
|
3 |
|
|
-- Project :
|
4 |
|
|
-------------------------------------------------------------------------------
|
5 |
|
|
-- File : ring_with_pkt_codec_top.vhd
|
6 |
|
|
-- Author : Antti Alhonen
|
7 |
|
|
-- Company :
|
8 |
|
|
-- Last update: 2011-08-22
|
9 |
|
|
-- Platform :
|
10 |
|
|
-------------------------------------------------------------------------------
|
11 |
|
|
-- Description:
|
12 |
|
|
-------------------------------------------------------------------------------
|
13 |
|
|
-- Revisions :
|
14 |
|
|
-- Date Version Author Description
|
15 |
|
|
-- 2009/08/07 1.0 alhonena Created
|
16 |
|
|
-------------------------------------------------------------------------------
|
17 |
|
|
|
18 |
|
|
-------------------------------------------------------------------------------
|
19 |
|
|
-- Copyright (c) 2011 Tampere University of Technology
|
20 |
|
|
-------------------------------------------------------------------------------
|
21 |
|
|
-- This file is part of Transaction Generator.
|
22 |
|
|
--
|
23 |
|
|
-- Transaction Generator is free software: you can redistribute it and/or
|
24 |
|
|
-- modify it under the terms of the Lesser GNU General Public License as
|
25 |
|
|
-- published by the Free Software Foundation, either version 3 of the License,
|
26 |
|
|
-- or (at your option) any later version.
|
27 |
|
|
--
|
28 |
|
|
-- Transaction Generator is distributed in the hope that it will be useful,
|
29 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
30 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
31 |
|
|
-- Lesser GNU General Public License for more details.
|
32 |
|
|
--
|
33 |
|
|
-- You should have received a copy of the Lesser GNU General Public License
|
34 |
|
|
-- along with Transaction Generator. If not, see
|
35 |
|
|
-- <http://www.gnu.org/licenses/>.
|
36 |
|
|
-------------------------------------------------------------------------------
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
library ieee;
|
40 |
|
|
use ieee.std_logic_1164.all;
|
41 |
|
|
|
42 |
|
|
entity ring_with_pkt_codec_top is
|
43 |
|
|
|
44 |
|
|
generic (
|
45 |
|
|
n_ag_g : integer;
|
46 |
|
|
stfwd_en_g : integer;
|
47 |
|
|
diag_en_g : integer;
|
48 |
|
|
data_width_g : integer;
|
49 |
|
|
addr_width_g : integer;
|
50 |
|
|
packet_length_g : integer;
|
51 |
|
|
tx_len_width_g : integer;
|
52 |
|
|
timeout_g : integer;
|
53 |
|
|
fill_packet_g : integer;
|
54 |
|
|
lut_en_g : integer;
|
55 |
|
|
len_flit_en_g : integer;
|
56 |
|
|
oaddr_flit_en_g : integer;
|
57 |
|
|
status_en_g : integer;
|
58 |
|
|
fifo_depth_g : integer;
|
59 |
|
|
ring_freq_g : integer;
|
60 |
|
|
ip_freq_g : integer);
|
61 |
|
|
|
62 |
|
|
port (
|
63 |
|
|
clk_net : in std_logic;
|
64 |
|
|
clk_ip : in std_logic;
|
65 |
|
|
rst_n : in std_logic;
|
66 |
|
|
|
67 |
|
|
-- Data coming from IP to network
|
68 |
|
|
tx_av_in : in std_logic_vector (n_ag_g-1 downto 0);
|
69 |
|
|
tx_data_in : in std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
70 |
|
|
tx_we_in : in std_logic_vector (n_ag_g-1 downto 0);
|
71 |
|
|
tx_txlen_in : in std_logic_vector (n_ag_g * tx_len_width_g -1 downto 0);
|
72 |
|
|
tx_full_out : out std_logic_vector (n_ag_g-1 downto 0);
|
73 |
|
|
tx_empty_out : out std_logic_vector (n_ag_g-1 downto 0); -- not needed in most cases.
|
74 |
|
|
|
75 |
|
|
-- Data going from network to IP
|
76 |
|
|
rx_av_out : out std_logic_vector (n_ag_g-1 downto 0);
|
77 |
|
|
rx_data_out : out std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
78 |
|
|
rx_re_in : in std_logic_vector (n_ag_g-1 downto 0);
|
79 |
|
|
rx_empty_out : out std_logic_vector (n_ag_g-1 downto 0)
|
80 |
|
|
|
81 |
|
|
);
|
82 |
|
|
|
83 |
|
|
end ring_with_pkt_codec_top;
|
84 |
|
|
|
85 |
|
|
architecture structural of ring_with_pkt_codec_top is
|
86 |
|
|
|
87 |
|
|
component enc_dec_1d
|
88 |
|
|
generic (
|
89 |
|
|
n_ag_g : integer;
|
90 |
|
|
wait_empty_fifo_g : integer;
|
91 |
|
|
data_width_g : integer;
|
92 |
|
|
addr_width_g : integer;
|
93 |
|
|
packet_length_g : integer;
|
94 |
|
|
tx_len_width_g : integer;
|
95 |
|
|
timeout_g : integer;
|
96 |
|
|
fill_packet_g : integer;
|
97 |
|
|
lut_en_g : integer;
|
98 |
|
|
net_type_g : integer;
|
99 |
|
|
len_flit_en_g : integer;
|
100 |
|
|
oaddr_flit_en_g : integer;
|
101 |
|
|
status_en_g : integer);
|
102 |
|
|
port (
|
103 |
|
|
Clk : in std_logic;
|
104 |
|
|
Rst_n : in std_logic;
|
105 |
|
|
av_ip_enc_in : in std_logic_vector (n_ag_g-1 downto 0);
|
106 |
|
|
data_ip_enc_in : in std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
107 |
|
|
we_ip_enc_in : in std_logic_vector (n_ag_g-1 downto 0);
|
108 |
|
|
len_ip_enc_in : in std_logic_vector (n_ag_g*tx_len_width_g-1 downto 0);
|
109 |
|
|
full_enc_ip_out : out std_logic_vector (n_ag_g-1 downto 0);
|
110 |
|
|
empty_enc_ip_out : out std_logic_vector (n_ag_g-1 downto 0);
|
111 |
|
|
av_enc_net_out : out std_logic_vector (n_ag_g-1 downto 0);
|
112 |
|
|
data_enc_net_out : out std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
113 |
|
|
we_enc_net_out : out std_logic_vector (n_ag_g-1 downto 0);
|
114 |
|
|
full_net_enc_in : in std_logic_vector (n_ag_g-1 downto 0);
|
115 |
|
|
empty_net_enc_in : in std_logic_vector (n_ag_g-1 downto 0);
|
116 |
|
|
data_net_dec_in : in std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
117 |
|
|
re_dec_net_out : out std_logic_vector (n_ag_g-1 downto 0);
|
118 |
|
|
full_net_dec_in : in std_logic_vector (n_ag_g-1 downto 0);
|
119 |
|
|
empty_net_dec_in : in std_logic_vector (n_ag_g-1 downto 0);
|
120 |
|
|
av_dec_ip_out : out std_logic_vector (n_ag_g-1 downto 0);
|
121 |
|
|
data_dec_ip_out : out std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
122 |
|
|
re_ip_dec_in : in std_logic_vector (n_ag_g-1 downto 0);
|
123 |
|
|
empty_dec_ip_out : out std_logic_vector (n_ag_g-1 downto 0));
|
124 |
|
|
end component;
|
125 |
|
|
|
126 |
|
|
component ring
|
127 |
|
|
generic (
|
128 |
|
|
nbr_of_routers_g : integer;
|
129 |
|
|
diag_en_g : integer;
|
130 |
|
|
data_width_g : integer;
|
131 |
|
|
stfwd_en_g : integer;
|
132 |
|
|
pkt_len_g : integer;
|
133 |
|
|
len_flit_en_g : integer;
|
134 |
|
|
oaddr_flit_en_g : integer;
|
135 |
|
|
fifo_depth_g : integer;
|
136 |
|
|
net_freq_g : integer;
|
137 |
|
|
ip_freq_g : integer);
|
138 |
|
|
port (
|
139 |
|
|
clk_net : in std_logic;
|
140 |
|
|
clk_ip : in std_logic;
|
141 |
|
|
rst_n : in std_logic;
|
142 |
|
|
tx_data_in : in std_logic_vector( nbr_of_routers_g * data_width_g-1 downto 0 );
|
143 |
|
|
tx_we_in : in std_logic_vector ( nbr_of_routers_g - 1 downto 0 );
|
144 |
|
|
tx_empty_out : out std_logic_vector ( nbr_of_routers_g - 1 downto 0 );
|
145 |
|
|
tx_full_out : out std_logic_vector ( nbr_of_routers_g - 1 downto 0 );
|
146 |
|
|
rx_data_out : out std_logic_vector( nbr_of_routers_g*data_width_g-1 downto 0 );
|
147 |
|
|
rx_re_in : in std_logic_vector (nbr_of_routers_g-1 downto 0);
|
148 |
|
|
rx_empty_out : out std_logic_vector (nbr_of_routers_g-1 downto 0);
|
149 |
|
|
rx_full_out : out std_logic_vector (nbr_of_routers_g-1 downto 0));
|
150 |
|
|
end component;
|
151 |
|
|
|
152 |
|
|
signal av_enc_net : std_logic_vector (n_ag_g-1 downto 0);
|
153 |
|
|
signal data_enc_net : std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
154 |
|
|
signal we_enc_net : std_logic_vector (n_ag_g-1 downto 0);
|
155 |
|
|
signal full_net_enc : std_logic_vector (n_ag_g-1 downto 0);
|
156 |
|
|
signal empty_net_enc : std_logic_vector (n_ag_g-1 downto 0);
|
157 |
|
|
signal data_net_dec : std_logic_vector (n_ag_g * data_width_g -1 downto 0);
|
158 |
|
|
signal re_dec_net : std_logic_vector (n_ag_g-1 downto 0);
|
159 |
|
|
signal full_net_dec : std_logic_vector (n_ag_g-1 downto 0);
|
160 |
|
|
signal empty_net_dec : std_logic_vector (n_ag_g-1 downto 0);
|
161 |
|
|
|
162 |
|
|
begin -- structural
|
163 |
|
|
|
164 |
|
|
enc_dec : enc_dec_1d
|
165 |
|
|
generic map (
|
166 |
|
|
n_ag_g => n_ag_g,
|
167 |
|
|
wait_empty_fifo_g => stfwd_en_g,
|
168 |
|
|
data_width_g => data_width_g,
|
169 |
|
|
addr_width_g => addr_width_g,
|
170 |
|
|
packet_length_g => packet_length_g,
|
171 |
|
|
tx_len_width_g => tx_len_width_g,
|
172 |
|
|
timeout_g => timeout_g,
|
173 |
|
|
fill_packet_g => fill_packet_g,
|
174 |
|
|
lut_en_g => lut_en_g,
|
175 |
|
|
net_type_g => 1, -- 1 = ring
|
176 |
|
|
len_flit_en_g => len_flit_en_g,
|
177 |
|
|
oaddr_flit_en_g => oaddr_flit_en_g,
|
178 |
|
|
status_en_g => status_en_g
|
179 |
|
|
)
|
180 |
|
|
port map (
|
181 |
|
|
Clk => clk_ip,
|
182 |
|
|
Rst_n => rst_n,
|
183 |
|
|
av_ip_enc_in => tx_av_in,
|
184 |
|
|
data_ip_enc_in => tx_data_in,
|
185 |
|
|
we_ip_enc_in => tx_we_in,
|
186 |
|
|
len_ip_enc_in => tx_txlen_in,
|
187 |
|
|
full_enc_ip_out => tx_full_out,
|
188 |
|
|
empty_enc_ip_out => tx_empty_out,
|
189 |
|
|
av_enc_net_out => av_enc_net,
|
190 |
|
|
data_enc_net_out => data_enc_net,
|
191 |
|
|
we_enc_net_out => we_enc_net,
|
192 |
|
|
full_net_enc_in => full_net_enc,
|
193 |
|
|
empty_net_enc_in => empty_net_enc,
|
194 |
|
|
data_net_dec_in => data_net_dec,
|
195 |
|
|
re_dec_net_out => re_dec_net,
|
196 |
|
|
full_net_dec_in => full_net_dec,
|
197 |
|
|
empty_net_dec_in => empty_net_dec,
|
198 |
|
|
av_dec_ip_out => rx_av_out,
|
199 |
|
|
data_dec_ip_out => rx_data_out,
|
200 |
|
|
re_ip_dec_in => rx_re_in,
|
201 |
|
|
empty_dec_ip_out => rx_empty_out
|
202 |
|
|
);
|
203 |
|
|
|
204 |
|
|
ringen : ring
|
205 |
|
|
generic map (
|
206 |
|
|
nbr_of_routers_g => n_ag_g,
|
207 |
|
|
diag_en_g => diag_en_g,
|
208 |
|
|
data_width_g => data_width_g,
|
209 |
|
|
stfwd_en_g => stfwd_en_g,
|
210 |
|
|
pkt_len_g => packet_length_g,
|
211 |
|
|
len_flit_en_g => len_flit_en_g,
|
212 |
|
|
oaddr_flit_en_g => oaddr_flit_en_g,
|
213 |
|
|
fifo_depth_g => fifo_depth_g,
|
214 |
|
|
net_freq_g => ring_freq_g,
|
215 |
|
|
ip_freq_g => ip_freq_g
|
216 |
|
|
)
|
217 |
|
|
port map (
|
218 |
|
|
clk_net => clk_net,
|
219 |
|
|
clk_ip => clk_ip,
|
220 |
|
|
rst_n => rst_n,
|
221 |
|
|
tx_data_in => data_enc_net,
|
222 |
|
|
tx_we_in => we_enc_net,
|
223 |
|
|
tx_empty_out => empty_net_enc,
|
224 |
|
|
tx_full_out => full_net_enc,
|
225 |
|
|
rx_data_out => data_net_dec,
|
226 |
|
|
rx_re_in => re_dec_net,
|
227 |
|
|
rx_empty_out => empty_net_dec,
|
228 |
|
|
rx_full_out => full_net_dec);
|
229 |
|
|
|
230 |
|
|
end structural;
|