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

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [testUart_wishbone_slave.vhd] - Blame information for rev 16

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 leonardoar
--! Test uart_wishbone_slave (Main test module)
2
LIBRARY ieee;
3
USE ieee.std_logic_1164.ALL;
4
use ieee.std_logic_unsigned.all;
5
use ieee.std_logic_arith.all;
6
 
7
--! Use Global Definitions package
8
use work.pkgDefinitions.all;
9
 
10
ENTITY testUart_wishbone_slave IS
11
END testUart_wishbone_slave;
12
 
13
ARCHITECTURE behavior OF testUart_wishbone_slave IS
14
 
15
    -- Component Declaration for the Unit Under Test (UUT)
16
 
17
    COMPONENT uart_wishbone_slave
18
    PORT(
19
         RST_I : IN  std_logic;
20
         CLK_I : IN  std_logic;
21
         ADR_I0 : IN  std_logic_vector(1 downto 0);
22
         DAT_I0 : IN  std_logic_vector(31 downto 0);
23
         DAT_O0 : OUT  std_logic_vector(31 downto 0);
24
         WE_I : IN  std_logic;
25
         STB_I : IN  std_logic;
26
         ACK_O : OUT  std_logic;
27
         serial_in : IN  std_logic;
28
         serial_out : OUT  std_logic
29
        );
30
    END COMPONENT;
31
 
32
 
33
   --Inputs
34
   signal RST_I : std_logic := '0';
35
   signal CLK_I : std_logic := '0';
36
   signal ADR_I0 : std_logic_vector(1 downto 0) := (others => '0');
37
   signal DAT_I0 : std_logic_vector(31 downto 0) := (others => '0');
38
   signal WE_I : std_logic := '0';
39
   signal STB_I : std_logic := '0';
40
   signal serial_in : std_logic := '0';
41
 
42
        --Outputs
43
   signal DAT_O0 : std_logic_vector(31 downto 0);
44
   signal ACK_O : std_logic;
45
   signal serial_out : std_logic;
46
 
47
   -- Clock period definitions (1.8432MHz)
48
   constant CLK_I_period : time := 0.543 us; -- 0.543us (1.8432Mhz) 2ns (50Mhz)
49
 
50
BEGIN
51
 
52
        -- Instantiate the Unit Under Test (UUT)
53
   uut: uart_wishbone_slave PORT MAP (
54
          RST_I => RST_I,
55
          CLK_I => CLK_I,
56
          ADR_I0 => ADR_I0,
57
          DAT_I0 => DAT_I0,
58
          DAT_O0 => DAT_O0,
59
          WE_I => WE_I,
60
          STB_I => STB_I,
61
          ACK_O => ACK_O,
62
          serial_in => serial_in,
63
          serial_out => serial_out
64
        );
65
 
66
   -- Clock process definitions
67
   CLK_I_process :process
68
   begin
69
                CLK_I <= '0';
70
                wait for CLK_I_period/2;
71
                CLK_I <= '1';
72
                wait for CLK_I_period/2;
73
   end process;
74
 
75
 
76
   -- Stimulus process
77
   stim_proc: process
78
   begin
79
      -- Reset the slave
80
                RST_I <= '1';
81
      wait for 1 ns;
82
                RST_I <= '0';
83
                wait for CLK_I_period*3;
84
 
85
      -- Configure the clock... 
86
                ADR_I0 <= "00";
87
                WE_I <= '1';
88
                STB_I <= '1';
89
                DAT_I0 <= conv_std_logic_vector(50000000, (nBitsLarge));
90
                wait until ACK_O = '1';
91
                WE_I <= '0';
92
                STB_I <= '0';
93
                ADR_I0 <= (others => 'U');
94
                wait for CLK_I_period;
95
 
96
                -- Configure the Baud... 
97
                ADR_I0 <= "01";
98
                WE_I <= '1';
99
                STB_I <= '1';
100
                DAT_I0 <= conv_std_logic_vector(115200, (nBitsLarge));
101
                wait until ACK_O = '1';
102
                WE_I <= '0';
103
                STB_I <= '0';
104
                ADR_I0 <= (others => 'U');
105
                wait for CLK_I_period;
106
 
107
                -- Ask to send some data...(0xC4)
108
                ADR_I0 <= "10";
109
                WE_I <= '1';
110
                STB_I <= '1';
111
                DAT_I0 <= x"000000C4";
112
                wait until ACK_O = '1';
113
                WE_I <= '0';
114
                STB_I <= '0';
115
                ADR_I0 <= (others => 'U');
116
                wait for CLK_I_period;
117
 
118
      -- Stop Simulation
119
                assert false report "NONE. End of simulation." severity failure;
120
   end process;
121
 
122
END;

powered by: WebSVN 2.1.0

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