OpenCores
URL https://opencores.org/ocsvn/miniuart2/miniuart2/trunk

Subversion Repositories miniuart2

[/] [miniuart2/] [trunk/] [sim/] [ModelSim/] [test_bench2/] [test.vhd] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 philippe
-------------------------------------------------------------------------------
2
-- Title   : UART Testbench
3
-- Project : UART 
4
-------------------------------------------------------------------------------
5
-- File        : test.vhd
6
-- Author      : Philippe CARTON 
7
--               (philippe.carton2@libertysurf.fr)
8
-- Organization:
9
-- Created     : 8/1/2003
10
-- Last update : 9/1/2003
11
-- Platform    : Windows
12
-- Simulators  : ModelSim 5.5b
13
-- Dependency  : IEEE std_logic_1164, simu_lib
14
-------------------------------------------------------------------------------
15
-- Description :
16
-- test entity UART
17
-------------------------------------------------------------------------------
18
-- Copyright (c) notice
19
--    This core adheres to the GNU public license 
20
--
21
-------------------------------------------------------------------------------
22
 
23
library IEEE;
24
use IEEE.std_logic_1164.all;
25
 
26
library simu_lib;
27
use simu_lib.HORLOGE;
28
use simu_lib.GEN_WAVE_BUS;
29
 
30
library work;
31
use work.all;
32
 
33
-------------------------------------------------------------------------------
34
entity TEST_MINIUART is
35
 generic( CHEMIN : string := "test_bench2/");
36
end TEST_MINIUART;
37
-------------------------------------------------------------------------------
38
-- behavioural architecture type
39
-------------------------------------------------------------------------------
40
architecture ARCH_TEST_BENCH OF TEST_MINIUART is
41
 
42
-------------------------------------------------------------------------------
43
-- internal signals connection declaration
44
-------------------------------------------------------------------------------
45
signal ZERO  : std_logic;
46
signal UN    : std_logic;
47
 
48
signal PATT  : std_logic_vector(13 downto 0);
49
signal VISU  : std_logic_vector(11 downto 0);
50
 
51
signal CLK  : std_logic; -- system clock
52
signal BRCLK : std_logic; -- Baudrate clock
53
 
54
-------------------------------------------------------------------------------
55
component HORLOGE
56
 generic ( NOM_FICHIER_HORLOGE : string := "HORLOGE.IN" );
57
 port    ( CLOCK : out std_logic );
58
end component;
59
 
60
-------------------------------------------------------------------------------
61
component GEN_WAVE_BUS
62
 generic ( nb_bits : integer := 4;   -- bus width
63
           NOM_FICHIER_WAVE : string := "GEN_WAVE.IN" );
64
 port ( SIGNAL_OUT : out std_logic_vector((nb_bits-1) downto 0) );
65
end component;
66
 
67
-------------------------------------------------------------------------------
68
component UART
69
 generic(BRDIVISOR: INTEGER range 0 to 65535 := 130); -- Baud rate divisor
70
 port(
71
-- Wishbone signals
72
     WB_CLK_I : in  std_logic;  -- clock
73
     WB_RST_I : in  std_logic;  -- Reset input
74
     WB_ADR_I : in  std_logic_vector(1 downto 0); -- Adress bus          
75
     WB_DAT_I : in  std_logic_vector(7 downto 0); -- DataIn Bus
76
     WB_DAT_O : out std_logic_vector(7 downto 0); -- DataOut Bus
77
     WB_WE_I  : in  std_logic;  -- Write Enable
78
     WB_STB_I : in  std_logic;  -- Strobe
79
     WB_ACK_O : out std_logic;   -- Acknowledge
80
-- process signals     
81
     IntTx_O  : out std_logic;  -- Transmit interrupt: indicate waiting for Byte
82
     IntRx_O  : out std_logic;  -- Receive interrupt: indicate Byte received
83
     BR_Clk_I : in  std_logic;  -- Clock used for Transmit/Receive
84
     TxD_PAD_O: out std_logic;  -- Tx RS232 Line
85
     RxD_PAD_I: in  std_logic   -- Rx RS232 Line 
86
     );
87
end component;
88
 
89
-------------------------------------------------------------------------------
90
-- begin body entity 
91
-------------------------------------------------------------------------------
92
begin
93
 UN <= '1';
94
 ZERO <= '0';
95
 
96
-------------------------------------------------------------------------------
97
GERE_BUS : GEN_WAVE_BUS
98
 generic map ( nb_bits  => PATT'length,
99
                NOM_FICHIER_WAVE => CHEMIN & "patt.in")
100
 port map    ( SIGNAL_OUT => PATT );
101
-------------------------------------------------------------------------------
102
HORLOGE_CLK : HORLOGE
103
 generic map ( NOM_FICHIER_HORLOGE => CHEMIN & "clk.in")
104
 port map    ( CLOCK => CLK );
105
-------------------------------------------------------------------------------
106
HORLOGE_BRCLK : HORLOGE
107
 generic map ( NOM_FICHIER_HORLOGE => CHEMIN & "brclk.in")
108
 port map    ( CLOCK => BRCLK );
109
-------------------------------------------------------------------------------
110
DUT : UART
111
 generic map (BRDIVISOR => 1)
112
 port map(
113
     WB_CLK_I => CLK,
114
     WB_RST_I => PATT(0),
115
     WB_ADR_I => PATT(2 downto 1),
116
     WB_DAT_I => PATT(10 downto 3),
117
     WB_DAT_O => VISU(7 downto 0),
118
     WB_WE_I  => PATT(11),
119
     WB_STB_I => PATT(12),
120
     WB_ACK_O => VISU(8),
121
 
122
     IntTx_O  => VISU(9),
123
     IntRx_O  => VISU(10),
124
     BR_Clk_I => BRCLK,
125
     TxD_PAD_O => VISU(11),
126
     RxD_PAD_I => PATT(13)
127
     );
128
-------------------------------------------------------------------------------
129
 
130
end ARCH_TEST_BENCH;
131
 

powered by: WebSVN 2.1.0

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