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/] [2.0/] [vhd/] [hibi_wrapper_r3.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
3
--
4
-- This source file may be used and distributed without
5
-- restriction provided that this copyright statement is not
6
-- removed from the file and that any derivative work contains
7
-- the original copyright notice and the associated disclaimer.
8
--
9
-- This source file is free software; you can redistribute it
10
-- and/or modify it under the terms of the GNU Lesser General
11
-- Public License as published by the Free Software Foundation;
12
-- either version 2.1 of the License, or (at your option) any
13
-- later version.
14
--
15
-- This source is distributed in the hope that it will be
16
-- useful, but WITHOUT ANY WARRANTY; without even the implied
17
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18
-- PURPOSE.  See the GNU Lesser General Public License for more
19
-- details.
20
--
21
-- You should have received a copy of the GNU Lesser General
22
-- Public License along with this source; if not, download it
23
-- from http://www.opencores.org/lgpl.shtml
24
-------------------------------------------------------------------------------
25
-------------------------------------------------------------------------------
26
-- File        : hibi_wrapper_r3.vhdl
27
-- Description : HIBI bus wrapper. 
28
--               Implementation can be chosen with generics
29
--               This is revision 3!
30
--                => r3 means that the IP interface uses 
31
--                   separate addr and data lines
32
--                   and separate data and message interfaces
33
--
34
--               NOTE! one_d_out and one_p_out do not work fully as expected,
35
--               since they're straight from the FIFO and full and empty are
36
--               formed in another blocks (addr_data_mux_write etc).
37
--               I suggest that they're removed from the interface.
38
-- Author      : Erno Salminen
39
-- e-mail      : erno.salminen@tut.fi
40
-- Design      : Do not use term design when you mean system
41
-- Date        : 28.10.2004
42
-- Modified    : 
43
--
44
-- 15.12.04     ES names changed
45
-- 28.02.2005   ES cfg_rom_en_g removed, cfg_re and cfg_we added
46
-------------------------------------------------------------------------------
47
library ieee;
48
use ieee.std_logic_1164.all;
49
use ieee.std_logic_arith.all;
50
use ieee.std_logic_unsigned.all;
51
 
52
 
53
entity hibi_wrapper_r3 is
54
 
55
    generic (
56
    -- Note: n_   = number of,
57
    --       lte  = less than or equal,
58
    --       gte  = greater than or equal 
59
 
60
    -- Structural settings.
61
    --  All widths are given in bits
62
    addr_width_g    : integer := 32; -- lte data_width 
63
    data_width_g    : integer := 32;
64
    comm_width_g    : integer := 3;  -- practically always 3
65
    counter_width_g : integer := 7;  -- gte (n_agents, max_send...) 
66
    debug_width_g  : integer := 0;   -- for special monitors
67
 
68
    --  All FIFO depths are given in words
69
    --  Allowed values 0,2,3... words.
70
    --  Prefix msg refers to hi-prior data
71
    rx_fifo_depth_g     : integer := 5;
72
    tx_fifo_depth_g     : integer := 5;
73
    rx_msg_fifo_depth_g : integer := 5;
74
    tx_msg_fifo_depth_g : integer := 5;
75
 
76
    --  Clocking and synchronization
77
    -- fifo_sel: 0 synch multiclk,         1 basic GALS,
78
    --           2 Gray FIFO (depth=2^n!), 3 mixed clock pausible
79
    fifo_sel_g : integer := 0; -- use 0 for synchronous systems
80
    --  E.g. Synch_multiclk FIFOs must know the ratio of frequencies
81
    rel_agent_freq_g : integer := 1;
82
    rel_bus_freq_g   : integer := 1;
83
 
84
 
85
    -- Functional: addressing settings
86
    addr_g        : integer := 46; -- unique for each wrapper
87
    inv_addr_en_g : integer := 0;  -- only for bridges
88
    multicast_en_g : integer := 0; -- enable special addressing
89
 
90
    -- Functional: arbitration
91
    --  arb_type 0 round-robin, 1 priority, 2 combined, 3 DAA.
92
        --  TDMA is enabled by setting n_time_slots > 0
93
    --  Ensure that all wrappers in a segment agree on arb_type,
94
    --  n_agents, and n_slots. Max_send can be wrapper-specific.
95
    n_agents_g       : integer := 4;  -- within one segment
96
    prior_g          : integer := 2;  -- lte n_agents
97
    max_send_g       : integer := 50; -- in words, 0 means unlimited
98
    n_time_slots_g   : integer := 0;  -- for TDMA
99
    arb_type_g       : integer := 0;
100
 
101
    -- Func/Stuctural: (Run-time re)configuration memory
102
    id_g          : integer := 5;  -- used instead of addr in recfg
103
    id_width_g    : integer := 4;  -- gte(log2(id_g))
104
    base_id_g     : integer := 5;  -- only for bridges
105
    cfg_re_g      : integer := 0;  -- enable reading config
106
    cfg_we_g      : integer := 0;  -- enable writing config
107
    n_extra_params_g : integer := 0; -- app-specific registers
108
    --  Having multiple pages allows fast reconfig
109
    n_cfg_pages_g : integer := 1
110
    --  Note that cfg memory initialization is done with separate
111
    --  package if you have many time slots or configuration pages
112
 
113
    );
114
 
115
  port (
116
    bus_clk        : in std_logic;
117
    agent_clk      : in std_logic;
118
    -- pulsed clocks. used in pausible clock scheme
119
    bus_sync_clk   : in std_logic;
120
    agent_sync_clk : in std_logic;
121
 
122
    rst_n       : in std_logic;
123
    bus_comm_in : in std_logic_vector (comm_width_g-1 downto 0);
124
    bus_data_in : in std_logic_vector (data_width_g-1 downto 0);
125
    bus_full_in : in std_logic;
126
    bus_Lock_in : in std_logic;
127
    bus_av_in   : in std_logic;
128
 
129
    bus_comm_out : out std_logic_vector (comm_width_g-1 downto 0);
130
    bus_data_out : out std_logic_vector (data_width_g-1 downto 0);
131
    bus_full_out : out std_logic;
132
    bus_Lock_out : out std_logic;
133
    bus_av_out   : out std_logic;
134
 
135
    agent_comm_in   : in  std_logic_vector (comm_width_g-1 downto 0);
136
    agent_data_in   : in  std_logic_vector (data_width_g-1 downto 0);
137
    agent_addr_in   : in  std_logic_vector (data_width_g-1 downto 0);
138
    agent_we_in     : in  std_logic;
139
    agent_re_in     : in  std_logic;
140
 
141
    agent_addr_out  : out std_logic_vector (data_width_g-1 downto 0);
142
    agent_data_out  : out std_logic_vector (data_width_g-1 downto 0);
143
    agent_comm_out  : out std_logic_vector (comm_width_g-1 downto 0);
144
    agent_empty_out : out std_logic;
145
    agent_full_out  : out std_logic;
146
    agent_one_p_out : out std_logic;
147
    agent_one_d_out : out std_logic;    -- is this used??
148
 
149
    agent_msg_addr_in   : in  std_logic_vector (data_width_g-1 downto 0);
150
    agent_msg_data_in   : in  std_logic_vector (data_width_g-1 downto 0);
151
    agent_msg_comm_in   : in  std_logic_vector (comm_width_g-1 downto 0);
152
    agent_msg_we_in     : in  std_logic;
153
    agent_msg_re_in     : in  std_logic;
154
 
155
    agent_msg_full_out  : out std_logic;
156
    agent_msg_one_p_out : out std_logic;
157
    agent_msg_addr_out  : out std_logic_vector (data_width_g-1 downto 0);
158
    agent_msg_data_out  : out std_logic_vector (data_width_g-1 downto 0);
159
    agent_msg_comm_out  : out std_logic_vector (comm_width_g-1 downto 0);
160
    agent_msg_empty_out : out std_logic;
161
    agent_msg_one_d_out : out std_logic  -- is this used??
162
    -- synthesis translate_off 
163
    ;
164
 
165
    debug_out : out std_logic_vector(debug_width_g-1 downto 0);
166
    debug_in : in std_logic_vector(debug_width_g-1 downto 0)
167
    -- synthesis translate_on    
168
    );
169
end hibi_wrapper_r3;
170
 
171
 
172
 
173
 
174
architecture structural_ultimate of hibi_wrapper_r3 is
175
 
176
 
177
  -- structure
178
  --                           hibi_wrapper_r3
179
  --         ##########################################################
180
  --         #                                 #             #
181
  --      in_input                             #          bus_output
182
  --         #                                 #             #
183
  -- ip      => 2x addr_data_mux_write        ==> hibiv.2    =>  bus
184
  --         =>          (mw, mmw)            ==>            #
185
  --         #                                 #             #
186
  --         #                                 #             #
187
  --     ip_output                             #         bus_input
188
  --         #                                 #             #
189
  -- ip     <= 2x addr_data_demux_read        <==  hibiv.2  <=   bus
190
  --        <=        (dr, mdr)               <==            #
191
  --         #                                 #             #
192
  --         ##########################################################
193
  --
194
  --
195
  -- signal names  =>              XXX_mw_h, XXX_mmw_h              
196
  --               <=              XXX_h_mr, XXX_h_mmr
197
  --               
198
 
199
 
200
 
201
  -- Signals between addr_data_mux_write and hibi
202
  signal av_mw_h    : std_logic;
203
  signal data_mw_h  : std_logic_vector (data_width_g-1 downto 0);
204
  signal comm_mw_h  : std_logic_vector (comm_width_g-1 downto 0);
205
  signal we_mw_h    : std_logic;
206
  signal full_h_mw  : std_logic;
207
  signal one_p_h_mw : std_logic;
208
 
209
  signal av_mmw_h    : std_logic;
210
  signal data_mmw_h  : std_logic_vector (data_width_g-1 downto 0);
211
  signal comm_mmw_h  : std_logic_vector (comm_width_g-1 downto 0);
212
  signal we_mmw_h    : std_logic;
213
  signal full_h_mmw  : std_logic;
214
  signal one_p_h_mmw : std_logic;
215
 
216
 
217
  -- Signals between fifo_mux_read and addr_data_demux_read 
218
  signal av_h_dr    : std_logic;
219
  signal data_h_dr  : std_logic_vector (data_width_g-1 downto 0);
220
  signal comm_h_dr  : std_logic_vector (comm_width_g-1 downto 0);
221
  signal re_dr_h    : std_logic;
222
  signal empty_h_dr : std_logic;
223
  signal one_d_h_dr : std_logic;
224
 
225
  signal av_h_mdr    : std_logic;
226
  signal data_h_mdr  : std_logic_vector (data_width_g-1 downto 0);
227
  signal comm_h_mdr  : std_logic_vector (comm_width_g-1 downto 0);
228
  signal re_mdr_h    : std_logic;
229
  signal empty_h_mdr : std_logic;
230
  signal one_d_h_mdr : std_logic;
231
 
232
 
233
  -- Takes addr and data in parallel and muxes them into one signal
234
  -- This way the IP's designed for Hibi v1 can used with Hibi v2
235
  component addr_data_mux_write
236
    generic (
237
      data_width_g : integer := 0;
238
      addr_width_g : integer := 0;
239
      comm_width_g : integer := 0
240
      );
241
    port (
242
      clk   : in std_logic;
243
      rst_n : in std_logic;
244
 
245
      data_in   : in  std_logic_vector (data_width_g-1 downto 0);
246
      addr_in   : in  std_logic_vector (addr_width_g-1 downto 0);
247
      comm_in   : in  std_logic_vector (comm_width_g-1 downto 0);
248
      we_in     : in  std_logic;
249
      full_out  : out std_logic;
250
      one_p_out : out std_logic;
251
 
252
      av_out   : out std_logic;
253
      data_out : out std_logic_vector (data_width_g-1 downto 0);
254
      comm_out : out std_logic_vector (comm_width_g-1 downto 0);
255
      we_out   : out std_logic;
256
      full_in  : in  std_logic;
257
      one_p_in : in  std_logic
258
      );
259
  end component;  --addr_data_mux_write;
260
 
261
  -- Takes addr and data separately and puts them into separate signals
262
  -- This way the IP's designed for Hibi v1 can used with Hibi v2
263
  component addr_data_demux_read
264
    generic (
265
      data_width_g : integer := 0;
266
      addr_width_g : integer := 0;
267
      comm_width_g : integer := 0
268
      );
269
    port (
270
      clk   : in std_logic;
271
      rst_n : in std_logic;
272
 
273
      re_out   : out std_logic;
274
      av_in    : in  std_logic;
275
      data_in  : in  std_logic_vector (data_width_g-1 downto 0);
276
      comm_in  : in  std_logic_vector (comm_width_g-1 downto 0);
277
      empty_in : in  std_logic;
278
      --one_d_in  : in  std_logic;
279
 
280
      re_in     : in  std_logic;
281
      addr_out  : out std_logic_vector (addr_width_g-1 downto 0);
282
      data_out  : out std_logic_vector (data_width_g-1 downto 0);
283
      comm_out  : out std_logic_vector (comm_width_g-1 downto 0);
284
      empty_out : out std_logic
285
      --one_d_out : out std_logic
286
      );
287
  end component;  --addr_data_demux_read;
288
 
289
 
290
 
291
begin
292
 
293
  hibi_wra : entity work.hibi_wrapper_r1
294
    generic map(
295
      id_g      => id_g,
296
      base_id_g => base_id_g,
297
 
298
      id_width_g      => id_width_g,
299
      addr_width_g    => addr_width_g,  -- in bits!
300
      data_width_g    => data_width_g,
301
      comm_width_g    => comm_width_g,
302
      counter_width_g => counter_width_g,
303
 
304
      rel_agent_freq_g => rel_agent_freq_g,
305
      rel_bus_freq_g   => rel_bus_freq_g,
306
 
307
      rx_fifo_depth_g     => rx_fifo_depth_g,
308
      rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
309
      tx_fifo_depth_g     => tx_fifo_depth_g,
310
      tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
311
 
312
      arb_type_g    => arb_type_g,
313
      fifo_sel_g    => fifo_sel_g,
314
 
315
      addr_g        => addr_g,
316
      prior_g       => prior_g,
317
      inv_addr_en_g => inv_addr_en_g,
318
 
319
      max_send_g       => max_send_g,
320
      n_agents_g       => n_agents_g,
321
      n_cfg_pages_g    => n_cfg_pages_g,
322
      n_time_slots_g   => n_time_slots_g,
323
      n_extra_params_g => n_extra_params_g,
324
      multicast_en_g   => multicast_en_g,
325
      cfg_re_g         => cfg_re_g,
326
      cfg_we_g         => cfg_we_g,
327
      debug_width_g => debug_width_g
328
 
329
      )
330
    port map(
331
      bus_clk        => bus_clk,
332
      agent_clk      => agent_clk,
333
      bus_sync_clk   => bus_sync_clk,
334
      agent_sync_clk => agent_sync_clk,
335
      rst_n          => rst_n,
336
 
337
      bus_av_in   => bus_av_in,
338
      bus_data_in => bus_data_in,
339
      bus_comm_in => bus_comm_in,
340
      bus_full_in => bus_full_in,
341
      bus_Lock_in => bus_Lock_in,
342
 
343
      agent_av_in     => av_mw_h,
344
      agent_comm_in   => comm_mw_h,
345
      agent_data_in   => data_mw_h,
346
      agent_we_in     => we_mw_h,
347
      agent_full_out  => full_h_mw,
348
      agent_one_p_out => one_p_h_mw,
349
 
350
 
351
      agent_msg_av_in     => av_mmw_h,
352
      agent_msg_data_in   => data_mmw_h,
353
      agent_msg_comm_in   => comm_mmw_h,
354
      agent_msg_we_in     => we_mmw_h,
355
      agent_msg_full_out  => full_h_mmw,
356
      agent_msg_one_p_out => one_p_h_mmw,
357
 
358
      bus_av_out   => bus_av_out,
359
      bus_comm_out => bus_comm_out,
360
      bus_data_out => bus_data_out,
361
      bus_full_out => bus_full_out,
362
      bus_Lock_out => bus_Lock_out,
363
 
364
      agent_re_in     => re_dr_h,
365
      agent_av_out    => av_h_dr,
366
      agent_data_out  => data_h_dr,
367
      agent_comm_out  => comm_h_dr,
368
      agent_empty_out => empty_h_dr,
369
      agent_one_d_out => one_d_h_dr,
370
 
371
      agent_msg_av_out    => av_h_mdr,
372
      agent_msg_re_in     => re_mdr_h,
373
      agent_msg_data_out  => data_h_mdr,
374
      agent_msg_comm_out  => comm_h_mdr,
375
      agent_msg_empty_out => empty_h_mdr,
376
      agent_msg_one_d_out => one_d_h_mdr
377
      --synthesis translate_off
378
      ,
379
      debug_in => debug_in,
380
      debug_out => debug_out
381
      --synthesis translate_on      
382
      );
383
 
384
  agent_one_d_out     <= one_d_h_dr;
385
  agent_msg_one_d_out <= one_d_h_mdr;
386
 
387
  -- Takes addr and data in parallel and muxes them into one signal
388
  -- This way the IP's designed for Hibi v1 can used with Hibi v2
389
  -- IP writes data to this block
390
  mw : addr_data_mux_write
391
    generic map(
392
      data_width_g => data_width_g,
393
      addr_width_g => addr_width_g,
394
      comm_width_g => comm_width_g
395
      )
396
    port map(
397
      clk   => agent_clk,
398
      rst_n => rst_n,
399
 
400
      addr_in   => agent_addr_in,
401
      data_in   => agent_data_in,
402
      comm_in   => agent_comm_in,
403
      we_in     => agent_we_in,
404
      full_out  => agent_full_out,
405
      one_p_out => agent_one_p_out,
406
 
407
      av_out   => av_mw_h,
408
      data_out => data_mw_h,
409
      comm_out => comm_mw_h,
410
      we_out   => we_mw_h,
411
      full_in  => full_h_mw,
412
      one_p_in => one_p_h_mw
413
      );
414
 
415
 
416
  mmw : addr_data_mux_write
417
    generic map(
418
      data_width_g => data_width_g,
419
      addr_width_g => addr_width_g,
420
      comm_width_g => comm_width_g
421
      )
422
    port map(
423
      clk   => agent_clk,
424
      rst_n => rst_n,
425
 
426
      addr_in   => agent_msg_addr_in,
427
      data_in   => agent_msg_data_in,
428
      comm_in   => agent_msg_comm_in,
429
      we_in     => agent_msg_we_in,
430
      full_out  => agent_msg_full_out,
431
      one_p_out => agent_msg_one_p_out,
432
 
433
      av_out   => av_mmw_h,
434
      data_out => data_mmw_h,
435
      comm_out => comm_mmw_h,
436
      we_out   => we_mmw_h,
437
      full_in  => full_h_mmw,
438
      one_p_in => one_p_h_mmw
439
      );
440
 
441
  -- Takes addr and data separately and puts them into separate signals
442
  -- This way the IP's designed for Hibi v1 can used with Hibi v2
443
  -- IP reads data from this block
444
  dr : addr_data_demux_read
445
    generic map(
446
      data_width_g => data_width_g,
447
      addr_width_g => addr_width_g,
448
      comm_width_g => comm_width_g
449
      )
450
    port map(
451
      clk   => agent_clk,
452
      rst_n => rst_n,
453
 
454
      re_out   => re_dr_h,
455
      av_in    => av_h_dr,
456
      data_in  => data_h_dr,
457
      comm_in  => comm_h_dr,
458
      empty_in => empty_h_dr,
459
      --      one_d_in  => one_d_h_dr,
460
 
461
      re_in     => agent_re_in,
462
      addr_out  => agent_addr_out,
463
      data_out  => agent_data_out,
464
      comm_out  => agent_comm_out,
465
      empty_out => agent_empty_out
466
      --      one_d_out => agent_one_p_out,
467
      );
468
 
469
 
470
  mdr : addr_data_demux_read
471
    generic map(
472
      data_width_g => data_width_g,
473
      addr_width_g => addr_width_g,
474
      comm_width_g => comm_width_g
475
      )
476
    port map(
477
      clk   => agent_clk,
478
      rst_n => rst_n,
479
 
480
      re_out   => re_mdr_h,
481
      av_in    => av_h_mdr,
482
      data_in  => data_h_mdr,
483
      comm_in  => comm_h_mdr,
484
      empty_in => empty_h_mdr,
485
      --      one_d_in  => one_d_h_mdr,
486
 
487
      re_in     => agent_msg_re_in,
488
      addr_out  => agent_msg_addr_out,
489
      data_out  => agent_msg_data_out,
490
      comm_out  => agent_msg_comm_out,
491
      empty_out => agent_msg_empty_out
492
      --      one_d_out => agent_msg_one_p_out,
493
      );
494
 
495
 
496
 
497
end structural_ultimate;

powered by: WebSVN 2.1.0

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