-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarouter_pack.vhd
executable file
·148 lines (127 loc) · 4.98 KB
/
karouter_pack.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.math_real.log2;
use ieee.math_real.ceil;
--Stores some components of the karouter project
package karouter_pack is
type std_lgk_vec_2d is array(INTEGER range <>) of std_logic_vector;
type bool_vec_2d is array(INTEGER range <>) of boolean_vector;
function get_addr_width(elem_cnt: integer) return integer;
component switching_engine is
generic (
PORTCNT : integer;
BLOCKWIDTH : integer
);
port (
clk : in std_logic;
reset : in std_logic;
prev_request_vec : in bool_vec_2d(PORTCNT-1 downto 0)(PORTCNT-1 downto 0);
input_data_vec : in std_lgk_vec_2d(PORTCNT-1 downto 0)(BLOCKWIDTH-1 downto 0);
output_data_vec : out std_lgk_vec_2d(PORTCNT-1 downto 0)(BLOCKWIDTH-1 downto 0);
prev_valid_vec : in boolean_vector(PORTCNT-1 downto 0);
next_valid_vec : in boolean_vector(PORTCNT-1 downto 0);
output_to_prev_valid: out boolean_vector(PORTCNT-1 downto 0);
output_to_next_valid: out boolean_vector(PORTCNT-1 downto 0)
);
end component ;
component input_queue is
generic (
QUEUE_DEPTH : integer;
BLOCKWIDTH : integer;
PORTCNT : integer
);
port (
clk : in std_logic;
reset : in std_logic;
--Signals from classifier
output_dest_data: out std_logic_vector((QUEUE_DEPTH*BLOCKWIDTH)-1 downto 0);
outport_mask : in boolean_vector(PORTCNT-1 downto 0);
--Connection establishing signals on switching interface
self_request_vec: out boolean_vector(PORTCNT-1 downto 0);
--Start/stop forwarding
drop_event : in boolean;
prev_valid : in boolean;
next_valid : in boolean;
output_drop_event: out boolean;
output_to_prev_valid: out boolean;
output_to_next_valid: out boolean;
--Signals on output interface
input_data : in std_logic_vector(BLOCKWIDTH-1 downto 0);
output_data : out std_logic_vector(BLOCKWIDTH-1 downto 0)
);
end component;
component classifier_socket is
generic (
BLOCKWIDTH : integer;
PORTCNT : integer;
CLASSDATAWIDTH : integer;
CONFIGWIDTH : integer
);
port (
clk : in std_logic;
--Config interface
addr_in : in std_logic_vector(CONFIGWIDTH-1 downto 0);
memory_in : in std_logic_vector(CONFIGWIDTH-1 downto 0);
--Signals on input interface
data_in : in std_logic_vector(CLASSDATAWIDTH*BLOCKWIDTH-1 downto 0);
drop_packet : out boolean;
outport_mask : out boolean_vector(PORTCNT-1 downto 0)
);
end component;
component switching_client is
generic (
BLOCKWIDTH : integer;
PORTCNT : integer
);
port (
--Connection establishing signals on switching interface
prev_request_vec: in boolean_vector(PORTCNT-1 downto 0);
self_request_vec: out boolean_vector(PORTCNT-1 downto 0);
next_respons_vec: in boolean_vector(PORTCNT-1 downto 0);
--Start/stop forwarding
prev_valid : in boolean;
next_valid : in boolean;
output_to_prev_valid: out boolean;
output_to_next_valid: out boolean;
--Signals on output interface
input_data : in std_logic_vector(BLOCKWIDTH-1 downto 0);
output_data : out std_logic_vector(BLOCKWIDTH-1 downto 0)
);
end component;
component round_robin_scheduler is
generic (
PORTCNT : integer;
BLOCKWIDTH : integer
);
port (
clk : in std_logic;
reset : in std_logic;
--Connection establishing signals on input interface
prev_request_vec: in boolean_vector(PORTCNT-1 downto 0);
self_respons_vec: out boolean_vector(PORTCNT-1 downto 0);
--Data forwarding
input_data_vec : in std_lgk_vec_2d(PORTCNT-1 downto 0)(BLOCKWIDTH-1 downto 0);
output_data : out std_logic_vector(BLOCKWIDTH-1 downto 0);
--Start/stop forwarding
prev_valid_vec : in boolean_vector(PORTCNT-1 downto 0);
next_valid : in boolean;
output_to_prev_valid: out boolean;
output_to_next_valid: out boolean
);
end component;
component switching_matrix is
generic (
PORTCNT : integer
);
port (
input : in bool_vec_2d(PORTCNT-1 downto 0)(PORTCNT-1 downto 0);
output : out bool_vec_2d(PORTCNT-1 downto 0)(PORTCNT-1 downto 0)
);
end component;
end karouter_pack;
package body karouter_pack is
function get_addr_width(elem_cnt: integer) return integer is
begin
return INTEGER(CEIL(LOG2(REAL(elem_cnt))));
end get_addr_width;
end karouter_pack;