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.accelerator/] [dct_to_hibi/] [1.0/] [tb/] [tb_dct_top_2.vhd] - Blame information for rev 168

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 168 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: 2013-03-22
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
use work.tb_dct_package.all;
47
 
48
library dct;
49
library idct;
50
library quantizer;
51
library dctQidct;
52
 
53
use dct.DCT_pkg.all;
54
use idct.IDCT_pkg.all;
55
use quantizer.Quantizer_pkg.all;
56
 
57
entity tb_dct_top_2 is
58
end tb_dct_top_2;
59
 
60
 
61
architecture tb of tb_dct_top_2 is
62
 
63
  -----------------------------------------------------------------------------
64
  -- CONSTANTS
65
  -----------------------------------------------------------------------------
66
  -- System size
67
  constant n_agents_g   : integer := 2;
68
  constant n_segments_g : integer := 1;
69
 
70
  -- Values for HIBI generics
71
  -- a) signal and counter sizes
72
  constant id_width_g      : integer := 4;
73
  constant addr_width_g    : integer := 32;
74
  constant data_width_g    : integer := 32;
75
  constant comm_width_g    : integer := 5;
76
  constant counter_width_g : integer := 8;
77
  constant separate_addr_g : integer := 0;
78
 
79
  -- b) clocking and buffering
80
  constant rel_agent_freq_g    : integer := 1;
81
  constant rel_bus_freq_g      : integer := 1;
82
  constant fifo_sel_g          : integer := 0;
83
  constant rx_fifo_depth_g     : integer := 4;
84
  constant rx_msg_fifo_depth_g : integer := 4;
85
  constant tx_fifo_depth_g     : integer := 4;
86
  constant tx_msg_fifo_depth_g : integer := 4;
87
 
88
  -- c) arbitration
89
  constant arb_type_g       : integer := 3;
90
  constant max_send_g       : integer := 20;
91
  constant n_cfg_pages_g    : integer := 1;
92
  constant n_time_slots_g   : integer := 0;
93
  constant keep_slot_g      : integer := 0;
94
  constant n_extra_params_g : integer := 1;
95
  constant cfg_re_g         : integer := 1;
96
  constant cfg_we_g         : integer := 1;
97
  constant debug_width_g    : integer := 0;
98
 
99
 
100
 
101
  -- clock generation
102
  constant noc_cycle_time_c : time := 10 ns;
103
  constant ip_cycle_time_c  : time := 10 ns;
104
 
105
  -----------------------------------------------------------------------------
106
  -- SIGNALSxs
107
  -----------------------------------------------------------------------------
108
  signal clk_noc : std_logic := '1';
109
  signal clk_ip  : std_logic := '1';
110
  signal rst_n   : std_logic := '0';
111
 
112
  -- Sending, data goes IP -> net
113
  signal comm_ip_net : std_logic_vector(n_agents_g*comm_width_g-1 downto 0)
114
 := (others => '0');
115
  signal data_ip_net : std_logic_vector(n_agents_g*data_width_g-1 downto 0)
116
 := (others => '0');
117
  signal av_ip_net : std_logic_vector(n_agents_g-1 downto 0)
118
 := (others => '0');
119
  signal we_ip_net : std_logic_vector(n_agents_g-1 downto 0)
120
 := (others => '0');
121
  signal full_net_ip : std_logic_vector(n_agents_g-1 downto 0)
122
 := (others => '0');
123
  signal one_p_net_ip : std_logic_vector(n_agents_g-1 downto 0)
124
 := (others => '0');
125
 
126
  -- Receiving, data goes net -> IP
127
  signal comm_net_ip : std_logic_vector(n_agents_g*comm_width_g-1 downto 0)
128
 := (others => '0');
129
  signal data_net_ip : std_logic_vector(n_agents_g*data_width_g-1 downto 0)
130
 := (others => '0');
131
  signal av_net_ip : std_logic_vector(n_agents_g-1 downto 0)
132
 := (others => '0');
133
  signal re_ip_net : std_logic_vector(n_agents_g-1 downto 0)
134
 := (others => '0');
135
  signal empty_net_ip : std_logic_vector(n_agents_g-1 downto 0)
136
 := (others => '0');
137
  signal one_d_net_ip : std_logic_vector(n_agents_g-1 downto 0)
138
 := (others => '0');
139
 
140
   signal QP                 : std_logic_vector (4 downto 0);
141
  signal chroma             : std_logic;
142
  signal data_dct           : std_logic_vector (DCT_inputw_co-1 downto 0);
143
  signal idct_ready4column  : std_logic;
144
  signal intra              : std_logic;
145
  signal loadQP             : std_logic;
146
  signal quant_ready4column : std_logic;
147
  signal wr_dct             : std_logic;
148
  signal data_idct          : std_logic_vector (IDCT_resultw_co-1 downto 0);
149
  signal data_quant         : std_logic_vector (QUANT_resultw_co-1 downto 0);
150
  signal dct_ready4column   : std_logic;
151
  signal wr_idct            : std_logic;
152
  signal wr_quant           : std_logic;
153
 
154
 
155
  --COMPONENT DECLARATIONS--
156
 
157
  component tb_dct_cpu
158
    generic (
159
      data_width_g : integer;
160
      comm_width_g : integer);
161
    port (
162
      clk_dctqidct_fast : in  std_logic;
163
      clk               : in  std_logic;
164
      rst_n             : in  std_logic;
165
      data_in           : in  std_logic_vector(data_width_g-1 downto 0);
166
      comm_in           : in  std_logic_vector(comm_width_g-1 downto 0);
167
      av_in             : in  std_logic;
168
      re_out            : out std_logic;
169
      empty_in          : in  std_logic;
170
      data_out          : out std_logic_vector(data_width_g-1 downto 0);
171
      comm_out          : out std_logic_vector(comm_width_g-1 downto 0);
172
      av_out            : out std_logic;
173
      we_out            : out std_logic;
174
      full_in           : in  std_logic;
175
      dct_data_idct_in  : in  std_logic_vector(IDCT_resultw_co-1 downto 0);
176
      dct_data_quant_in : in  std_logic_vector(QUANT_resultw_co-1 downto 0);
177
      dct_wr_idct_in    : in  std_logic;
178
      dct_wr_quant_in   : in  std_logic;
179
      dct_wr_dct_in     : in  std_logic;
180
      dct_data_dct_in   : in  std_logic_vector(DCT_inputw_co-1 downto 0);
181
      dct_qp_in         : in  std_logic_vector(4 downto 0);
182
      dct_intra_in      : in  std_logic;
183
      dct_chroma_in     : in  std_logic;
184
      dct_loadqp_in     : in  std_logic
185
 
186
      );
187
  end component;
188
 
189
 component dctQidct_core
190
    port (
191
      QP_in                 : in  std_logic_vector (4 downto 0);
192
      chroma_in             : in  std_logic;
193
      clk                   : in  std_logic;
194
      data_dct_in           : in  std_logic_vector (DCT_inputw_co-1 downto 0);
195
      idct_ready4column_in  : in  std_logic;
196
      intra_in              : in  std_logic;
197
      loadQP_in             : in  std_logic;
198
      quant_ready4column_in : in  std_logic;
199
      rst_n                 : in  std_logic;
200
      wr_dct_in             : in  std_logic;
201
      data_idct_out         : out std_logic_vector (IDCT_resultw_co-1 downto 0);
202
      data_quant_out        : out std_logic_vector (QUANT_resultw_co-1 downto 0);
203
      dct_ready4column_out  : out std_logic;
204
      wr_idct_out           : out std_logic;
205
      wr_quant_out          : out std_logic);
206
  end component;
207
 
208
 
209
 
210
 
211
 
212
 
213
 
214
 
215
    begin  -- tb
216
 
217
 
218
      clk_noc <= not clk_noc after noc_cycle_time_c;
219
      clk_ip  <= not clk_ip  after ip_cycle_time_c;
220
      rst_n   <= '1'         after 100 ns;
221
 
222
 
223
      -- HIBI network
224
      i_hibiv3_r4_1 : entity work.hibiv3_r4
225
        generic map (
226
          id_width_g          => id_width_g,
227
          addr_width_g        => addr_width_g,
228
          data_width_g        => data_width_g,
229
          comm_width_g        => comm_width_g,
230
          counter_width_g     => counter_width_g,
231
          rel_agent_freq_g    => rel_agent_freq_g,
232
          rel_bus_freq_g      => rel_bus_freq_g,
233
          arb_type_g          => arb_type_g,
234
          fifo_sel_g          => fifo_sel_g,
235
          rx_fifo_depth_g     => rx_fifo_depth_g,
236
          rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
237
          tx_fifo_depth_g     => tx_fifo_depth_g,
238
          tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
239
          max_send_g          => max_send_g,
240
          n_cfg_pages_g       => n_cfg_pages_g,
241
          n_time_slots_g      => n_time_slots_g,
242
          keep_slot_g         => keep_slot_g,
243
          n_extra_params_g    => n_extra_params_g,
244
          cfg_re_g            => cfg_re_g,
245
          cfg_we_g            => cfg_we_g,
246
          debug_width_g       => debug_width_g,
247
          n_agents_g          => n_agents_g,
248
          n_segments_g        => n_segments_g,
249
          separate_addr_g     => separate_addr_g)
250
        port map (
251
          clk_ip  => clk_ip,
252
          clk_noc => clk_noc,
253
          rst_n   => rst_n,
254
 
255
          agent_av_in     => av_ip_net,
256
          agent_comm_in   => comm_ip_net,
257
          agent_data_in   => data_ip_net,
258
          agent_we_in     => we_ip_net,
259
          agent_full_out  => full_net_ip,
260
          agent_one_p_out => one_p_net_ip,
261
 
262
          agent_av_out    => av_net_ip,
263
          agent_comm_out  => comm_net_ip,
264
          agent_data_out  => data_net_ip,
265
          agent_re_in     => re_ip_net,
266
          agent_empty_out => empty_net_ip,
267
          agent_one_d_out => one_d_net_ip);
268
 
269
 
270
      dct_to_hibi_1_12 : entity work.dct_to_hibi
271
        generic map (
272
          data_width_g   => data_width_g,
273
          comm_width_g   => comm_width_g,
274
          use_self_rel_g => use_self_rel_c,
275
          own_address_g  => hibi_addr_dct_c,
276
          rtm_address_g  => hibi_addr_cpu_rtm_c,
277
          dct_width_g    => DCT_inputw_co,
278
          quant_width_g  => QUANT_resultw_co,
279
          idct_width_g   => IDCT_resultw_co)
280
        port map (
281
          clk                 => clk_ip,
282
          rst_n               => rst_n,
283
          hibi_av_out         => av_ip_net(0),
284
          hibi_data_out       => data_ip_net(data_width_g-1 downto 0),
285
          hibi_comm_out       => comm_ip_net(comm_width_g-1 downto 0),
286
          hibi_we_out         => we_ip_net(0),
287
          hibi_re_out         => re_ip_net(0),
288
          hibi_av_in          => av_net_ip(0),
289
          hibi_data_in        => data_net_ip(data_width_g-1 downto 0),
290
          hibi_comm_in        => comm_net_ip(comm_width_g-1 downto 0),
291
          hibi_empty_in       => empty_net_ip(0),
292
          hibi_full_in        => full_net_ip(0),
293
          wr_dct_out          => wr_dct,
294
          quant_ready4col_out => quant_ready4column,
295
          idct_ready4col_out  => idct_ready4column,
296
          data_dct_out        => data_dct,
297
          intra_out           => intra,
298
          loadQP_out          => loadQP,
299
          QP_out              => QP,
300
          chroma_out          => chroma,
301
          data_idct_in        => data_idct,
302
          data_quant_in       => data_quant,
303
          dct_ready4col_in    => dct_ready4column,
304
          wr_idct_in          => wr_idct,
305
          wr_quant_in         => wr_quant);
306
 
307
      -- dctQidct_core
308
      dctQidct_core_1 : dctQidct_core
309
        port map (
310
          QP_in                 => QP,
311
          chroma_in             => chroma,
312
          clk                   => clk_ip,
313
          data_dct_in           => data_dct,
314
          idct_ready4column_in  => idct_ready4column,
315
          intra_in              => intra,
316
          loadQP_in             => loadQP,
317
          quant_ready4column_in => quant_ready4column,
318
          rst_n                 => rst_n,
319
          wr_dct_in             => wr_dct,
320
          data_idct_out         => data_idct,
321
          data_quant_out        => data_quant,
322
          dct_ready4column_out  => dct_ready4column,
323
          wr_idct_out           => wr_idct,
324
          wr_quant_out          => wr_quant);
325
 
326
      -- cpu emulator
327
      tb_dct_cpu_i : tb_dct_cpu
328
        generic map (
329
          data_width_g => data_width_g,
330
          comm_width_g => comm_width_g)
331
        port map (
332
          clk               => clk_ip,
333
          clk_dctqidct_fast => clk_ip,
334
          rst_n             => rst_n,
335
          data_in           => data_net_ip(2*data_width_g-1 downto data_width_g),
336
          comm_in           => comm_net_ip(2*comm_width_g-1 downto comm_width_g),
337
          av_in             => av_net_ip(1),
338
          re_out            => re_ip_net(1),
339
          empty_in          => empty_net_ip(1),
340
          data_out          => data_ip_net(2*data_width_g-1 downto data_width_g),
341
          comm_out          => comm_ip_net(2*comm_width_g-1 downto comm_width_g),
342
          av_out            => av_ip_net(1),
343
          we_out            => we_ip_net(1),
344
          full_in           => full_net_ip(1),
345
          dct_data_idct_in  => data_idct,
346
          dct_data_quant_in => data_quant,
347
          dct_wr_idct_in    => wr_idct,
348
          dct_wr_quant_in   => wr_quant,
349
          dct_wr_dct_in     => wr_dct,
350
          dct_data_dct_in   => data_dct,
351
          dct_qp_in         => QP,
352
          dct_intra_in      => intra,
353
          dct_chroma_in     => chroma,
354
          dct_loadqp_in     => loadQP
355
          );
356
 
357
 
358
 
359
 
360
    end tb;

powered by: WebSVN 2.1.0

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