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

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [testSerial_transmitter.vhd] - Blame information for rev 37

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

Line No. Rev Author Line
1 2 leonardoar
--! Test serial_transmitter module
2
LIBRARY ieee;
3
USE ieee.std_logic_1164.ALL;
4
 
5
--! Use CPU Definitions package
6
use work.pkgDefinitions.all;
7
 
8
ENTITY testSerial_transmitter IS
9
END testSerial_transmitter;
10
 
11
ARCHITECTURE behavior OF testSerial_transmitter IS
12
 
13
    -- Component Declaration for the Unit Under Test (UUT)
14
 
15
    COMPONENT serial_transmitter
16 37 leonardoar
    Port ( rst : in  STD_LOGIC;                                                                                         --! Reset input
17
           baudClk : in  STD_LOGIC;                                                                                     --! Baud rate clock input
18
           data_byte : in  STD_LOGIC_VECTOR ((nBits-1) downto 0);        --! Byte to be sent
19
                          data_sent : out STD_LOGIC;                                                                            --! Indicate that byte has been sent
20
           serial_out : out  STD_LOGIC);                                                                        --! Uart serial output
21 2 leonardoar
    END COMPONENT;
22
 
23
 
24
   --Inputs
25 37 leonardoar
   signal rst : std_logic := '0';                                                                                                        --! Signal to connect with UUT
26
   signal baudClk : std_logic := '0';                                                                                            --! Signal to connect with UUT
27
   signal data_byte : std_logic_vector(7 downto 0) := (others => '0');    --! Signal to connect with UUT
28 2 leonardoar
 
29
        --Outputs
30 37 leonardoar
   signal data_sent : std_logic;                                                                                                                --! Signal to connect with UUT
31
   signal serial_out : std_logic;                                                                                                       --! Signal to connect with UUT
32 2 leonardoar
 
33
   -- Clock period definitions
34
   constant baudClk_period : time := 10 ns;
35
 
36
BEGIN
37
 
38 36 leonardoar
        --! Instantiate the Unit Under Test (UUT)
39 2 leonardoar
   uut: serial_transmitter PORT MAP (
40
          rst => rst,
41
          baudClk => baudClk,
42
          data_byte => data_byte,
43
          data_sent => data_sent,
44
          serial_out => serial_out
45
        );
46
 
47
   -- Clock process definitions
48
   baudClk_process :process
49
   begin
50
                baudClk <= '0';
51
                wait for baudClk_period/2;
52
                baudClk <= '1';
53
                wait for baudClk_period/2;
54
   end process;
55
 
56
 
57
   -- Stimulus process
58
   stim_proc: process
59
   begin
60
      -- Prepare the data to be sent 0x55
61
                rst <= '1';
62
                data_byte <= "01010101";
63
      wait for 50 ns;
64
                rst <= '0';
65
 
66
      wait until data_sent = '1';
67
                wait for baudClk_period*3;
68
 
69
                -- Prepare the data to be sent
70
                rst <= '1';
71
                data_byte <= "11000100";
72
      wait for 50 ns;
73
                rst <= '0';
74
 
75
      wait until data_sent = '1';
76
                wait for baudClk_period*3;
77 11 leonardoar
 
78
                -- Stop Simulation
79
                assert false report "NONE. End of simulation." severity failure;
80 2 leonardoar
 
81
      wait;
82
   end process;
83
 
84
END;

powered by: WebSVN 2.1.0

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