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

Subversion Repositories wb_builder

[/] [wb_builder/] [tags/] [arelease/] [rtl/] [vhdl/] [wb.vhd] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 unneback
-- Generated by PERL program wishbone.pl. Do not edit this file.
2
--
3
-- For defines see wishbone.defines
4
--
5
-- Generated Fri Apr 30 16:20:22 2004
6
--
7
-- Wishbone masters:
8
--   or32_i
9
--   or32_d
10
--
11
-- Wishbone slaves:
12
--   uart
13
--     baseadr 0x90000000 - size 0x00100000
14
--   bootRAM
15
--     baseadr 0x00000000 - size 0x00100000
16
-----------------------------------------------------------------------------------------
17
library IEEE;
18
use IEEE.std_logic_1164.all;
19
 
20
package intercon_package is
21
 
22
type or32_i_wbm_i_type is record
23
  dat_i : std_logic_vector(31 downto 0);
24
  err_i : std_logic;
25
  rty_i : std_logic;
26
  ack_i : std_logic;
27
end record;
28
type or32_i_wbm_o_type is record
29
  sel_o : std_logic_vector(3 downto 0);
30
  adr_o : std_logic_vector(31 downto 0);
31
  bte_o : std_logic_vector(1 downto 0);
32
  cti_o : std_logic_vector(2 downto 0);
33
  cyc_o : std_logic;
34
  stb_o : std_logic;
35
end record;
36
 
37
type or32_d_wbm_i_type is record
38
  dat_i : std_logic_vector(31 downto 0);
39
  err_i : std_logic;
40
  rty_i : std_logic;
41
  ack_i : std_logic;
42
end record;
43
type or32_d_wbm_o_type is record
44
  dat_o : std_logic_vector(31 downto 0);
45
  we_o  : std_logic;
46
  sel_o : std_logic_vector(3 downto 0);
47
  adr_o : std_logic_vector(31 downto 0);
48
  bte_o : std_logic_vector(1 downto 0);
49
  cti_o : std_logic_vector(2 downto 0);
50
  cyc_o : std_logic;
51
  stb_o : std_logic;
52
end record;
53
 
54
type uart_wbs_i_type is record
55
  dat_i : std_logic_vector(31 downto 0);
56
  we_i  : std_logic;
57
  sel_i : std_logic_vector(3 downto 0);
58
  adr_i : std_logic_vector(4 downto 0);
59
  cyc_i : std_logic;
60
  stb_i : std_logic;
61
end record;
62
type uart_wbs_o_type is record
63
  dat_o : std_logic_vector(31 downto 0);
64
  ack_o : std_logic;
65
end record;
66
type bootRAM_wbs_i_type is record
67
  dat_i : std_logic_vector(31 downto 0);
68
  we_i  : std_logic;
69
  sel_i : std_logic_vector(3 downto 0);
70
  adr_i : std_logic_vector(11 downto 2);
71
  cyc_i : std_logic;
72
  stb_i : std_logic;
73
end record;
74
type bootRAM_wbs_o_type is record
75
  dat_o : std_logic_vector(31 downto 0);
76
  ack_o : std_logic;
77
end record;
78
 
79
function "and" (
80
  l : std_logic_vector;
81
  r : std_logic)
82
return std_logic_vector;
83
end intercon_package;
84
package body intercon_package is
85
 
86
function "and" (
87
  l : std_logic_vector;
88
  r : std_logic)
89
return std_logic_vector is
90
  variable result : std_logic_vector(l'range);
91
begin  -- "and"
92
  for i in l'range loop
93
  result(i) := l(i) and r;
94
end loop;  -- i
95
return result;
96
end "and";
97
end intercon_package;
98
library IEEE;
99
use IEEE.std_logic_1164.all;
100
 
101
entity trafic_supervision is
102
 
103
  generic (
104
    priority     : integer;
105
    tot_priority : integer);
106
 
107
  port (
108
    bg           : in  std_logic;       -- bus grant
109
    ce           : in  std_logic;       -- clock enable
110
    trafic_limit : out std_logic;
111
    clk          : in  std_logic;
112
    reset        : in  std_logic);
113
 
114
end trafic_supervision;
115
 
116
architecture rtl of trafic_supervision is
117
 
118
  signal shreg : std_logic_vector(tot_priority-1 downto 0);
119
  signal cntr : integer range 0 to tot_priority;
120
 
121
begin  -- rtl
122
 
123
  -- purpose: holds information of usage of latest cycles
124
  -- type   : sequential
125
  -- inputs : clk, reset, ce, bg
126
  -- outputs: shreg('left)
127
  sh_reg: process (clk,reset)
128
  begin  -- process shreg
129
    if reset = '1' then                 -- asynchronous reset (active hi)
130
      shreg <= (others=>'0');
131
    elsif clk'event and clk = '1' then  -- rising clock edge
132
      if ce='1' then
133
        shreg <= shreg(tot_priority-2 downto 0) & bg;
134
      end if;
135
    end if;
136
  end process sh_reg;
137
 
138
  -- purpose: keeps track of used cycles
139
  -- type   : sequential
140
  -- inputs : clk, reset, shreg('left), bg, ce
141
  -- outputs: trafic_limit
142
  counter: process (clk, reset)
143
  begin  -- process counter
144
    if reset = '1' then                 -- asynchronous reset (active hi)
145
      cntr <= 0;
146
      trafic_limit <= '0';
147
    elsif clk'event and clk = '1' then  -- rising clock edge
148
      if ce='1' then
149
        if bg='1' and shreg(tot_priority-1)='0' then
150
          cntr <= cntr + 1;
151
          if cntr=priority-1 then
152
            trafic_limit <= '1';
153
          end if;
154
        elsif bg='0' and shreg(tot_priority-1)='1' then
155
          cntr <= cntr - 1;
156
          if cntr=priority then
157
            trafic_limit <= '0';
158
          end if;
159
        end if;
160
      end if;
161
    end if;
162
  end process counter;
163
 
164
end rtl;
165
 
166
library IEEE;
167
use IEEE.std_logic_1164.all;
168
use work.intercon_package.all;
169
 
170
entity intercon is
171
  port (
172
  -- wishbone master port(s)
173
  -- or32_i
174
  or32_i_wbm_i : out or32_i_wbm_i_type;
175
  or32_i_wbm_o : in  or32_i_wbm_o_type;
176
  -- or32_d
177
  or32_d_wbm_i : out or32_d_wbm_i_type;
178
  or32_d_wbm_o : in  or32_d_wbm_o_type;
179
  -- wishbone slave port(s)
180
  -- uart
181
  uart_wbs_i : out uart_wbs_i_type;
182
  uart_wbs_o : in uart_wbs_o_type;
183
  -- bootRAM
184
  bootRAM_wbs_i : out bootRAM_wbs_i_type;
185
  bootRAM_wbs_o : in bootRAM_wbs_o_type;
186
  -- clock and reset
187
  clk   : in std_logic;
188
  reset : in std_logic);
189
end intercon;
190
architecture rtl of intercon is
191
  signal or32_i_dat_i : std_logic_vector(31 downto 0);
192
  signal or32_i_ack_i : std_logic;
193
  signal or32_i_err_i : std_logic;
194
  signal or32_i_rty_i : std_logic;
195
  signal or32_i_sel_o : std_logic_vector(3 downto 0);
196
  signal or32_i_adr_o : std_logic_vector(31 downto 0);
197
  signal or32_i_bte_o : std_logic_vector(1 downto 0);
198
  signal or32_i_cti_o : std_logic_vector(2 downto 0);
199
  signal or32_i_cyc_o : std_logic;
200
  signal or32_i_stb_o : std_logic;
201
  signal or32_d_dat_i : std_logic_vector(31 downto 0);
202
  signal or32_d_ack_i : std_logic;
203
  signal or32_d_err_i : std_logic;
204
  signal or32_d_rty_i : std_logic;
205
  signal or32_d_dat_o : std_logic_vector(31 downto 0);
206
  signal or32_d_we_o  : std_logic;
207
  signal or32_d_sel_o : std_logic_vector(3 downto 0);
208
  signal or32_d_adr_o : std_logic_vector(31 downto 0);
209
  signal or32_d_bte_o : std_logic_vector(1 downto 0);
210
  signal or32_d_cti_o : std_logic_vector(2 downto 0);
211
  signal or32_d_cyc_o : std_logic;
212
  signal or32_d_stb_o : std_logic;
213
  signal uart_dat_o : std_logic_vector(31 downto 0);
214
  signal uart_ack_o : std_logic;
215
  signal uart_dat_i : std_logic_vector(31 downto 0);
216
  signal uart_we_i  : std_logic;
217
  signal uart_sel_i : std_logic_vector(3 downto 0);
218
  signal uart_adr_i : std_logic_vector(4 downto 0);
219
  signal uart_cyc_i : std_logic;
220
  signal uart_stb_i : std_logic;
221
  signal bootRAM_dat_o : std_logic_vector(31 downto 0);
222
  signal bootRAM_ack_o : std_logic;
223
  signal bootRAM_dat_i : std_logic_vector(31 downto 0);
224
  signal bootRAM_we_i  : std_logic;
225
  signal bootRAM_sel_i : std_logic_vector(3 downto 0);
226
  signal bootRAM_adr_i : std_logic_vector(11 downto 2);
227
  signal bootRAM_cyc_i : std_logic;
228
  signal bootRAM_stb_i : std_logic;
229
  signal or32_i_bootRAM_ss : std_logic; -- slave select
230
  signal or32_i_bootRAM_bg : std_logic; -- bus grant
231
  signal or32_d_uart_ss : std_logic; -- slave select
232
  signal or32_d_uart_bg : std_logic; -- bus grant
233
  signal or32_d_bootRAM_ss : std_logic; -- slave select
234
  signal or32_d_bootRAM_bg : std_logic; -- bus grant
235
begin  -- rtl
236
or32_d_uart_bg <= or32_d_uart_ss and or32_d_cyc_o;
237
arbiter_bootRAM : block
238
  signal or32_i_bg, or32_i_bg_1, or32_i_bg_2, or32_i_bg_q : std_logic;
239
  signal or32_i_trafic_limit : std_logic;
240
  signal or32_d_bg, or32_d_bg_1, or32_d_bg_2, or32_d_bg_q : std_logic;
241
  signal or32_d_trafic_limit : std_logic;
242
  signal ce, idle, ack : std_logic;
243
begin
244
ack <= bootRAM_ack_o;
245
 
246
trafic_supervision_1 : entity work.trafic_supervision
247
generic map(
248
  priority => 3,
249
  tot_priority => 4)
250
port map(
251
  bg => or32_i_bootRAM_bg,
252
  ce => ce,
253
  trafic_limit => or32_i_trafic_limit,
254
  clk => clk,
255
  reset => reset);
256
 
257
trafic_supervision_2 : entity work.trafic_supervision
258
generic map(
259
  priority => 1,
260
  tot_priority => 4)
261
port map(
262
  bg => or32_d_bootRAM_bg,
263
  ce => ce,
264
  trafic_limit => or32_d_trafic_limit,
265
  clk => clk,
266
  reset => reset);
267
 
268
process(clk,reset)
269
begin
270
if reset='1' then
271
  or32_i_bg_q <= '0';
272
elsif clk'event and clk='1' then
273
if or32_i_bg_q='0' then
274
  or32_i_bg_q <= or32_i_bg;
275
elsif ack='1' and (or32_i_cti_o="000" or or32_i_cti_o="111") then
276
  or32_i_bg_q <= '0';
277
end if;
278
end if;
279
end process;
280
 
281
process(clk,reset)
282
begin
283
if reset='1' then
284
  or32_d_bg_q <= '0';
285
elsif clk'event and clk='1' then
286
if or32_d_bg_q='0' then
287
  or32_d_bg_q <= or32_d_bg;
288
elsif ack='1' and (or32_d_cti_o="000" or or32_d_cti_o="111") then
289
  or32_d_bg_q <= '0';
290
end if;
291
end if;
292
end process;
293
 
294
idle <= '1' when or32_i_bg_q='0' and or32_d_bg_q='0' else '0';
295
or32_i_bg_1 <= '1' when idle='1' and or32_i_cyc_o='1' and or32_i_bootRAM_ss='1' and or32_i_trafic_limit='0' else '0';
296
or32_d_bg_1 <= '1' when idle='1' and or32_i_bg_1='0' and or32_d_cyc_o='1' and or32_d_bootRAM_ss='1' and or32_d_trafic_limit='0' else '0';
297
or32_i_bg_2 <= '1' when idle='1' and or32_d_bg_1='0' and or32_i_cyc_o='1' and or32_i_bootRAM_ss='1' else '0';
298
or32_d_bg_2 <= '1' when idle='1' and or32_i_bg_2='0' and or32_d_cyc_o='1' and or32_d_bootRAM_ss='1' else '0';
299
or32_i_bg <= or32_i_bg_q or or32_i_bg_1 or or32_i_bg_2;
300
or32_d_bg <= or32_d_bg_q or or32_d_bg_1 or or32_d_bg_2;
301
ce <= (or32_i_cyc_o and or32_i_bootRAM_ss) or (or32_d_cyc_o and or32_d_bootRAM_ss) when idle='1' else '0';
302
or32_i_bootRAM_bg <= or32_i_bg;
303
or32_d_bootRAM_bg <= or32_d_bg;
304
end block arbiter_bootRAM;
305
decoder:block
306
begin
307
or32_i_bootRAM_ss <= '1' when or32_i_adr_o(31 downto 20)="000000000000" else
308
'0';
309
or32_d_uart_ss <= '1' when or32_d_adr_o(31 downto 20)="100100000000" else
310
'0';
311
or32_d_bootRAM_ss <= '1' when or32_d_adr_o(31 downto 20)="000000000000" else
312
'0';
313
uart_adr_i <= or32_d_adr_o(4 downto 0);
314
bootRAM_adr_i <= (or32_i_adr_o(11 downto 2) and or32_i_bootRAM_bg) or (or32_d_adr_o(11 downto 2) and or32_d_bootRAM_bg);
315
end block decoder;
316
 
317
-- cyc_i(s)
318
uart_cyc_i <= (or32_d_cyc_o and or32_d_uart_bg);
319
bootRAM_cyc_i <= (or32_i_cyc_o and or32_i_bootRAM_bg) or (or32_d_cyc_o and or32_d_bootRAM_bg);
320
-- stb_i(s)
321
uart_stb_i <= (or32_d_stb_o and or32_d_uart_bg);
322
bootRAM_stb_i <= (or32_i_stb_o and or32_i_bootRAM_bg) or (or32_d_stb_o and or32_d_bootRAM_bg);
323
-- we_i(s)
324
uart_we_i <= (or32_d_we_o and or32_d_uart_bg);
325
bootRAM_we_i <= (or32_d_we_o and or32_d_bootRAM_bg);
326
-- ack_i(s)
327
or32_i_ack_i <= (bootRAM_ack_o and or32_i_bootRAM_bg);
328
or32_d_ack_i <= (uart_ack_o and or32_d_uart_bg) or (bootRAM_ack_o and or32_d_bootRAM_bg);
329
-- rty_i(s)
330
or32_i_rty_i <= '0';
331
or32_d_rty_i <= '0';
332
-- err_i(s)
333
or32_i_err_i <= '0';
334
or32_d_err_i <= '0';
335
-- sel_i(s)
336
uart_sel_i <= (or32_d_sel_o and or32_d_uart_bg);
337
bootRAM_sel_i <= (or32_i_sel_o and or32_i_bootRAM_bg) or (or32_d_sel_o and or32_d_bootRAM_bg);
338
-- slave dat_i(s)
339
uart_dat_i <= or32_d_dat_o;
340
bootRAM_dat_i <= or32_d_dat_o;
341
-- master dat_i(s)
342
or32_i_dat_i <= bootRAM_dat_o;
343
or32_d_dat_i <= (uart_dat_o and or32_d_uart_bg) or (bootRAM_dat_o and or32_d_bootRAM_bg);
344
-- tgc_i
345
-- tga_i
346
or32_i_wbm_i.dat_i <= or32_i_dat_i;
347
or32_i_wbm_i.ack_i <= or32_i_ack_i ;
348
or32_i_wbm_i.err_i <= or32_i_err_i;
349
or32_i_wbm_i.rty_i <= or32_i_rty_i;
350
or32_i_sel_o <= or32_i_wbm_o.sel_o;
351
or32_i_adr_o <= or32_i_wbm_o.adr_o;
352
or32_i_cti_o <= or32_i_wbm_o.cti_o;
353
or32_i_bte_o <= or32_i_wbm_o.bte_o;
354
or32_i_cyc_o <= or32_i_wbm_o.cyc_o;
355
or32_i_stb_o <= or32_i_wbm_o.stb_o;
356
or32_d_wbm_i.dat_i <= or32_d_dat_i;
357
or32_d_wbm_i.ack_i <= or32_d_ack_i ;
358
or32_d_wbm_i.err_i <= or32_d_err_i;
359
or32_d_wbm_i.rty_i <= or32_d_rty_i;
360
or32_d_dat_o <= or32_d_wbm_o.dat_o;
361
or32_d_we_o  <= or32_d_wbm_o.we_o;
362
or32_d_sel_o <= or32_d_wbm_o.sel_o;
363
or32_d_adr_o <= or32_d_wbm_o.adr_o;
364
or32_d_cti_o <= or32_d_wbm_o.cti_o;
365
or32_d_bte_o <= or32_d_wbm_o.bte_o;
366
or32_d_cyc_o <= or32_d_wbm_o.cyc_o;
367
or32_d_stb_o <= or32_d_wbm_o.stb_o;
368
uart_dat_o <= uart_wbs_o.dat_o;
369
uart_ack_o <= uart_wbs_o.ack_o;
370
uart_wbs_i.dat_i <= uart_dat_i;
371
uart_wbs_i.we_i  <= uart_we_i;
372
uart_wbs_i.sel_i <= uart_sel_i;
373
uart_wbs_i.adr_i <= uart_adr_i;
374
uart_wbs_i.cyc_i <= uart_cyc_i;
375
uart_wbs_i.stb_i <= uart_stb_i;
376
bootRAM_dat_o <= bootRAM_wbs_o.dat_o;
377
bootRAM_ack_o <= bootRAM_wbs_o.ack_o;
378
bootRAM_wbs_i.dat_i <= bootRAM_dat_i;
379
bootRAM_wbs_i.we_i  <= bootRAM_we_i;
380
bootRAM_wbs_i.sel_i <= bootRAM_sel_i;
381
bootRAM_wbs_i.adr_i <= bootRAM_adr_i;
382
bootRAM_wbs_i.cyc_i <= bootRAM_cyc_i;
383
bootRAM_wbs_i.stb_i <= bootRAM_stb_i;
384
end rtl;

powered by: WebSVN 2.1.0

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