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 4

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
    PORT(
17
         rst : IN  std_logic;
18
         baudClk : IN  std_logic;
19
         data_byte : IN  std_logic_vector(7 downto 0);
20
         data_sent : OUT  std_logic;
21
         serial_out : OUT  std_logic
22
        );
23
    END COMPONENT;
24
 
25
 
26
   --Inputs
27
   signal rst : std_logic := '0';
28
   signal baudClk : std_logic := '0';
29
   signal data_byte : std_logic_vector(7 downto 0) := (others => '0');
30
 
31
        --Outputs
32
   signal data_sent : std_logic;
33
   signal serial_out : std_logic;
34
 
35
   -- Clock period definitions
36
   constant baudClk_period : time := 10 ns;
37
 
38
BEGIN
39
 
40
        -- Instantiate the Unit Under Test (UUT)
41
   uut: serial_transmitter PORT MAP (
42
          rst => rst,
43
          baudClk => baudClk,
44
          data_byte => data_byte,
45
          data_sent => data_sent,
46
          serial_out => serial_out
47
        );
48
 
49
   -- Clock process definitions
50
   baudClk_process :process
51
   begin
52
                baudClk <= '0';
53
                wait for baudClk_period/2;
54
                baudClk <= '1';
55
                wait for baudClk_period/2;
56
   end process;
57
 
58
 
59
   -- Stimulus process
60
   stim_proc: process
61
   begin
62
      -- Prepare the data to be sent 0x55
63
                rst <= '1';
64
                data_byte <= "01010101";
65
      wait for 50 ns;
66
                rst <= '0';
67
 
68
      wait until data_sent = '1';
69
                wait for baudClk_period*3;
70
 
71
                -- Prepare the data to be sent
72
                rst <= '1';
73
                data_byte <= "11000100";
74
      wait for 50 ns;
75
                rst <= '0';
76
 
77
      wait until data_sent = '1';
78
                wait for baudClk_period*3;
79
 
80
      -- insert stimulus here 
81
 
82
      wait;
83
   end process;
84
 
85
END;

powered by: WebSVN 2.1.0

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