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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.communication/] [hibi/] [3.0/] [vhd/] [hibi_wrapper_r4.vhd] - Blame information for rev 155

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- File        : hibi_wrapper_r4.vhd
3
-- Description : hibi bus wrapper, interface revision 4
4
--                - one muxed IP interface for regular and hi-prior data
5
--                - IP writes/gets addr and data sequentially
6
--
7
-- Author      : Ari Kulmala
8
-- Date        : 16.8.2004
9
-- Modified    : 
10
 
11
-------------------------------------------------------------------------------
12
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
13
--
14
-- This file is part of HIBI
15
--
16
-- This source file may be used and distributed without
17
-- restriction provided that this copyright statement is not
18
-- removed from the file and that any derivative work contains
19
-- the original copyright notice and the associated disclaimer.
20
--
21
-- This source file is free software; you can redistribute it
22
-- and/or modify it under the terms of the GNU Lesser General
23
-- Public License as published by the Free Software Foundation;
24
-- either version 2.1 of the License, or (at your option) any
25
-- later version.
26
--
27
-- This source is distributed in the hope that it will be
28
-- useful, but WITHOUT ANY WARRANTY; without even the implied
29
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
30
-- PURPOSE.  See the GNU Lesser General Public License for more
31
-- details.
32
--
33
-- You should have received a copy of the GNU Lesser General
34
-- Public License along with this source; if not, download it
35
-- from http://www.opencores.org/lgpl.shtml
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
 
42
 
43
entity hibi_wrapper_r4 is
44
  generic (
45
 
46
    ---------------------------------------------------------------------------
47
    -- NOTES:
48
    --
49
    --  n_   = number of
50
    --  lte  = less than or equal
51
    --  gte  = greater than or equal 
52
    ---------------------------------------------------------------------------
53
 
54
    ---------------------------------------------------------------------------
55
    -- STRUCTURAL SETTINGS
56
    --
57
    -- Widths are in bits
58
    ---------------------------------------------------------------------------
59
 
60
    -- lte data_width (no restriction when address and data bus are separated)
61
    addr_width_g    : integer := 32;
62
    data_width_g    : integer := 32;    -- Width of the data bus
63
    comm_width_g    : integer := 5;     -- Command bus width
64
    counter_width_g : integer := 7;     -- gte (n_agents, max_send...) 
65
    debug_width_g   : integer := 0;     -- for special monitors
66
 
67
    --  All FIFO depths are given in words
68
    --  Allowed values 0,2,3... words.
69
    --  Prefix msg refers to hi-prior data
70
    rx_fifo_depth_g     : integer := 5;
71
    tx_fifo_depth_g     : integer := 5;
72
    rx_msg_fifo_depth_g : integer := 5;
73
    tx_msg_fifo_depth_g : integer := 5;
74
 
75
    --  Clocking and synchronization
76
    -- fifo_sel: 0 synch multiclk,         1 basic GALS,
77
    --           2 Gray FIFO (depth=2^n!), 3 mixed clock pausible
78
    fifo_sel_g       : integer := 0;    -- use 0 for synchronous systems
79
    --  E.g. Synch_multiclk FIFOs must know the ratio of frequencies
80
    rel_agent_freq_g : integer := 1;
81
    rel_bus_freq_g   : integer := 1;
82
 
83
    ---------------------------------------------------------------------------
84
    -- FUNCTIONAL SETTINGS
85
    ---------------------------------------------------------------------------
86
 
87
    -- ADDRESSING:
88
    addr_g         : integer := 46;     -- unique for each wrapper
89
    inv_addr_en_g  : integer := 0;      -- only for bridges
90
 
91
 
92
    -- ARBITRATION:
93
    --  arb_type 0 round-robin, 1 priority, 2 combined, 3 DAA.
94
    --  TDMA is enabled by setting n_time_slots > 0
95
    --  Ensure that all wrappers in a segment agree on arb_type,
96
    --  n_agents, and n_slots. Max_send can be wrapper-specific.
97
    n_agents_g     : integer := 4;      -- within one segment
98
    prior_g        : integer := 2;      -- lte n_agents
99
    max_send_g     : integer := 50;     -- in words, 0 means unlimited
100
    n_time_slots_g : integer := 0;      -- for TDMA
101
    arb_type_g     : integer := 0;
102
    keep_slot_g    : integer := 1;      -- for TDMA
103
 
104
    -- CONFIGURATION MEMORY:
105
    id_g             : integer := 5;    -- used instead of addr in recfg
106
    id_width_g       : integer := 4;    -- gte(log2(id_g))
107
    cfg_re_g         : integer := 0;    -- enable reading config
108
    cfg_we_g         : integer := 0;    -- enable writing config
109
    n_extra_params_g : integer := 0;    -- app-specific registers
110
    --  Having multiple pages allows fast reconfig
111
    n_cfg_pages_g    : integer := 1;
112
    --  Note that cfg memory initialization is done with separate
113
    --  package if you have many time slots or configuration pages
114
 
115
 
116
    id_min_g        : integer := 0;     -- Only for bridges, zero for others!
117
    id_max_g        : integer := 0;     -- Only for bridges, zero for others!
118
    addr_limit_g    : integer := 0;     -- Upper address boundary
119
    separate_addr_g : integer := 0      -- 1, if address is not multiplexed
120
 
121
    );
122
  port (
123
    bus_clk        : in std_logic;
124
    agent_clk      : in std_logic;
125
    -- pulsed clocks as used in pausible clock scheme (fifo 3)
126
    -- IF fifo 1 and fast synch is used, sync clocks is used as the
127
    -- HIBI synch clock 
128
    bus_sync_clk   : in std_logic;
129
    agent_sync_clk : in std_logic;
130
    rst_n          : in std_logic;
131
    bus_comm_in    : in std_logic_vector (comm_width_g-1 downto 0);
132
    bus_data_in    : in std_logic_vector (data_width_g-1 downto 0);
133
    bus_full_in    : in std_logic;
134
    bus_lock_in    : in std_logic;
135
    bus_av_in      : in std_logic;
136
 
137
    agent_comm_in : in std_logic_vector (comm_width_g-1 downto 0);
138
    agent_data_in : in std_logic_vector (data_width_g-1 downto 0);
139
    agent_av_in   : in std_logic;
140
    agent_we_in   : in std_logic;
141
    agent_re_in   : in std_logic;
142
 
143
    bus_comm_out : out std_logic_vector (comm_width_g-1 downto 0);
144
    bus_data_out : out std_logic_vector (data_width_g-1 downto 0);
145
    bus_full_out : out std_logic;
146
    bus_lock_out : out std_logic;
147
    bus_av_out   : out std_logic;
148
 
149
    agent_comm_out  : out std_logic_vector (comm_width_g-1 downto 0);
150
    agent_data_out  : out std_logic_vector (data_width_g-1 downto 0);
151
    agent_av_out    : out std_logic;
152
    agent_full_out  : out std_logic;
153
    agent_one_p_out : out std_logic;
154
    agent_empty_out : out std_logic;
155
    agent_one_d_out : out std_logic
156
 
157
    -- synthesis translate_off
158
    -- pragma translate_off
159
;
160
    debug_out : out std_logic_vector(debug_width_g-1 downto 0);
161
    debug_in  : in  std_logic_vector(debug_width_g-1 downto 0)
162
    -- pragma translate_on
163
    -- synthesis translate_on
164
    );
165
end hibi_wrapper_r4;
166
 
167
 
168
 
169
 
170
architecture structural of hibi_wrapper_r4 is
171
 
172
 
173
  -- structure
174
  --                           hibi_wrapper_r4
175
  --              ####################################
176
  --              #    (de)muxes      # hibi r1      #
177
  --              #                   #              #
178
  -- ip_input     => fifo_demux_wr   ==> hibiv.2     => bus_output
179
  --              #            (dw)   #              #
180
  --              #                   #              #
181
  --              #                   #              #
182
  -- ip_output   <=  fifo_mux_rd    <==  hibiv.2    <= bus_input
183
  --              #           (mr)    #              #
184
  --              #                   #              #
185
  --              #                   #              #
186
  --              ####################################
187
  --
188
  --
189
  -- signal names  =>              xxx_mw_dw               xxx_dw_h
190
  --               <=              xxx_mr_dr               xxx_h_mr
191
  --               
192
 
193
  -- Signals between fifo_demux_wr and hibi wrapper r1
194
  -- (IP writes to bus)
195
  signal data_dw_h    : std_logic_vector (data_width_g-1 downto 0);
196
  signal comm_dw_h    : std_logic_vector (comm_width_g-1 downto 0);
197
  signal av_dw_h      : std_logic;
198
  signal we_0_dw_h    : std_logic;
199
  signal we_1_dw_h    : std_logic;
200
  signal full_0_h_dw  : std_logic;      --
201
  signal full_1_h_dw  : std_logic;
202
  signal one_p_0_h_dw : std_logic;
203
  signal one_p_1_h_dw : std_logic;
204
 
205
 
206
  -- signals between hibi wrapper r1 and fifo_mux_rd
207
  -- (IP receives data from bus)
208
  signal data_0_h_mr  : std_logic_vector (data_width_g-1 downto 0);
209
  signal comm_0_h_mr  : std_logic_vector (comm_width_g-1 downto 0);
210
  signal data_1_h_mr  : std_logic_vector (data_width_g-1 downto 0);
211
  signal comm_1_h_mr  : std_logic_vector (comm_width_g-1 downto 0);
212
  signal av_0_h_mr    : std_logic;
213
  signal av_1_h_mr    : std_logic;
214
  signal re_0_mr_h    : std_logic;
215
  signal re_1_mr_h    : std_logic;
216
  signal empty_0_h_mr : std_logic;
217
  signal empty_1_h_mr : std_logic;
218
  signal one_d_0_h_mr : std_logic;
219
  signal one_d_1_h_mr : std_logic;
220
 
221
  -- Takes regular and hi-prior data in from IP and writes
222
  -- them two FIFOs of wrapper r1
223
  component fifo_demux_wr
224
    generic (
225
      data_width_g : integer := 0;
226
      comm_width_g : integer := 0
227
      );
228
    port (
229
      -- 13.04 fully asynchronous!
230
      data_in    : in  std_logic_vector (data_width_g-1 downto 0);
231
      av_in      : in  std_logic;
232
      comm_in    : in  std_logic_vector (comm_width_g-1 downto 0);
233
      we_in      : in  std_logic;
234
      one_p_out  : out std_logic;
235
      full_out   : out std_logic;
236
      -- data/comm/av connected to both fifos
237
      -- distinction made with we!
238
      data_out   : out std_logic_vector (data_width_g-1 downto 0);
239
      comm_out   : out std_logic_vector (comm_width_g-1 downto 0);
240
      av_out     : out std_logic;
241
      we_0_out   : out std_logic;
242
      we_1_out   : out std_logic;
243
      full_0_in  : in  std_logic;
244
      full_1_in  : in  std_logic;
245
      one_p_0_in : in  std_logic;
246
      one_p_1_in : in  std_logic
247
      );
248
  end component;  --fifo_demux_wr;
249
 
250
  -- Gets regualr and hi-prior data from wrapper r1
251
  -- and multiplexes them so that IP can read them
252
  component fifo_mux_rd
253
    generic (
254
      data_width_g : integer := 0;
255
      comm_width_g : integer := 0;
256
      separate_addr_g : integer
257
      );
258
    port (
259
      clk   : in std_logic;
260
      rst_n : in std_logic;
261
 
262
      data_0_in  : in  std_logic_vector (data_width_g-1 downto 0);
263
      comm_0_in  : in  std_logic_vector (comm_width_g-1 downto 0);
264
      av_0_in    : in  std_logic;
265
      one_d_0_in : in  std_logic;
266
      empty_0_in : in  std_logic;
267
      re_0_out   : out std_logic;
268
 
269
      data_1_in  : in  std_logic_vector (data_width_g-1 downto 0);
270
      comm_1_in  : in  std_logic_vector (comm_width_g-1 downto 0);
271
      av_1_in    : in  std_logic;
272
      one_d_1_in : in  std_logic;
273
      empty_1_in : in  std_logic;
274
      re_1_out   : out std_logic;
275
      re_in      : in  std_logic;
276
 
277
      data_out  : out std_logic_vector (data_width_g-1 downto 0);
278
      comm_out  : out std_logic_vector (comm_width_g-1 downto 0);
279
      av_out    : out std_logic;
280
      one_d_out : out std_logic;
281
      empty_out : out std_logic
282
      );
283
  end component;  --fifo_mux_rd;
284
 
285
begin
286
 
287
  hibi_wra : entity work.hibi_wrapper_r1
288
    --hibi_wra : hibi_wrapper
289
    generic map(
290
      id_g      => id_g,
291
 
292
      id_width_g      => id_width_g,
293
      addr_width_g    => addr_width_g,
294
      data_width_g    => data_width_g,
295
      comm_width_g    => comm_width_g,
296
      counter_width_g => counter_width_g,
297
 
298
      rel_bus_freq_g   => rel_bus_freq_g,
299
      rel_agent_freq_g => rel_agent_freq_g,
300
 
301
      rx_fifo_depth_g     => rx_fifo_depth_g,
302
      rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
303
      tx_fifo_depth_g     => tx_fifo_depth_g,
304
      tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
305
 
306
      fifo_sel_g => fifo_sel_g,
307
      arb_type_g => arb_type_g,
308
 
309
      addr_g        => addr_g,
310
      prior_g       => prior_g,
311
      inv_addr_en_g => inv_addr_en_g,
312
 
313
      max_send_g       => max_send_g,
314
      n_agents_g       => n_agents_g,
315
      n_cfg_pages_g    => n_cfg_pages_g,
316
      n_time_slots_g   => n_time_slots_g,
317
      keep_slot_g      => keep_slot_g,
318
      n_extra_params_g => n_extra_params_g,
319
 
320
      cfg_re_g         => cfg_re_g,
321
      cfg_we_g         => cfg_we_g,
322
      debug_width_g    => debug_width_g,
323
 
324
      id_min_g        => id_min_g,
325
      id_max_g        => id_max_g,
326
      addr_limit_g    => addr_limit_g,
327
      separate_addr_g => separate_addr_g
328
      )
329
    port map(
330
      bus_clk        => bus_clk,
331
      agent_clk      => agent_clk,
332
      bus_sync_clk   => bus_sync_clk,
333
      agent_sync_clk => agent_sync_clk,
334
      rst_n          => rst_n,
335
 
336
      bus_comm_in => bus_comm_in,
337
      bus_data_in => bus_data_in,
338
      bus_full_in => bus_full_in,
339
      bus_lock_in => bus_lock_in,
340
      bus_av_in   => bus_av_in,
341
 
342
      agent_av_in     => av_dw_h,
343
      agent_data_in   => data_dw_h,
344
      agent_comm_in   => comm_dw_h,
345
      agent_we_in     => we_1_dw_h,
346
      agent_full_out  => full_1_h_dw,
347
      agent_one_p_out => one_p_1_h_dw,
348
 
349
      agent_msg_av_in     => agent_av_in,
350
      agent_msg_data_in   => agent_data_in,
351
      agent_msg_comm_in   => agent_comm_in,
352
      agent_msg_we_in     => we_0_dw_h,
353
      agent_msg_full_out  => full_0_h_dw,
354
      agent_msg_one_p_out => one_p_0_h_dw,
355
 
356
      bus_av_out   => bus_av_out,
357
      bus_comm_out => bus_comm_out,
358
      bus_data_out => bus_data_out,
359
      bus_full_out => bus_full_out,
360
      bus_lock_out => bus_lock_out,
361
 
362
      agent_av_out    => av_1_h_mr,
363
      agent_data_out  => data_1_h_mr,
364
      agent_comm_out  => comm_1_h_mr,
365
      agent_re_in     => re_1_mr_h,
366
      agent_empty_out => empty_1_h_mr,
367
      agent_one_d_out => one_d_1_h_mr,
368
 
369
      agent_msg_av_out    => av_0_h_mr,
370
      agent_msg_data_out  => data_0_h_mr,
371
      agent_msg_comm_out  => comm_0_h_mr,
372
      agent_msg_re_in     => re_0_mr_h,
373
      agent_msg_empty_out => empty_0_h_mr,
374
      agent_msg_one_d_out => one_d_0_h_mr
375
 
376
      --synthesis translate_off
377
      ,
378
      debug_in  => debug_in,
379
      debug_out => debug_out
380
      --synthesis translate_on
381
      );
382
 
383
 
384
 
385
 
386
 
387
  -- if-generate added,  04.05.2005 Es
388
  map_mux_rd : if rx_fifo_depth_g > 0 and rx_msg_fifo_depth_g > 0 generate
389
 
390
    -- reads to fifos and
391
    -- writes addr and data sequentially forward depending on command
392
    -- reads data from hibi wrapper.
393
    mr : fifo_mux_rd
394
      generic map(
395
        data_width_g => data_width_g,
396
        comm_width_g => comm_width_g,
397
        separate_addr_g => separate_addr_g
398
        )
399
      port map(
400
        clk   => agent_clk,
401
        rst_n => rst_n,
402
 
403
        av_0_in    => av_0_h_mr,
404
        data_0_in  => data_0_h_mr,
405
        comm_0_in  => comm_0_h_mr,
406
        one_d_0_in => one_d_0_h_mr,
407
        empty_0_in => empty_0_h_mr,
408
        re_0_out   => re_0_mr_h,
409
 
410
        av_1_in    => av_1_h_mr,
411
        data_1_in  => data_1_h_mr,
412
        comm_1_in  => comm_1_h_mr,
413
        one_d_1_in => one_d_1_h_mr,
414
        empty_1_in => empty_1_h_mr,
415
        re_1_out   => re_1_mr_h,
416
        re_in      => agent_re_in,
417
 
418
        av_out    => agent_av_out,
419
        data_out  => agent_data_out,
420
        comm_out  => agent_comm_out,
421
        one_d_out => agent_one_d_out,
422
        empty_out => agent_empty_out
423
        );
424
 
425
    -- takes addr and data sequentially and writes them
426
    -- into one of two fifos depending on command
427
    -- gets data from ip and writes it to hibi wrapper
428
    dw : fifo_demux_wr
429
      generic map(
430
        data_width_g => data_width_g,
431
        comm_width_g => comm_width_g
432
        )
433
      port map(
434
        -- 13.04 fully asynchronous!
435
        data_in    => agent_data_in,
436
        av_in      => agent_av_in,
437
        comm_in    => agent_comm_in,
438
        we_in      => agent_we_in,
439
        one_p_out  => agent_one_p_out,
440
        full_out   => agent_full_out,
441
        -- data/comm/av connected to both fifos
442
        -- distinction made with we!
443
        av_out     => av_dw_h,
444
        data_out   => data_dw_h,
445
        comm_out   => comm_dw_h,
446
        we_0_out   => we_0_dw_h,
447
        we_1_out   => we_1_dw_h,
448
        full_0_in  => full_0_h_dw,
449
        full_1_in  => full_1_h_dw,
450
        one_p_0_in => one_p_0_h_dw,
451
        one_p_1_in => one_p_1_h_dw
452
        );
453
 
454
  end generate map_mux_rd;
455
 
456
  not_map_fifo_low : if rx_fifo_depth_g = 0 generate
457
 
458
    -- now map the msg fifo signals straight to the output
459
    agent_av_out    <= av_0_h_mr;
460
    agent_data_out  <= data_0_h_mr;
461
    agent_comm_out  <= comm_0_h_mr;
462
    agent_one_d_out <= one_d_0_h_mr;
463
    agent_empty_out <= empty_0_h_mr;
464
    re_0_mr_h       <= agent_re_in;
465
 
466
    agent_full_out  <= full_0_h_dw;
467
    agent_one_p_out <= one_p_0_h_dw;
468
    av_dw_h         <= agent_av_in;
469
    data_dw_h       <= agent_data_in;
470
    comm_dw_h       <= agent_comm_in;
471
    we_0_dw_h       <= agent_we_in;
472
 
473
--    agent_av_out    <= av_0_h_mr or av_1_h_mr;
474
--    agent_data_out  <= data_0_h_mr or data_1_h_mr;
475
--    agent_comm_out  <= comm_0_h_mr or comm_1_h_mr;
476
--    agent_one_d_out <= one_d_0_h_mr or one_d_1_h_mr;
477
--    agent_empty_out <= empty_0_h_mr and empty_1_h_mr;  -- note : AND instead of OR
478
 
479
--    re_1_mr_h <= agent_re_in;
480
 
481
  end generate not_map_fifo_low;
482
 
483
 
484
  not_map_fifo_high : if rx_msg_fifo_depth_g = 0 generate
485
 
486
    -- now map the msg fifo signals straight to the output
487
    agent_av_out    <= av_1_h_mr;
488
    agent_data_out  <= data_1_h_mr;
489
    agent_comm_out  <= comm_1_h_mr;
490
    agent_one_d_out <= one_d_1_h_mr;
491
    agent_empty_out <= empty_1_h_mr;
492
    re_1_mr_h       <= agent_re_in;
493
 
494
    agent_full_out  <= full_1_h_dw;
495
    agent_one_p_out <= one_p_1_h_dw;
496
    av_dw_h         <= agent_av_in;
497
    data_dw_h       <= agent_data_in;
498
    comm_dw_h       <= agent_comm_in;
499
    we_1_dw_h       <= agent_we_in;
500
 
501
  end generate not_map_fifo_high;
502
 
503
end structural;

powered by: WebSVN 2.1.0

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