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

Subversion Repositories nocem

[/] [nocem/] [trunk/] [VHDL/] [simple_pkt_local_switch.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 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 2 schelleg
-- Filename: simple_pkt_local_switch.vhd
32 4 schelleg
-- 
33 2 schelleg
-- Description: simple switch design
34 4 schelleg
-- 
35
 
36
 
37
library IEEE;
38
use IEEE.STD_LOGIC_1164.ALL;
39
use IEEE.STD_LOGIC_ARITH.ALL;
40
use IEEE.STD_LOGIC_UNSIGNED.ALL;
41
use work.pkg_nocem.all;
42
 
43
 
44
 
45
entity simple_pkt_local_switch is
46
    Port (
47
 
48
 
49
           -- the arbitration logic controls the switches of data
50
                arb_grant_output : in arb_decision_array(4 downto 0);
51
                --arb_grant_input  : in std_logic_vector(4 downto 0);    
52
 
53
 
54
                ap_datain                                       : in  data_word;
55
                ap_dataout                                      : out data_word;
56
                n_datain                   : in  data_word;
57
                n_dataout                       : out data_word;
58
                s_datain                        : in  data_word;
59
                s_dataout                       : out data_word;
60
                e_datain                        : in  data_word;
61
                e_dataout                       : out data_word;
62
                w_datain                        : in  data_word;
63
                w_dataout                       : out data_word;
64
 
65
                n_pkt_cntrl_in  : in pkt_cntrl_word;
66
                n_pkt_cntrl_out : out pkt_cntrl_word;
67
 
68
                s_pkt_cntrl_in  : in pkt_cntrl_word;
69
                s_pkt_cntrl_out : out pkt_cntrl_word;
70
 
71
                e_pkt_cntrl_in  : in pkt_cntrl_word;
72
                e_pkt_cntrl_out : out pkt_cntrl_word;
73
 
74
                w_pkt_cntrl_in  : in pkt_cntrl_word;
75
                w_pkt_cntrl_out : out pkt_cntrl_word;
76
 
77
                ap_pkt_cntrl_in  : in pkt_cntrl_word;
78
                ap_pkt_cntrl_out : out pkt_cntrl_word;
79
 
80
 
81
                clk : in std_logic;
82
      rst : in std_logic
83
 
84
        );
85
end simple_pkt_local_switch;
86
 
87
architecture Behavioral of simple_pkt_local_switch is
88
 
89
 
90
 
91
 
92
 
93
begin
94
 
95
switch_gen_process : process (ap_pkt_cntrl_in, n_pkt_cntrl_in, s_pkt_cntrl_in, e_pkt_cntrl_in, w_pkt_cntrl_in,arb_grant_output, ap_datain, n_datain, s_datain, e_datain, w_datain)
96
 
97
 
98
begin
99
 
100
   ----------------------------------------------
101
        ---------- do output arbitration -------------
102
   ----------------------------------------------
103
 
104
 
105
--              ap_dataout_valid <= '0';         
106
--              n_dataout_valid        <= '0';
107
--              south_dataout_valid        <= '0';
108
--              east_dataout_valid         <= '0';
109
--              west_dataout_valid         <= '0';
110
 
111
 
112
                ap_dataout                <= (others => '0');
113
                n_dataout           <= (others => '0');
114
                s_dataout           <= (others => '0');
115
                e_dataout           <= (others => '0');
116
                w_dataout           <= (others => '0');
117
 
118
 
119
                ap_pkt_cntrl_out    <= (others => '0');
120
                n_pkt_cntrl_out     <= (others => '0');
121
                s_pkt_cntrl_out   <= (others => '0');
122
                e_pkt_cntrl_out   <= (others => '0');
123
                w_pkt_cntrl_out   <= (others => '0');
124
 
125
 
126
 
127
 
128
        -- foreach output line, simply mux in the incoming lines
129
        -- based on arbitration decision
130
        --      arb_grant_output(4) : NORTH
131
        --      arb_grant_output(3) : SOUTH
132
        --      arb_grant_output(2) : EAST
133
        -- arb_grant_output(1) : WEST
134
        --      arb_grant_output(0) : AP
135
 
136
 
137
        case arb_grant_output(NOCEM_AP_IX) is
138
                when ARB_AP =>
139
                         ap_dataout <= ap_datain;
140
                         ap_pkt_cntrl_out       <= ap_pkt_cntrl_in;
141
                when ARB_NORTH =>
142
                         ap_dataout <= n_datain;
143
                         ap_pkt_cntrl_out       <= n_pkt_cntrl_in;
144
                when ARB_SOUTH =>
145
                         ap_dataout <= s_datain;
146
                         ap_pkt_cntrl_out       <= s_pkt_cntrl_in;
147
                when ARB_EAST =>
148
                         ap_dataout <= e_datain;
149
                         ap_pkt_cntrl_out       <= e_pkt_cntrl_in;
150
                when ARB_WEST =>
151
                         ap_dataout <= w_datain;
152
                         ap_pkt_cntrl_out       <= w_pkt_cntrl_in;
153
                when others =>
154
                        null;
155
        end case;
156
 
157
 
158
 
159
        case arb_grant_output(NOCEM_NORTH_IX) is
160
                when ARB_AP =>
161
                         n_dataout <= ap_datain;
162
                         n_pkt_cntrl_out        <= ap_pkt_cntrl_in;
163
                when ARB_NORTH =>
164
                         n_dataout <= n_datain;
165
                         n_pkt_cntrl_out        <= n_pkt_cntrl_in;
166
                when ARB_SOUTH =>
167
                         n_dataout <= s_datain;
168
                         n_pkt_cntrl_out        <= s_pkt_cntrl_in;
169
                when ARB_EAST =>
170
                         n_dataout <= e_datain;
171
                         n_pkt_cntrl_out        <= e_pkt_cntrl_in;
172
                when ARB_WEST =>
173
                         n_dataout <= w_datain;
174
                         n_pkt_cntrl_out        <= w_pkt_cntrl_in;
175
                when others =>
176
                        null;
177
        end case;
178
 
179
        case arb_grant_output(NOCEM_SOUTH_IX) is
180
                when ARB_AP =>
181
                         s_dataout <= ap_datain;
182
                         s_pkt_cntrl_out        <= ap_pkt_cntrl_in;
183
                when ARB_NORTH =>
184
                         s_dataout <= n_datain;
185
                         s_pkt_cntrl_out        <= n_pkt_cntrl_in;
186
                when ARB_SOUTH =>
187
                         s_dataout <= s_datain;
188
                         s_pkt_cntrl_out        <= s_pkt_cntrl_in;
189
                when ARB_EAST =>
190
                         s_dataout <= e_datain;
191
                         s_pkt_cntrl_out        <= e_pkt_cntrl_in;
192
                when ARB_WEST =>
193
                         s_dataout <= w_datain;
194
                         s_pkt_cntrl_out        <= w_pkt_cntrl_in;
195
                when others =>
196
                        null;
197
        end case;
198
 
199
 
200
        case arb_grant_output(NOCEM_EAST_IX) is
201
                when ARB_AP =>
202
                         e_dataout <= ap_datain;
203
                         e_pkt_cntrl_out        <= ap_pkt_cntrl_in;
204
                when ARB_NORTH =>
205
                         e_dataout <= n_datain;
206
                         e_pkt_cntrl_out        <= n_pkt_cntrl_in;
207
                when ARB_SOUTH =>
208
                         e_dataout <= s_datain;
209
                         e_pkt_cntrl_out        <= s_pkt_cntrl_in;
210
                when ARB_EAST =>
211
                         e_dataout <= e_datain;
212
                         e_pkt_cntrl_out        <= e_pkt_cntrl_in;
213
                when ARB_WEST =>
214
                         e_dataout <= w_datain;
215
                         e_pkt_cntrl_out        <= w_pkt_cntrl_in;
216
                when others =>
217
                        null;
218
        end case;
219
 
220
        case arb_grant_output(NOCEM_WEST_IX) is
221
                when ARB_AP =>
222
                         w_dataout <= ap_datain;
223
                         w_pkt_cntrl_out        <= ap_pkt_cntrl_in;
224
                when ARB_NORTH =>
225
                         w_dataout <= n_datain;
226
                         w_pkt_cntrl_out        <= n_pkt_cntrl_in;
227
                when ARB_SOUTH =>
228
                         w_dataout <= s_datain;
229
                         w_pkt_cntrl_out        <= s_pkt_cntrl_in;
230
                when ARB_EAST =>
231
                         w_dataout <= e_datain;
232
                         w_pkt_cntrl_out        <= e_pkt_cntrl_in;
233
                when ARB_WEST =>
234
                         w_dataout <= w_datain;
235
                         w_pkt_cntrl_out        <= w_pkt_cntrl_in;
236
                when others =>
237
                        null;
238
        end case;
239
 
240
 
241
   ----------------------------------------------
242
        ---------- END do output arbitration ---------
243
   ----------------------------------------------
244
 
245
 
246
 
247
 
248
 
249
 
250
 
251
end process;
252
 
253
 
254
 
255
 
256
end Behavioral;

powered by: WebSVN 2.1.0

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