1 |
2 |
schelleg |
|
2 |
|
|
-----------------------------------------------------------------------------
|
3 |
|
|
-- NoCem -- Network on Chip Emulation Tool for System on Chip Research
|
4 |
|
|
-- and Implementations
|
5 |
|
|
--
|
6 |
|
|
-- Copyright (C) 2006 Graham Schelle, Dirk Grunwald
|
7 |
|
|
--
|
8 |
|
|
-- This program is free software; you can redistribute it and/or
|
9 |
|
|
-- modify it under the terms of the GNU General Public License
|
10 |
|
|
-- as published by the Free Software Foundation; either version 2
|
11 |
|
|
-- of the License, or (at your option) any later version.
|
12 |
|
|
--
|
13 |
|
|
-- This program is distributed in the hope that it will be useful,
|
14 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
-- GNU General Public License for more details.
|
17 |
|
|
--
|
18 |
|
|
-- You should have received a copy of the GNU General Public License
|
19 |
|
|
-- along with this program; if not, write to the Free Software
|
20 |
|
|
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
21 |
|
|
-- 02110-1301, USA.
|
22 |
|
|
--
|
23 |
|
|
-- The authors can be contacted by email: <schelleg,grunwald>@cs.colorado.edu
|
24 |
|
|
--
|
25 |
|
|
-- or by mail: Campus Box 430, Department of Computer Science,
|
26 |
|
|
-- University of Colorado at Boulder, Boulder, Colorado 80309
|
27 |
|
|
--------------------------------------------------------------------------------
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
--
|
31 |
|
|
-- Filename: vc_channel_destap.vhd
|
32 |
|
|
--
|
33 |
|
|
-- Description: vc channel with destination being an access point
|
34 |
|
|
--
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
--
|
38 |
|
|
--a different vc_channel is used for the channel fifo that has its destination
|
39 |
|
|
--being the actual access point. This is necessary for a variety of reasons. Any bug
|
40 |
|
|
--fixes here will probably need to be fixed in vc_channel.vhd as well
|
41 |
|
|
--(I'm sure a software engineer just died somewhere).
|
42 |
|
|
|
43 |
|
|
library IEEE;
|
44 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
45 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
46 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
47 |
|
|
|
48 |
|
|
use work.pkg_nocem.all;
|
49 |
|
|
|
50 |
|
|
entity vc_channel_destap is
|
51 |
|
|
port (
|
52 |
|
|
-- id of destination node
|
53 |
|
|
node_dest_id : in node_addr_word;
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
vc_mux_wr : in std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
57 |
|
|
vc_mux_rd : in std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
58 |
|
|
|
59 |
|
|
wr_pkt_cntrl : in std_logic_vector(NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
|
60 |
|
|
wr_pkt_data : in std_logic_vector(NOCEM_DW-1 downto 0);
|
61 |
|
|
|
62 |
|
|
rd_pkt_cntrl : out std_logic_vector(NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
|
63 |
|
|
rd_pkt_data : out std_logic_vector(NOCEM_DW-1 downto 0);
|
64 |
|
|
|
65 |
|
|
rd_pkt_chdest : out std_logic_vector(NOCEM_ARB_IX_SIZE-1 downto 0);
|
66 |
|
|
rd_pkt_vcdest : out vc_addr_word;
|
67 |
|
|
rd_pkt_vcsrc : out vc_addr_word;
|
68 |
|
|
vc_empty : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
69 |
|
|
vc_full : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
70 |
|
|
|
71 |
|
|
-- VC allocation signals
|
72 |
|
|
vc_allocate_from_node : in vc_addr_word;
|
73 |
|
|
vc_requester_from_node : in vc_addr_word;
|
74 |
|
|
|
75 |
|
|
vc_allocate_destch_to_node : out std_logic_vector(NOCEM_ARB_IX_SIZE-1 downto 0);
|
76 |
|
|
vc_requester_to_node : out vc_addr_word;
|
77 |
|
|
vc_eop_rd_status : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
78 |
|
|
vc_eop_wr_status : out std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
79 |
|
|
|
80 |
|
|
RE : in std_logic;
|
81 |
|
|
WE : in std_logic;
|
82 |
|
|
|
83 |
|
|
clk : in std_logic;
|
84 |
|
|
rst : in std_logic
|
85 |
|
|
);
|
86 |
|
|
end vc_channel_destap;
|
87 |
|
|
|
88 |
|
|
architecture Behavioral of vc_channel_destap is
|
89 |
|
|
|
90 |
|
|
signal vc_pkt_cntrl : pkt_cntrl_array(NOCEM_NUM_VC-1 downto 0);
|
91 |
|
|
signal vc_pkt_data : data_array(NOCEM_NUM_VC-1 downto 0);
|
92 |
|
|
|
93 |
|
|
signal fifo_wr_en : std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
94 |
|
|
signal fifo_rd_en : std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
95 |
|
|
signal datain_pad,dataout_pad : std_logic_vector(NOCEM_DW+NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
|
96 |
|
|
|
97 |
|
|
type array_packed is array(natural range <>) of std_logic_vector(NOCEM_DW+NOCEM_PKT_CNTRL_WIDTH-1 downto 0);
|
98 |
|
|
signal fifo_rd_data : array_packed(NOCEM_NUM_VC-1 downto 0);
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
-- signal vc_mux_rd : std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
102 |
|
|
|
103 |
|
|
signal dummy_vcid : std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
104 |
|
|
signal vc_alloc_mux_sel : std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
105 |
|
|
signal vc_empty_i : std_logic_vector(NOCEM_NUM_VC-1 downto 0);
|
106 |
|
|
|
107 |
|
|
-- needed for Modelsim Simulator to work....
|
108 |
|
|
signal vc_myid_conv : vc_addr_array(NOCEM_NUM_VC-1 downto 0);
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
begin
|
112 |
|
|
|
113 |
|
|
rd_pkt_vcsrc <= vc_mux_rd;
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
vc_requester_to_node <= (others => '0');
|
117 |
|
|
rd_pkt_vcdest <= (others => '0');
|
118 |
|
|
vc_allocate_destch_to_node <= (others => '0');
|
119 |
|
|
rd_pkt_chdest <= (others => '0');
|
120 |
|
|
vc_alloc_mux_sel <= (others => '0');
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
-- for accesspoint vc_req lines
|
124 |
|
|
dummy_vcid <= ('1',others=>'0');
|
125 |
|
|
|
126 |
|
|
gen_vcids : process (rst)
|
127 |
|
|
begin
|
128 |
|
|
lgen : for I in NOCEM_NUM_VC-1 downto 0 loop
|
129 |
|
|
vc_myid_conv(I) <= CONV_STD_LOGIC_VECTOR(2**I,NOCEM_VC_ID_WIDTH);
|
130 |
|
|
end loop;
|
131 |
|
|
end process;
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
--FIFO data format: (...) pkt_cntrl,pkt_data (0)
|
135 |
|
|
|
136 |
|
|
datain_pad(NOCEM_DW+NOCEM_PKT_CNTRL_WIDTH-1 downto NOCEM_DW) <= wr_pkt_cntrl;
|
137 |
|
|
datain_pad(NOCEM_DW-1 downto 0) <= wr_pkt_data;
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
vc_read_sel : process (vc_empty_i,vc_mux_rd,rst,RE, vc_mux_wr, WE, dataout_pad,fifo_rd_data)
|
143 |
|
|
begin
|
144 |
|
|
|
145 |
|
|
rd_pkt_data <= (others => '0');
|
146 |
|
|
rd_pkt_cntrl <= (others => '0');
|
147 |
|
|
vc_pkt_cntrl <= (others => (others => '0'));
|
148 |
|
|
vc_pkt_data <= (others => (others => '0'));
|
149 |
|
|
fifo_wr_en <= (others => '0');
|
150 |
|
|
fifo_rd_en <= (others => '0');
|
151 |
|
|
dataout_pad <= (others => '0');
|
152 |
|
|
vc_empty <= vc_empty_i;
|
153 |
|
|
|
154 |
|
|
if rst = '1' then
|
155 |
|
|
null;
|
156 |
|
|
else
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
-- push dataout from the correct fifo
|
161 |
|
|
l1: for I in NOCEM_NUM_VC-1 downto 0 loop
|
162 |
|
|
|
163 |
|
|
fifo_wr_en(I) <= vc_mux_wr(I) and WE;
|
164 |
|
|
fifo_rd_en(I) <= vc_mux_rd(I) and RE;
|
165 |
|
|
vc_pkt_cntrl(I) <= fifo_rd_data(I)(NOCEM_DW+NOCEM_PKT_CNTRL_WIDTH-1 downto NOCEM_DW);
|
166 |
|
|
vc_pkt_data(I) <= fifo_rd_data(I)(NOCEM_DW-1 downto 0);
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
if vc_mux_rd(I) = '1' then
|
170 |
|
|
dataout_pad <= fifo_rd_data(I);
|
171 |
|
|
end if;
|
172 |
|
|
end loop;
|
173 |
|
|
|
174 |
|
|
-- breakout the padded dataout lines
|
175 |
|
|
rd_pkt_cntrl <= dataout_pad(NOCEM_DW+NOCEM_PKT_CNTRL_WIDTH-1 downto NOCEM_DW);
|
176 |
|
|
rd_pkt_data <= dataout_pad(NOCEM_DW-1 downto 0);
|
177 |
|
|
|
178 |
|
|
end if;
|
179 |
|
|
|
180 |
|
|
end process;
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
g1: for I in NOCEM_NUM_VC-1 downto 0 generate
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
I_vc : fifo_allvhdl
|
191 |
|
|
generic map(
|
192 |
|
|
WIDTH => NOCEM_DW+NOCEM_PKT_CNTRL_WIDTH,
|
193 |
|
|
ADDR_WIDTH => Log2(NOCEM_MAX_PACKET_LENGTH)
|
194 |
|
|
)
|
195 |
|
|
PORT MAP(
|
196 |
|
|
din => datain_pad,
|
197 |
|
|
clk => clk,
|
198 |
|
|
rd_en => fifo_rd_en(I),
|
199 |
|
|
rst => rst,
|
200 |
|
|
wr_en => fifo_wr_en(I),
|
201 |
|
|
dout => fifo_rd_data(I),
|
202 |
|
|
empty => vc_empty_i(I),
|
203 |
|
|
full => vc_full(I)
|
204 |
|
|
);
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
I_vc_cntrlr : vc_controller PORT MAP(
|
209 |
|
|
vc_my_id => vc_myid_conv(I),
|
210 |
|
|
node_my_id => node_dest_id,
|
211 |
|
|
pkt_cntrl_rd => vc_pkt_cntrl(I),
|
212 |
|
|
pkt_cntrl_wr => wr_pkt_cntrl,
|
213 |
|
|
pkt_re => fifo_rd_en(I),
|
214 |
|
|
pkt_we => fifo_wr_en(I),
|
215 |
|
|
vc_fifo_empty => vc_empty_i(I),
|
216 |
|
|
vc_eop_rd_status => vc_eop_rd_status(I), -- directly outputted to channel_fifo
|
217 |
|
|
vc_eop_wr_status => vc_eop_wr_status(I), -- directly outputted to channel_fifo
|
218 |
|
|
|
219 |
|
|
vc_allocation_req => open,
|
220 |
|
|
vc_req_id => open,
|
221 |
|
|
vc_allocate_from_node => dummy_vcid,
|
222 |
|
|
vc_requester_from_node => vc_myid_conv(I),
|
223 |
|
|
channel_dest => open,
|
224 |
|
|
vc_dest => open,
|
225 |
|
|
vc_switch_req => open,
|
226 |
|
|
rst => rst,
|
227 |
|
|
clk => clk
|
228 |
|
|
);
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
end generate;
|
233 |
|
|
|
234 |
|
|
-----------------------------------------------------------------------------
|
235 |
|
|
-----------------------------------------------------------------------------
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
end Behavioral;
|
240 |
|
|
|
241 |
|
|
|