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.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 is
47
end tb_basic_test_hibiv3;
48
 
49
 
50
architecture tb of tb_basic_test_hibiv3 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_g        : integer := 16;
63
  constant data_width_g        : integer := 16;
64
  constant comm_width_g        : 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_g-1 downto 0)
103
    := (others => '0');
104
  signal data_ip_net   : std_logic_vector(n_agents_g*data_width_g-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_g-1 downto 0)
117
    := (others => '0');
118
  signal data_net_ip  : std_logic_vector(n_agents_g*data_width_g-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
begin  -- tb
130
 
131
 
132
  clk_noc <= not clk_noc after noc_cycle_time_c;
133
  clk_ip  <= not clk_ip  after ip_cycle_time_c;
134
  rst_n   <= '1'         after 20 ns;
135
 
136
 
137
  -- Tested (=demonstrated) network
138
  i_hibiv3_r4_1: entity work.hibiv3_r4
139
    generic map (
140
      id_width_g          => id_width_g,
141
      addr_width_g        => addr_width_g,
142
      data_width_g        => data_width_g,
143
      comm_width_g        => comm_width_g,
144
      counter_width_g     => counter_width_g,
145
      rel_agent_freq_g    => rel_agent_freq_g,
146
      rel_bus_freq_g      => rel_bus_freq_g,
147
      arb_type_g          => arb_type_g,
148
      fifo_sel_g          => fifo_sel_g,
149
      rx_fifo_depth_g     => rx_fifo_depth_g,
150
      rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
151
      tx_fifo_depth_g     => tx_fifo_depth_g,
152
      tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
153
      max_send_g          => max_send_g,
154
      n_cfg_pages_g       => n_cfg_pages_g,
155
      n_time_slots_g      => n_time_slots_g,
156
      keep_slot_g         => keep_slot_g,
157
      n_extra_params_g    => n_extra_params_g,
158
      cfg_re_g            => cfg_re_g,
159
      cfg_we_g            => cfg_we_g,
160
      debug_width_g       => debug_width_g,
161
      n_agents_g          => n_agents_g,
162
      n_segments_g        => n_segments_g,
163
      separate_addr_g     => separate_addr_g)
164
    port map (
165
      clk_ip          => clk_ip,
166
      clk_noc         => clk_noc,
167
      rst_n           => rst_n,
168
 
169
      agent_av_in     => av_ip_net,
170
      agent_comm_in   => comm_ip_net,
171
      agent_data_in   => data_ip_net,
172
      agent_we_in     => we_ip_net,
173
      agent_full_out  => full_net_ip,
174
      agent_one_p_out => one_p_net_ip,
175
 
176
      agent_av_out    => av_net_ip,
177
      agent_comm_out  => comm_net_ip,
178
      agent_data_out  => data_net_ip,
179
      agent_re_in     => re_ip_net,
180
      agent_empty_out => empty_net_ip,
181
      agent_one_d_out => one_d_net_ip);
182
 
183
 
184
  -- Simple sender component
185
  basic_tester_tx_1 : entity work.basic_tester_tx
186
    generic map (
187
      conf_file_g  => "tx_file.txt",
188
      comm_width_g => 5,
189
      data_width_g => data_width_g)
190
    port map (
191
      clk            => clk_ip,
192
      rst_n          => rst_n,
193
      done_out       => open,
194
      agent_av_out   => av_ip_net(0),
195
      agent_data_out => data_ip_net(data_width_g-1 downto 0),
196
      agent_comm_out => comm_ip_net(comm_width_g-1 downto 0),
197
      agent_we_out   => we_ip_net(0),
198
      agent_full_in  => full_net_ip (0),
199
      agent_one_p_in => one_p_net_ip (0));
200
 
201
 
202
  -- Simple receiver component
203
  basic_tester_rx_1 : entity work.basic_tester_rx
204
    generic map (
205
      conf_file_g  => "rx_file.txt",
206
      comm_width_g => 5,
207
      data_width_g => data_width_g)
208
    port map (
209
      clk            => clk_ip,
210
      rst_n          => rst_n,
211
      done_out       => open,
212
 
213
      agent_av_in    => av_net_ip (1),
214
      agent_data_in  => data_net_ip (2*data_width_g-1 downto 1*data_width_g),
215
      agent_comm_in  => comm_net_ip (2*comm_width_g-1 downto 1*comm_width_g),
216
      agent_re_out   => re_ip_net(1),
217
      agent_empty_in => empty_net_ip (1),
218
      agent_one_d_in => one_d_net_ip (1));
219
 
220
end tb;

powered by: WebSVN 2.1.0

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