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/] [tb/] [basic_test/] [tb_basic_test_hibiv3_wra.vhd] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
-------------------------------------------------------------------------------
2
-- Title      : Basic tester for Hibi v3
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : basic_test_hibiv3.vhd
6
-- Author     : Lasse Lehtonen
7
-- Company    : 
8
-- Created    : 2011-09-29
9
-- Last update: 2012-03-08
10
-- Platform   : 
11
-------------------------------------------------------------------------------
12
-- Description: Shows how HIBI can be used.
13
--              Instantiates two, very simple, basic test components and
14
--              connects them to HIBI. The first one sends few words (e.g. 8)
15
--              and the other receives and checks them.
16
--              The traffic is defined with two ASCII files: tx_file.txt and
17
--              rx_file.txt
18
-------------------------------------------------------------------------------
19
-- Copyright (c) 2011 
20
--
21
--  This file is part of Funbase IP library.
22
--
23
--  Funbase IP library is free software: you can redistribute it and/or modify
24
--  it under the terms of the Lesser GNU General Public License as published by
25
--  the Free Software Foundation, either version 3 of the License, or
26
--  (at your option) any later version.
27
--
28
--  Funbase IP library is distributed in the hope that it will be useful,
29
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
30
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31
--  Lesser GNU General Public License for more details.
32
--
33
--  You should have received a copy of the Lesser GNU General Public License
34
--  along with Funbase IP library.  If not, see <http://www.gnu.org/licenses/>.
35
-------------------------------------------------------------------------------
36
-- Revisions  :
37
-- Date        Version  Author  Description
38
-- 2011-09-29  1.0      lehton87        Created
39
-------------------------------------------------------------------------------
40
 
41
 
42
library ieee;
43
use ieee.std_logic_1164.all;
44
use ieee.numeric_std.all;
45
 
46
entity tb_basic_test_hibiv3_wra is
47
end tb_basic_test_hibiv3_wra;
48
 
49
 
50
architecture tb of tb_basic_test_hibiv3_wra is
51
 
52
  -----------------------------------------------------------------------------
53
  -- CONSTANTS
54
  -----------------------------------------------------------------------------
55
  -- System size
56
  constant n_agents_g   : integer := 2;
57
  constant n_segments_g : integer := 1;
58
 
59
  -- Values for HIBI generics
60
  -- a) signal and counter sizes
61
  constant id_width_g      : integer := 4;
62
  constant addr_width_c    : integer := 16;
63
  constant data_width_c    : integer := 16;
64
  constant comm_width_c    : integer := 5;
65
  constant counter_width_g : integer := 8;
66
  constant separate_addr_g : integer := 0;
67
 
68
  -- b) clocking and buffering
69
  constant rel_agent_freq_g    : integer := 1;
70
  constant rel_bus_freq_g      : integer := 1;
71
  constant fifo_sel_g          : integer := 0;
72
  constant rx_fifo_depth_g     : integer := 4;
73
  constant rx_msg_fifo_depth_g : integer := 4;
74
  constant tx_fifo_depth_g     : integer := 4;
75
  constant tx_msg_fifo_depth_g : integer := 4;
76
 
77
  -- c) arbitration
78
  constant arb_type_g       : integer := 3;
79
  constant max_send_g       : integer := 20;
80
  constant n_cfg_pages_g    : integer := 1;
81
  constant n_time_slots_g   : integer := 0;
82
  constant keep_slot_g      : integer := 0;
83
  constant n_extra_params_g : integer := 1;
84
  constant cfg_re_g         : integer := 1;
85
  constant cfg_we_g         : integer := 1;
86
  constant debug_width_g    : integer := 0;
87
 
88
 
89
 
90
  -- clock generation
91
  constant noc_cycle_time_c : time := 4 ns;
92
  constant ip_cycle_time_c  : time := 4 ns;
93
 
94
  -----------------------------------------------------------------------------
95
  -- SIGNALS
96
  -----------------------------------------------------------------------------
97
  signal clk_noc : std_logic := '1';
98
  signal clk_ip  : std_logic := '1';
99
  signal rst_n   : std_logic := '0';
100
 
101
  -- Sending, data goes IP -> net
102
  signal comm_ip_net : std_logic_vector(n_agents_g*comm_width_c-1 downto 0)
103
 := (others => '0');
104
  signal data_ip_net : std_logic_vector(n_agents_g*data_width_c-1 downto 0)
105
 := (others => '0');
106
  signal av_ip_net : std_logic_vector(n_agents_g-1 downto 0)
107
 := (others => '0');
108
  signal we_ip_net : std_logic_vector(n_agents_g-1 downto 0)
109
 := (others => '0');
110
  signal full_net_ip : std_logic_vector(n_agents_g-1 downto 0)
111
 := (others => '0');
112
  signal one_p_net_ip : std_logic_vector(n_agents_g-1 downto 0)
113
 := (others => '0');
114
 
115
  -- Receiving, data goes net -> IP
116
  signal comm_net_ip : std_logic_vector(n_agents_g*comm_width_c-1 downto 0)
117
 := (others => '0');
118
  signal data_net_ip : std_logic_vector(n_agents_g*data_width_c-1 downto 0)
119
 := (others => '0');
120
  signal av_net_ip : std_logic_vector(n_agents_g-1 downto 0)
121
 := (others => '0');
122
  signal re_ip_net : std_logic_vector(n_agents_g-1 downto 0)
123
 := (others => '0');
124
  signal empty_net_ip : std_logic_vector(n_agents_g-1 downto 0)
125
 := (others => '0');
126
  signal one_d_net_ip : std_logic_vector(n_agents_g-1 downto 0)
127
 := (others => '0');
128
 
129
 
130
  -- Sending from wrapper to or network
131
  signal av_wra_bus : std_logic_vector(n_agents_g-1 downto 0)
132
 := (others => '0');
133
  signal data_wra_bus : std_logic_vector(n_agents_g*data_width_c-1 downto 0)
134
 := (others => '0');
135
  signal comm_wra_bus : std_logic_vector(n_agents_g*comm_width_c-1 downto 0)
136
 := (others => '0');
137
  signal full_wra_bus : std_logic_vector(n_agents_g-1 downto 0)
138
 := (others => '0');
139
  signal lock_wra_bus : std_logic_vector(n_agents_g-1 downto 0)
140
 := (others => '0');
141
 
142
  signal av_bus_wra   : std_logic;
143
  signal data_bus_wra : std_logic_vector(data_width_c-1 downto 0);
144
  signal comm_bus_wra : std_logic_vector(comm_width_c-1 downto 0);
145
  signal full_bus_wra : std_logic;
146
  signal lock_bus_wra : std_logic;
147
 
148
 
149
  type addr_arr is array (0 to n_agents_g-1) of integer;
150
  constant addr_c : addr_arr := (16#00000010#, 16#00000030#);
151
 
152
begin  -- tb
153
 
154
 
155
  clk_noc <= not clk_noc after noc_cycle_time_c;
156
  clk_ip  <= not clk_ip  after ip_cycle_time_c;
157
  rst_n   <= '1'         after 20 ns;
158
 
159
 
160
  gen_wra: for i in 0 to n_agents_g-1 generate
161
 
162
  -- Tested (=demonstrated) network includes 2 wrappers and an OR-network
163
  i_hibiv3_r4_1 : entity work.hibi_wrapper_r4
164
    generic map (
165
      id_width_g      => id_width_g,
166
      addr_width_g    => addr_width_c,
167
      data_width_g    => data_width_c,
168
      comm_width_g    => comm_width_c,
169
      counter_width_g => counter_width_g,
170
      addr_g          => addr_c(i),
171
      addr_limit_g    => addr_c(i)+32,
172
 
173
 
174
      rel_agent_freq_g => rel_agent_freq_g,
175
      rel_bus_freq_g   => rel_bus_freq_g,
176
 
177
      arb_type_g          => arb_type_g,
178
      fifo_sel_g          => fifo_sel_g,
179
      rx_fifo_depth_g     => rx_fifo_depth_g,
180
      rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
181
      tx_fifo_depth_g     => tx_fifo_depth_g,
182
      tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
183
      max_send_g          => max_send_g,
184
      n_cfg_pages_g       => n_cfg_pages_g,
185
      n_time_slots_g      => n_time_slots_g,
186
      keep_slot_g         => keep_slot_g,
187
 
188
      n_extra_params_g => n_extra_params_g,
189
      cfg_re_g         => cfg_re_g,
190
      cfg_we_g         => cfg_we_g,
191
      debug_width_g    => debug_width_g,
192
      n_agents_g       => n_agents_g,
193
      separate_addr_g  => separate_addr_g)
194
    port map (
195
      agent_clk      => clk_ip,
196
      bus_clk        => clk_noc,
197
      agent_sync_clk => clk_ip,
198
      bus_sync_clk   => clk_noc,
199
 
200
      rst_n => rst_n,
201
 
202
      agent_av_in     => av_ip_net(i),
203
      agent_data_in   => data_ip_net((i+1)*data_width_c-1 downto i*data_width_c),
204
      agent_comm_in   => comm_ip_net((i+1)*comm_width_c-1 downto i*comm_width_c),
205
      agent_we_in     => we_ip_net(i),
206
      agent_full_out  => full_net_ip(i),
207
      agent_one_p_out => one_p_net_ip(i),
208
 
209
      agent_av_out    => av_net_ip(i),
210
      agent_data_out  => data_net_ip((i+1)*data_width_c-1 downto i*data_width_c),
211
      agent_comm_out  => comm_net_ip((i+1)*comm_width_c-1 downto i*comm_width_c),
212
      agent_re_in     => re_ip_net(i),
213
      agent_empty_out => empty_net_ip(i),
214
      agent_one_d_out => one_d_net_ip(i),
215
 
216
 
217
      bus_av_in   => av_bus_wra,
218
      bus_data_in => data_bus_wra,
219
      bus_comm_in => comm_bus_wra,
220
      bus_full_in => full_bus_wra,
221
      bus_lock_in => lock_bus_wra,
222
 
223
      bus_av_out   => av_wra_bus (i),
224
      bus_data_out => data_wra_bus ((i+1)*data_width_c-1 downto i*data_width_c),
225
      bus_comm_out => comm_wra_bus ((i+1)*comm_width_c-1 downto i*comm_width_c),
226
      bus_full_out => full_wra_bus (i),
227
      bus_lock_out => lock_wra_bus (i),
228
 
229
      debug_in => (others => '0')
230
      );
231
 
232
  end generate gen_wra;
233
 
234
 
235
  hibi_orbus_small_1: entity work.hibi_orbus_small
236
    generic map (
237
      data_width_g => data_width_c,
238
      addr_width_g => addr_width_c,
239
      comm_width_g => comm_width_c)
240
    port map (
241
      bus_av_out    => av_bus_wra,
242
      bus_data_out  => data_bus_wra,
243
      bus_comm_out  => comm_bus_wra,
244
      bus_lock_out  => lock_bus_wra,
245
      bus_full_out  => full_bus_wra,
246
 
247
      bus_av_0_in   => av_wra_bus (0),
248
      bus_data_0_in => data_wra_bus((0+1)*data_width_c-1 downto 0*data_width_c),
249
      bus_comm_0_in => comm_wra_bus((0+1)*comm_width_c-1 downto 0*comm_width_c),
250
      bus_lock_0_in => lock_wra_bus (0),
251
      bus_full_0_in => full_wra_bus (0),
252
 
253
      bus_av_1_in   => av_wra_bus (1),
254
      bus_data_1_in => data_wra_bus((1+1)*data_width_c-1 downto 1*data_width_c),
255
      bus_comm_1_in => comm_wra_bus((1+1)*comm_width_c-1 downto 1*comm_width_c),
256
      bus_lock_1_in => lock_wra_bus (1),
257
      bus_full_1_in => full_wra_bus (1),
258
 
259
      bus_av_2_in   => '0',
260
      bus_data_2_in => (others => '0'),
261
      bus_comm_2_in => (others => '0'),
262
      bus_lock_2_in => '0',
263
      bus_full_2_in => '0',
264
 
265
      bus_av_3_in   => '0',
266
      bus_data_3_in => (others => '0'),
267
      bus_comm_3_in => (others => '0'),
268
      bus_lock_3_in => '0',
269
      bus_full_3_in => '0'
270
      );
271
 
272
 
273
  -- Simple sender component
274
  basic_tester_tx_1 : entity work.basic_tester_tx
275
    generic map (
276
      conf_file_g  => "tx_file.txt",
277
      comm_width_g => comm_width_c,
278
      data_width_g => data_width_c)
279
    port map (
280
      clk            => clk_ip,
281
      rst_n          => rst_n,
282
      done_out       => open,
283
      agent_av_out   => av_ip_net(0),
284
      agent_data_out => data_ip_net(data_width_c-1 downto 0),
285
      agent_comm_out => comm_ip_net(comm_width_c-1 downto 0),
286
      agent_we_out   => we_ip_net(0),
287
      agent_full_in  => full_net_ip (0),
288
      agent_one_p_in => one_p_net_ip (0));
289
 
290
 
291
  -- Simple receiver component
292
  basic_tester_rx_1 : entity work.basic_tester_rx
293
    generic map (
294
      conf_file_g  => "rx_file.txt",
295
      comm_width_g => comm_width_c,
296
      data_width_g => data_width_c)
297
    port map (
298
      clk      => clk_ip,
299
      rst_n    => rst_n,
300
      done_out => open,
301
 
302
      agent_av_in    => av_net_ip (1),
303
      agent_data_in  => data_net_ip (2*data_width_c-1 downto 1*data_width_c),
304
      agent_comm_in  => comm_net_ip (2*comm_width_c-1 downto 1*comm_width_c),
305
      agent_re_out   => re_ip_net(1),
306
      agent_empty_in => empty_net_ip (1),
307
      agent_one_d_in => one_d_net_ip (1));
308
 
309
end tb;

powered by: WebSVN 2.1.0

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