1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Title : Testbench for design "n2h2_tx"
|
3 |
|
|
-- Project :
|
4 |
|
|
-------------------------------------------------------------------------------
|
5 |
|
|
-- File : tb_n2h2_tx.vhd
|
6 |
|
|
-- Author : kulmala3
|
7 |
|
|
-- Created : 30.03.2005
|
8 |
|
|
-- Last update: 2011-11-11
|
9 |
|
|
-- Description:
|
10 |
|
|
-------------------------------------------------------------------------------
|
11 |
|
|
-- Copyright (c) 2005
|
12 |
|
|
-------------------------------------------------------------------------------
|
13 |
|
|
-- Revisions :
|
14 |
|
|
-- Date Version Author Description
|
15 |
|
|
-- 30.03.2005 1.0 AK Created
|
16 |
|
|
-------------------------------------------------------------------------------
|
17 |
|
|
-------------------------------------------------------------------------------
|
18 |
|
|
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
|
19 |
|
|
--
|
20 |
|
|
-- This file is part of HIBI
|
21 |
|
|
--
|
22 |
|
|
-- This source file may be used and distributed without
|
23 |
|
|
-- restriction provided that this copyright statement is not
|
24 |
|
|
-- removed from the file and that any derivative work contains
|
25 |
|
|
-- the original copyright notice and the associated disclaimer.
|
26 |
|
|
--
|
27 |
|
|
-- This source file is free software; you can redistribute it
|
28 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
29 |
|
|
-- Public License as published by the Free Software Foundation;
|
30 |
|
|
-- either version 2.1 of the License, or (at your option) any
|
31 |
|
|
-- later version.
|
32 |
|
|
--
|
33 |
|
|
-- This source is distributed in the hope that it will be
|
34 |
|
|
-- useful, but WITHOUT ANY WARRANTY; without even the implied
|
35 |
|
|
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
36 |
|
|
-- PURPOSE. See the GNU Lesser General Public License for more
|
37 |
|
|
-- details.
|
38 |
|
|
--
|
39 |
|
|
-- You should have received a copy of the GNU Lesser General
|
40 |
|
|
-- Public License along with this source; if not, download it
|
41 |
|
|
-- from http://www.opencores.org/lgpl.shtml
|
42 |
|
|
-------------------------------------------------------------------------------
|
43 |
|
|
|
44 |
|
|
library ieee;
|
45 |
|
|
use ieee.std_logic_1164.all;
|
46 |
|
|
|
47 |
|
|
-------------------------------------------------------------------------------
|
48 |
|
|
|
49 |
|
|
entity tb_n2h2_tx is
|
50 |
|
|
|
51 |
|
|
end tb_n2h2_tx;
|
52 |
|
|
|
53 |
|
|
-------------------------------------------------------------------------------
|
54 |
|
|
|
55 |
|
|
architecture rtl of tb_n2h2_tx is
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
-- component generics
|
59 |
|
|
constant data_width_g : integer := 32; --0;
|
60 |
|
|
constant amount_width_g : integer := 16; --0;
|
61 |
|
|
|
62 |
|
|
-- component ports
|
63 |
|
|
signal clk : std_logic := '0';
|
64 |
|
|
signal rst_n : std_logic := '0';
|
65 |
|
|
|
66 |
|
|
signal avalon_addr_from_tx : std_logic_vector(data_width_g-1 downto 0);
|
67 |
|
|
signal avalon_re_from_tx : std_logic;
|
68 |
|
|
signal avalon_readdata_to_tx : std_logic_vector(data_width_g-1 downto 0) := (others => '0');
|
69 |
|
|
signal avalon_readdatavalid_to_tx : std_logic := '0';
|
70 |
|
|
|
71 |
|
|
signal avalon_waitrequest_to_tx : std_logic := '0';
|
72 |
|
|
signal hibi_data_from_tx : std_logic_vector(data_width_g-1 downto 0);
|
73 |
|
|
signal hibi_av_from_tx : std_logic;
|
74 |
|
|
signal hibi_full_to_tx : std_logic := '0';
|
75 |
|
|
signal hibi_comm_from_tx : std_logic_vector(4 downto 0);
|
76 |
|
|
signal hibi_we_from_tx : std_logic;
|
77 |
|
|
signal tx_start_to_tx : std_logic := '0';
|
78 |
|
|
signal tx_status_done_from_tx : std_logic;
|
79 |
|
|
|
80 |
|
|
signal tx_comm_to_tx : std_logic_vector(4 downto 0) := (others => '0');
|
81 |
|
|
|
82 |
|
|
signal tx_hibi_addr_to_tx : std_logic_vector(data_width_g-1 downto 0) := (others => '0');
|
83 |
|
|
signal tx_ram_addr_to_tx : std_logic_vector(data_width_g-1 downto 0) := (others => '0');
|
84 |
|
|
signal tx_amount_to_tx : std_logic_vector(amount_width_g-1 downto 0) := (others => '0');
|
85 |
|
|
|
86 |
|
|
-- clock and reset
|
87 |
|
|
signal Clk2 : std_logic;
|
88 |
|
|
constant Period : time := 10 ns;
|
89 |
|
|
|
90 |
|
|
begin -- rtl
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
-- component instantiation
|
96 |
|
|
DUT : entity work.n2h2_tx
|
97 |
|
|
generic map (
|
98 |
|
|
data_width_g => data_width_g,
|
99 |
|
|
amount_width_g => amount_width_g)
|
100 |
|
|
port map (
|
101 |
|
|
clk => clk,
|
102 |
|
|
rst_n => rst_n,
|
103 |
|
|
avalon_addr_out => avalon_addr_from_tx,
|
104 |
|
|
avalon_re_out => avalon_re_from_tx,
|
105 |
|
|
avalon_readdata_in => avalon_readdata_to_tx,
|
106 |
|
|
avalon_waitrequest_in => avalon_waitrequest_to_tx,
|
107 |
|
|
avalon_readdatavalid_in => avalon_readdatavalid_to_tx,
|
108 |
|
|
hibi_data_out => hibi_data_from_tx,
|
109 |
|
|
hibi_av_out => hibi_av_from_tx,
|
110 |
|
|
hibi_full_in => hibi_full_to_tx,
|
111 |
|
|
hibi_comm_out => hibi_comm_from_tx,
|
112 |
|
|
hibi_we_out => hibi_we_from_tx,
|
113 |
|
|
tx_start_in => tx_start_to_tx,
|
114 |
|
|
tx_status_done_out => tx_status_done_from_tx,
|
115 |
|
|
tx_comm_in => tx_comm_to_tx,
|
116 |
|
|
tx_hibi_addr_in => tx_hibi_addr_to_tx,
|
117 |
|
|
tx_ram_addr_in => tx_ram_addr_to_tx,
|
118 |
|
|
tx_amount_in => tx_amount_to_tx);
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
CLOCK1 : process -- generate clock signal for design
|
122 |
|
|
variable clktmp : std_logic := '0';
|
123 |
|
|
begin
|
124 |
|
|
wait for PERIOD/2;
|
125 |
|
|
clktmp := not clktmp;
|
126 |
|
|
Clk <= clktmp;
|
127 |
|
|
end process CLOCK1;
|
128 |
|
|
|
129 |
|
|
CLOCK2 : process -- generate clock signal for design
|
130 |
|
|
variable clktmp : std_logic := '0';
|
131 |
|
|
begin
|
132 |
|
|
clktmp := not clktmp;
|
133 |
|
|
Clk2 <= clktmp;
|
134 |
|
|
wait for PERIOD/2;
|
135 |
|
|
end process CLOCK2;
|
136 |
|
|
|
137 |
|
|
RESET : process
|
138 |
|
|
begin
|
139 |
|
|
Rst_n <= '0'; -- Reset the testsystem
|
140 |
|
|
wait for 6*PERIOD; -- Wait
|
141 |
|
|
Rst_n <= '1'; -- de-assert reset
|
142 |
|
|
wait;
|
143 |
|
|
end process RESET;
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
end rtl;
|
149 |
|
|
|
150 |
|
|
-------------------------------------------------------------------------------
|