-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwb_conmax_top.vhd
324 lines (270 loc) · 8.45 KB
/
wb_conmax_top.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
-------------------------------------------------------------------------------
-- Title : Wishbone interconnect matrix for WR Core
-- Project : WhiteRabbit
-------------------------------------------------------------------------------
-- File : wb_conmax_top.vhd
-- Author : Grzegorz Daniluk
-- Company : Elproma
-- Created : 2011-02-12
-- Last update: 2011-09-14
-- Platform : FPGA-generics
-- Standard : VHDL
-------------------------------------------------------------------------------
-- Description:
-- Wishbone Interconnect Matrix, up to 8 Masters and 16 Slaves. Features
-- prioritized arbiter inside each Slave Interface (1, 2 of 4 priority levels).
-- Allows the parallel communication between masters and slaves on
-- different interfaces.
-- It is the WISHBONE Conmax IP Core from opencores.org rewritten in VHDL (from
-- Verilog) with some code optimalization.
--
-------------------------------------------------------------------------------
-- Copyright (C) 2000-2002 Rudolf Usselmann
-- Copyright (c) 2011 Grzegorz Daniluk (VHDL port)
-------------------------------------------------------------------------------
-- Revisions :
-- Date Version Author Description
-- 2011-02-12 1.0 greg.d Created
-- 2011-02-16 1.1 greg.d Using generates and types
-------------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.wbconmax_pkg.all;
entity wb_conmax_top is
generic(
g_rf_addr : integer range 0 to 15 := 15 --0xf
);
port(
clk_i : std_logic;
rst_i : std_logic;
wb_masters_i : in t_conmax_masters_i;
wb_masters_o : out t_conmax_masters_o;
wb_slaves_i : in t_conmax_slaves_i;
wb_slaves_o : out t_conmax_slaves_o
);
end wb_conmax_top;
architecture struct of wb_conmax_top is
component wb_conmax_master_if is
port(
clk_i : in std_logic;
rst_i : in std_logic;
--Master interface
wb_master_i : in t_wb_i;
wb_master_o : out t_wb_o;
--Slaves(0 to 15) interface
wb_slaves_i : in t_conmax_slaves_i;
wb_slaves_o : out t_conmax_slaves_o
);
end component;
component wb_conmax_slave_if is
generic(
g_pri_sel : integer := 2
);
port(
clk_i : in std_logic;
rst_i : in std_logic;
conf_i : in std_logic_vector(15 downto 0);
--Slave interface
wb_slave_i : in t_wb_o;
wb_slave_o : out t_wb_i;
--Master (0 to 7) interfaces
wb_masters_i : in t_conmax_masters_i;
wb_masters_o : out t_conmax_masters_o
);
end component;
component wb_conmax_rf is
generic(
g_rf_addr : integer range 0 to 15 := 15 --0xF
);
port(
clk_i : in std_logic;
rst_i : in std_logic;
--Internal WB interface
int_wb_i : in t_wb_i;
int_wb_o : out t_wb_o;
--External WB interface
ext_wb_i : in t_wb_o;
ext_wb_o : out t_wb_i;
--Configuration regs
conf_o : out t_rf_conf
);
end component;
signal intwb_s15_i : t_wishbone_master_in;
signal intwb_s15_o : t_wishbone_master_out;
--M0Sx
signal m0_slaves_i : t_conmax_slaves_i;
signal m0_slaves_o : t_conmax_slaves_o;
signal m1_slaves_i : t_conmax_slaves_i;
signal m1_slaves_o : t_conmax_slaves_o;
signal m2_slaves_i : t_conmax_slaves_i;
signal m2_slaves_o : t_conmax_slaves_o;
signal m3_slaves_i : t_conmax_slaves_i;
signal m3_slaves_o : t_conmax_slaves_o;
signal m4_slaves_i : t_conmax_slaves_i;
signal m4_slaves_o : t_conmax_slaves_o;
signal m5_slaves_i : t_conmax_slaves_i;
signal m5_slaves_o : t_conmax_slaves_o;
signal m6_slaves_i : t_conmax_slaves_i;
signal m6_slaves_o : t_conmax_slaves_o;
signal m7_slaves_i : t_conmax_slaves_i;
signal m7_slaves_o : t_conmax_slaves_o;
signal s_conf : t_rf_conf;
signal s15_wb_masters_i : t_conmax_masters_i;
signal s15_wb_masters_o : t_conmax_masters_o;
begin
--Master interfaces
M0: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
--Master interface
wb_master_i => wb_masters_i(0),
wb_master_o => wb_masters_o(0),
--Slaves(0 to 15) interface
wb_slaves_i => m0_slaves_i,
wb_slaves_o => m0_slaves_o
);
M1: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
wb_master_i => wb_masters_i(1),
wb_master_o => wb_masters_o(1),
wb_slaves_i => m1_slaves_i,
wb_slaves_o => m1_slaves_o
);
M2: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
wb_master_i => wb_masters_i(2),
wb_master_o => wb_masters_o(2),
wb_slaves_i => m2_slaves_i,
wb_slaves_o => m2_slaves_o
);
M3: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
wb_master_i => wb_masters_i(3),
wb_master_o => wb_masters_o(3),
wb_slaves_i => m3_slaves_i,
wb_slaves_o => m3_slaves_o
);
M4: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
wb_master_i => wb_masters_i(4),
wb_master_o => wb_masters_o(4),
wb_slaves_i => m4_slaves_i,
wb_slaves_o => m4_slaves_o
);
M5: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
wb_master_i => wb_masters_i(5),
wb_master_o => wb_masters_o(5),
wb_slaves_i => m5_slaves_i,
wb_slaves_o => m5_slaves_o
);
M6: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
wb_master_i => wb_masters_i(6),
wb_master_o => wb_masters_o(6),
wb_slaves_i => m6_slaves_i,
wb_slaves_o => m6_slaves_o
);
M7: wb_conmax_master_if
port map(
clk_i => clk_i,
rst_i => rst_i,
wb_master_i => wb_masters_i(7),
wb_master_o => wb_masters_o(7),
wb_slaves_i => m7_slaves_i,
wb_slaves_o => m7_slaves_o
);
--------------------------------------------------
--Slave interfaces
S_GEN: for I in 0 to 14 generate
SLV: wb_conmax_slave_if
generic map(
g_pri_sel => g_pri_sel(I)
)
port map(
clk_i => clk_i,
rst_i => rst_i,
conf_i => s_conf(I),
--Slave interface
wb_slave_i => wb_slaves_i(I),
wb_slave_o => wb_slaves_o(I),
--Interfaces to masters
wb_masters_i(0) => m0_slaves_o(I),
wb_masters_i(1) => m1_slaves_o(I),
wb_masters_i(2) => m2_slaves_o(I),
wb_masters_i(3) => m3_slaves_o(I),
wb_masters_i(4) => m4_slaves_o(I),
wb_masters_i(5) => m5_slaves_o(I),
wb_masters_i(6) => m6_slaves_o(I),
wb_masters_i(7) => m7_slaves_o(I),
wb_masters_o(0) => m0_slaves_i(I),
wb_masters_o(1) => m1_slaves_i(I),
wb_masters_o(2) => m2_slaves_i(I),
wb_masters_o(3) => m3_slaves_i(I),
wb_masters_o(4) => m4_slaves_i(I),
wb_masters_o(5) => m5_slaves_i(I),
wb_masters_o(6) => m6_slaves_i(I),
wb_masters_o(7) => m7_slaves_i(I)
);
end generate;
s15_wb_masters_i(0) <= m0_slaves_o(15);
s15_wb_masters_i(1) <= m1_slaves_o(15);
s15_wb_masters_i(2) <= m2_slaves_o(15);
s15_wb_masters_i(3) <= m3_slaves_o(15);
s15_wb_masters_i(4) <= m4_slaves_o(15);
s15_wb_masters_i(5) <= m5_slaves_o(15);
s15_wb_masters_i(6) <= m6_slaves_o(15);
s15_wb_masters_i(7) <= m7_slaves_o(15);
m0_slaves_i(15) <= s15_wb_masters_o(0);
m1_slaves_i(15) <= s15_wb_masters_o(1);
m2_slaves_i(15) <= s15_wb_masters_o(2);
m3_slaves_i(15) <= s15_wb_masters_o(3);
m4_slaves_i(15) <= s15_wb_masters_o(4);
m5_slaves_i(15) <= s15_wb_masters_o(5);
m6_slaves_i(15) <= s15_wb_masters_o(6);
m7_slaves_i(15) <= s15_wb_masters_o(7);
SLV15: wb_conmax_slave_if
generic map(
g_pri_sel => g_pri_sel(15)
)
port map(
clk_i => clk_i,
rst_i => rst_i,
conf_i => s_conf(15),
--Slave interface
wb_slave_i => intwb_s15_i,
wb_slave_o => intwb_s15_o,
--Interfaces to masters
wb_masters_i => s15_wb_masters_i,
wb_masters_o => s15_wb_masters_o
);
---------------------------------------
--Register File
RF: wb_conmax_rf
generic map(
g_rf_addr => g_rf_addr
)
port map(
clk_i => clk_i,
rst_i => rst_i,
int_wb_i => intwb_s15_o,
int_wb_o => intwb_s15_i,
ext_wb_i => wb_slaves_i(15),
ext_wb_o => wb_slaves_o(15),
conf_o => s_conf
);
end struct;