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

Subversion Repositories wb_tk

[/] [wb_tk/] [trunk/] [components.vhd] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 tantos
--
2
--  Wishbone bus toolkit.
3
--
4
--  (c) Copyright Andras Tantos <andras_tantos@yahoo.com> 2001/03/31
5
--  This code is distributed under the terms and conditions of the GNU General Public Lince.
6
--
7
--
8
-- ELEMENTS:
9
--   wb_bus_upsize: bus upsizer. Currently only 8->16 bit bus resize is supported
10
--   wb_async_slave: Wishbone bus to async (SRAM-like) bus slave bridge.
11
--   wb_arbiter: two-way bus arbiter. Asyncronous logic ensures 0-ws operation on shared bus
12
--   wb_out_reg: Wishbone bus compatible output register.
13
--   wb_bus_resize: Wishbone bus resizer.
14
 
15
library IEEE;
16
use IEEE.std_logic_1164.all;
17
library wb_tk;
18
use wb_tk.technology.all;
19
 
20
package components is
21
    component wb_bus_upsize
22
        generic (
23
            m_dat_width: positive := 8; -- master bus width
24
            m_adr_width: positive := 21; -- master bus width
25
            s_dat_width: positive := 16; -- slave bus width
26
            s_adr_width: positive := 20; -- master bus width
27
            little_endien: boolean := true -- if set to false, big endien
28
        );
29
        port (
30
    --      clk_i: in std_logic;
31
    --      rst_i: in std_logic := '0';
32
 
33
            -- Master bus interface
34
            m_adr_i: in std_logic_vector (m_adr_width-1 downto 0);
35
            m_sel_i: in std_logic_vector ((m_dat_width/8)-1 downto 0) := (others => '1');
36
            m_dat_i: in std_logic_vector (m_dat_width-1 downto 0);
37
            m_dat_oi: in std_logic_vector (m_dat_width-1 downto 0) := (others => '-');
38
            m_dat_o: out std_logic_vector (m_dat_width-1 downto 0);
39
            m_cyc_i: in std_logic;
40
            m_ack_o: out std_logic;
41
            m_ack_oi: in std_logic := '-';
42
            m_err_o: out std_logic;
43
            m_err_oi: in std_logic := '-';
44
            m_rty_o: out std_logic;
45
            m_rty_oi: in std_logic := '-';
46
            m_we_i: in std_logic;
47
            m_stb_i: in std_logic;
48
 
49
            -- Slave bus interface
50
            s_adr_o: out std_logic_vector (s_adr_width-1 downto 0);
51
            s_sel_o: out std_logic_vector ((s_dat_width/8)-1 downto 0);
52
            s_dat_i: in std_logic_vector (s_dat_width-1 downto 0);
53
            s_dat_o: out std_logic_vector (s_dat_width-1 downto 0);
54
            s_cyc_o: out std_logic;
55
            s_ack_i: in std_logic;
56
            s_err_i: in std_logic := '-';
57
            s_rty_i: in std_logic := '-';
58
            s_we_o: out std_logic;
59
            s_stb_o: out std_logic
60
        );
61
    end component;
62
 
63
    component wb_bus_dnsize
64
        generic (
65
            m_dat_width: positive := 32; -- master bus width
66
            m_adr_width: positive := 20; -- master bus width
67
            s_dat_width: positive := 16; -- slave bus width
68
            s_adr_width: positive := 21; -- master bus width
69
            little_endien: boolean := true -- if set to false, big endien
70
        );
71
        port (
72
    --      clk_i: in std_logic;
73
    --      rst_i: in std_logic := '0';
74
 
75
            -- Master bus interface
76
            m_adr_i: in std_logic_vector (m_adr_width-1 downto 0);
77
            m_sel_i: in std_logic_vector ((m_dat_width/8)-1 downto 0) := (others => '1');
78
            m_dat_i: in std_logic_vector (m_dat_width-1 downto 0);
79
            m_dat_oi: in std_logic_vector (m_dat_width-1 downto 0) := (others => '-');
80
            m_dat_o: out std_logic_vector (m_dat_width-1 downto 0);
81
            m_cyc_i: in std_logic;
82
            m_ack_o: out std_logic;
83
            m_ack_oi: in std_logic := '-';
84
            m_err_o: out std_logic;
85
            m_err_oi: in std_logic := '-';
86
            m_rty_o: out std_logic;
87
            m_rty_oi: in std_logic := '-';
88
            m_we_i: in std_logic;
89
            m_stb_i: in std_logic;
90
 
91
            -- Slave bus interface
92
            s_adr_o: out std_logic_vector (s_adr_width-1 downto 0);
93
            s_sel_o: out std_logic_vector ((s_dat_width/8)-1 downto 0);
94
            s_dat_i: in std_logic_vector (s_dat_width-1 downto 0);
95
            s_dat_o: out std_logic_vector (s_dat_width-1 downto 0);
96
            s_cyc_o: out std_logic;
97
            s_ack_i: in std_logic;
98
            s_err_i: in std_logic := '-';
99
            s_rty_i: in std_logic := '-';
100
            s_we_o: out std_logic;
101
            s_stb_o: out std_logic
102
        );
103
    end component;
104
 
105
    component wb_bus_resize
106
        generic (
107
            m_dat_width: positive := 32; -- master bus width
108
            m_adr_width: positive := 20; -- master bus width
109
            s_dat_width: positive := 16; -- slave bus width
110
            s_adr_width: positive := 21; -- master bus width
111
            little_endien: boolean := true -- if set to false, big endien
112
        );
113
        port (
114
    --      clk_i: in std_logic;
115
    --      rst_i: in std_logic := '0';
116
 
117
            -- Master bus interface
118
            m_adr_i: in std_logic_vector (m_adr_width-1 downto 0);
119
            m_sel_i: in std_logic_vector ((m_dat_width/8)-1 downto 0) := (others => '1');
120
            m_dat_i: in std_logic_vector (m_dat_width-1 downto 0);
121
            m_dat_oi: in std_logic_vector (m_dat_width-1 downto 0) := (others => '-');
122
            m_dat_o: out std_logic_vector (m_dat_width-1 downto 0);
123
            m_cyc_i: in std_logic;
124
            m_ack_o: out std_logic;
125
            m_ack_oi: in std_logic := '-';
126
            m_err_o: out std_logic;
127
            m_err_oi: in std_logic := '-';
128
            m_rty_o: out std_logic;
129
            m_rty_oi: in std_logic := '-';
130
            m_we_i: in std_logic;
131
            m_stb_i: in std_logic;
132
 
133
            -- Slave bus interface
134
            s_adr_o: out std_logic_vector (s_adr_width-1 downto 0);
135
            s_sel_o: out std_logic_vector ((s_dat_width/8)-1 downto 0);
136
            s_dat_i: in std_logic_vector (s_dat_width-1 downto 0);
137
            s_dat_o: out std_logic_vector (s_dat_width-1 downto 0);
138
            s_cyc_o: out std_logic;
139
            s_ack_i: in std_logic;
140
            s_err_i: in std_logic := '-';
141
            s_rty_i: in std_logic := '-';
142
            s_we_o: out std_logic;
143
            s_stb_o: out std_logic
144
        );
145
    end component;
146
 
147
    component wb_ro_async_master
148
        generic (
149
            dat_width: positive;
150
            adr_width: positive;
151
            ab_rd_delay: positive
152
        );
153
        port (
154
            wb_clk_i: in std_logic;
155
            wb_rst_i: in std_logic := '0';
156
 
157
            -- interface to wb slave devices
158
            wb_adr_o: out std_logic_vector (adr_width-1 downto 0);
159
            wb_sel_o: out std_logic_vector ((dat_width/8)-1 downto 0);
160
            wb_dat_i: in std_logic_vector (dat_width-1 downto 0);
161
            wb_dat_o: out std_logic_vector (dat_width-1 downto 0);
162
            wb_cyc_o: out std_logic;
163
            wb_ack_i: in std_logic;
164
            wb_err_i: in std_logic := '-';
165
            wb_rty_i: in std_logic := '-';
166
            wb_we_o: out std_logic;
167
            wb_stb_o: out std_logic;
168
 
169
            -- interface to the asyncronous master device
170
            ab_dat: inout std_logic_vector (dat_width-1 downto 0) := (others => 'Z');
171
            ab_adr: in std_logic_vector (adr_width-1 downto 0) := (others => 'U');
172
            ab_rd_n: in std_logic := '1';
173
            ab_wr_n: in std_logic := '1';
174
            ab_ce_n: in std_logic := '1';
175
            ab_byteen_n: in std_logic_vector ((dat_width/8)-1 downto 0);
176
            ab_wait_n: out std_logic; -- wait-state request 'open-drain' output
177
            ab_waiths: out std_logic  -- handshake-type totem-pole output
178
        );
179
    end component;
180
 
181
    component wb_async_master
182
        generic (
183
            dat_width: positive;
184
            adr_width: positive;
185
            ab_rd_delay: positive
186
        );
187
        port (
188
            wb_clk_i: in std_logic;
189
            wb_rst_i: in std_logic := '0';
190
 
191
            -- interface to wb slave devices
192
            wb_adr_o: out std_logic_vector (adr_width-1 downto 0);
193
            wb_sel_o: out std_logic_vector ((dat_width/8)-1 downto 0);
194
            wb_dat_i: in std_logic_vector (dat_width-1 downto 0);
195
            wb_dat_o: out std_logic_vector (dat_width-1 downto 0);
196
            wb_cyc_o: out std_logic;
197
            wb_ack_i: in std_logic;
198
            wb_err_i: in std_logic := '-';
199
            wb_rty_i: in std_logic := '-';
200
            wb_we_o: out std_logic;
201
            wb_stb_o: out std_logic;
202
 
203
            -- interface to the asyncronous master device
204
            ab_dat: inout std_logic_vector (dat_width-1 downto 0) := (others => 'Z');
205
            ab_adr: in std_logic_vector (adr_width-1 downto 0) := (others => 'U');
206
            ab_rd_n: in std_logic := '1';
207
            ab_wr_n: in std_logic := '1';
208
            ab_ce_n: in std_logic := '1';
209
            ab_byteen_n: in std_logic_vector ((dat_width/8)-1 downto 0);
210
            ab_wait_n: out std_logic; -- wait-state request 'open-drain' output
211
            ab_waiths: out std_logic  -- handshake-type totem-pole output
212
        );
213
    end component;
214
 
215
    component wb_async_master_2
216
        generic (
217
            dat_width: positive;
218
            adr_width: positive;
219
            ab_rd_delay: positive
220
        );
221
        port (
222
            wb_clk_i: in std_logic;
223
            wb_rst_i: in std_logic := '0';
224
 
225
            -- interface to wb slave devices
226
            wb_adr_o: out std_logic_vector (adr_width-1 downto 0);
227
            wb_sel_o: out std_logic_vector ((dat_width/8)-1 downto 0);
228
            wb_dat_i: in std_logic_vector (dat_width-1 downto 0);
229
            wb_dat_o: out std_logic_vector (dat_width-1 downto 0);
230
            wb_cyc_o: out std_logic;
231
            wb_ack_i: in std_logic;
232
            wb_err_i: in std_logic := '-';
233
            wb_rty_i: in std_logic := '-';
234
            wb_we_o: out std_logic;
235
            wb_stb_o: out std_logic;
236
 
237
            -- interface to the asyncronous master device
238
            ab_dat: inout std_logic_vector (dat_width-1 downto 0) := (others => 'Z');
239
            ab_adr: in std_logic_vector (adr_width-1 downto 0) := (others => 'U');
240
            ab_rd_n: in std_logic := '1';
241
            ab_wr_n: in std_logic := '1';
242
            ab_ce_n: in std_logic := '1';
243
            ab_byteen_n: in std_logic_vector ((dat_width/8)-1 downto 0);
244
            ab_wait_n: out std_logic; -- wait-state request 'open-drain' output
245
            ab_waiths: out std_logic; -- handshake-type totem-pole output
246
 
247
            -- debug signals
248
            db_rd_pulse: out std_logic
249
        );
250
    end component;
251
 
252
    component wb_async_slave
253
        generic (
254
            dat_width: positive := 16;
255
            adr_width: positive := 20
256
        );
257
        port (
258
            clk_i: in std_logic;
259
            rst_i: in std_logic := '0';
260
 
261
            -- interface for wait-state generator state-machine
262
            wait_state: in std_logic_vector (3 downto 0);
263
 
264
            -- interface to wishbone master device
265
            adr_i: in std_logic_vector (adr_width-1 downto 0);
266
            sel_i: in std_logic_vector ((adr_width/8)-1 downto 0);
267
            dat_i: in std_logic_vector (dat_width-1 downto 0);
268
            dat_o: out std_logic_vector (dat_width-1 downto 0);
269
            dat_oi: in std_logic_vector (dat_width-1 downto 0) := (others => '-');
270
            we_i: in std_logic;
271
            stb_i: in std_logic;
272
            ack_o: out std_logic := '0';
273
            ack_oi: in std_logic := '-';
274
 
275
            -- interface to async slave
276
            a_data: inout std_logic_vector (dat_width-1 downto 0) := (others => 'Z');
277
            a_addr: out std_logic_vector (adr_width-1 downto 0) := (others => 'U');
278
            a_rdn: out std_logic := '1';
279
            a_wrn: out std_logic := '1';
280
            a_cen: out std_logic := '1';
281
            -- byte-enable signals
282
            a_byen: out std_logic_vector ((dat_width/8)-1 downto 0)
283
        );
284
    end component;
285
 
286
    component wb_arbiter
287
        port (
288
    --      clk_i: in std_logic;
289
            rst_i: in std_logic := '0';
290
 
291
            -- interface to master device a
292
            a_we_i: in std_logic;
293
            a_stb_i: in std_logic;
294
            a_cyc_i: in std_logic;
295
            a_ack_o: out std_logic;
296
            a_ack_oi: in std_logic := '-';
297
            a_err_o: out std_logic;
298
            a_err_oi: in std_logic := '-';
299
            a_rty_o: out std_logic;
300
            a_rty_oi: in std_logic := '-';
301
 
302
            -- interface to master device b
303
            b_we_i: in std_logic;
304
            b_stb_i: in std_logic;
305
            b_cyc_i: in std_logic;
306
            b_ack_o: out std_logic;
307
            b_ack_oi: in std_logic := '-';
308
            b_err_o: out std_logic;
309
            b_err_oi: in std_logic := '-';
310
            b_rty_o: out std_logic;
311
            b_rty_oi: in std_logic := '-';
312
 
313
            -- interface to shared devices
314
            s_we_o: out std_logic;
315
            s_stb_o: out std_logic;
316
            s_cyc_o: out std_logic;
317
            s_ack_i: in std_logic;
318
            s_err_i: in std_logic := '-';
319
            s_rty_i: in std_logic := '-';
320
 
321
            mux_signal: out std_logic; -- 0: select A signals, 1: select B signals
322
 
323
            -- misc control lines
324
            priority: in std_logic -- 0: A have priority over B, 1: B have priority over A
325
        );
326
    end component;
327
 
328
    component wb_out_reg
329
        generic (
330
            reg_width : positive := 8;
331
            dat_width: positive := 8;
332
            offset: integer := 0
333
        );
334
        port (
335
            clk_i: in std_logic;
336
            rst_i: in std_logic;
337
            rst_val: std_logic_vector(reg_width-1 downto 0) := (others => '0');
338
 
339
            cyc_i: in std_logic := '1';
340
            stb_i: in std_logic;
341
                sel_i: in std_logic_vector (max2((dat_width/8)-1,0) downto 0) := (others => '1');
342
            we_i: in std_logic;
343
            ack_o: out std_logic;
344
            ack_oi: in std_logic := '-';
345
            adr_i: in std_logic_vector (size2bits((reg_width+offset+dat_width-1)/dat_width)-1 downto 0) := (others => '0');
346
            dat_i: in std_logic_vector (dat_width-1 downto 0);
347
            dat_oi: in std_logic_vector (dat_width-1 downto 0) := (others => '-');
348
            dat_o: out std_logic_vector (dat_width-1 downto 0);
349
            q: out std_logic_vector (reg_width-1 downto 0)
350
        );
351
    end component;
352
 
353
    component wb_in_reg
354
        generic (
355
            reg_width : positive := 8;
356
            dat_width: positive := 8;
357
            offset: integer := 0
358
        );
359
        port (
360
            clk_i: in std_logic;
361
            rst_i: in std_logic;
362
 
363
            cyc_i: in std_logic := '1';
364
            stb_i: in std_logic;
365
                sel_i: in std_logic_vector (max2((dat_width/8)-1,0) downto 0) := (others => '1');
366
            we_i: in std_logic;
367
            ack_o: out std_logic;
368
            ack_oi: in std_logic := '-';
369
            adr_i: in std_logic_vector (size2bits((reg_width+offset+dat_width-1)/dat_width)-1 downto 0) := (others => '0');
370
            dat_oi: in std_logic_vector (dat_width-1 downto 0) := (others => '-');
371
            dat_o: out std_logic_vector (dat_width-1 downto 0);
372
            i: in std_logic_vector (reg_width-1 downto 0)
373
        );
374
    end component;
375
 
376
        component wb_ram
377
        generic (
378
            dat_width: positive := 8;
379
            adr_width: positive := 10
380
        );
381
        port (
382
            clk_i: in std_logic;
383
--          rst_i: in std_logic := '0';
384
            adr_i: in std_logic_vector (adr_width-1 downto 0);
385
--          sel_i: in std_logic_vector ((dat_width/8)-1 downto 0) := (others => '1');
386
            dat_i: in std_logic_vector (dat_width-1 downto 0);
387
            dat_oi: in std_logic_vector (dat_width-1 downto 0) := (others => '-');
388
            dat_o: out std_logic_vector (dat_width-1 downto 0);
389
            cyc_i: in std_logic;
390
            ack_o: out std_logic;
391
            ack_oi: in std_logic := '-';
392
--          err_o: out std_logic;
393
--          err_oi: in std_logic := '-';
394
--          rty_o: out std_logic;
395
--          rty_oi: in std_logic := '-';
396
            we_i: in std_logic;
397
            stb_i: in std_logic
398
        );
399
    end component;
400
end components;
401
 

powered by: WebSVN 2.1.0

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