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

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [testSerial_receiver.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 leonardoar
--! Test serial_receiver 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_receiver IS
9
END testSerial_receiver;
10
 
11
ARCHITECTURE behavior OF testSerial_receiver IS
12
 
13
    -- Component Declaration for the Unit Under Test (UUT)
14
 
15
    COMPONENT serial_receiver
16
    PORT(
17
         rst : IN  std_logic;
18
         baudClk : IN  std_logic;
19
         baudOverSampleClk : IN  std_logic;
20
         serial_in : IN  std_logic;
21
         data_ready : OUT  std_logic;
22
         data_byte : OUT  std_logic_vector((nBits-1) downto 0)
23
        );
24
    END COMPONENT;
25
 
26
 
27
   --Inputs
28
   signal rst : std_logic := '0';
29
   signal baudClk : std_logic := '0';
30
   signal baudOverSampleClk : std_logic := '0';
31
   signal serial_in : std_logic := '0';
32
 
33
        --Outputs
34
   signal data_ready : std_logic;
35
   signal data_byte : std_logic_vector((nBits-1) downto 0);
36
 
37
   -- Clock period definitions
38
   constant baudClk_period : time := 8.6805 us;
39
   constant baudOverSampleClk_period : time := 1 us;
40
 
41
BEGIN
42
 
43
        -- Instantiate the Unit Under Test (UUT)
44
   uut: serial_receiver PORT MAP (
45
          rst => rst,
46
          baudClk => baudClk,
47
          baudOverSampleClk => baudOverSampleClk,
48
          serial_in => serial_in,
49
          data_ready => data_ready,
50
          data_byte => data_byte
51
        );
52
 
53
   -- Clock process definitions
54
   baudClk_process :process
55
   begin
56
                baudClk <= '0';
57
                wait for baudClk_period/2;
58
                baudClk <= '1';
59
                wait for baudClk_period/2;
60
   end process;
61
 
62
   baudOverSampleClk_process :process
63
   begin
64
                baudOverSampleClk <= '0';
65
                wait for baudOverSampleClk_period/2;
66
                baudOverSampleClk <= '1';
67
                wait for baudOverSampleClk_period/2;
68
   end process;
69
 
70
 
71
   -- Stimulus process
72
   stim_proc: process
73
   begin
74
      rst <= '1';
75
                serial_in <= '1';       -- Idle
76
      wait for 3 us;
77
                rst <= '0';
78
                wait for baudClk_period * 3;
79
 
80
                -- Receive 0xC4 value (11000100)
81
                -- Start bit here
82
                serial_in <= '0';
83
                wait for baudClk_period;
84
 
85
                serial_in <= '0';
86
      wait for baudClk_period;
87
                serial_in <= '0';
88
      wait for baudClk_period;
89
                serial_in <= '1';
90
      wait for baudClk_period;
91
                serial_in <= '0';
92
      wait for baudClk_period;
93
                serial_in <= '0';
94
      wait for baudClk_period;
95
                serial_in <= '0';
96
      wait for baudClk_period;
97
                serial_in <= '1';
98
      wait for baudClk_period;
99
                serial_in <= '1';
100
      wait for baudClk_period;
101
 
102
                -- Stop bit here
103
                serial_in <= '1';
104
                wait for baudClk_period * 3;
105
 
106
      -- Stop Simulation
107
                assert false report "NONE. End of simulation." severity failure;
108
 
109
      wait;
110
   end process;
111
 
112
END;

powered by: WebSVN 2.1.0

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