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

Subversion Repositories potato

[/] [potato/] [trunk/] [testbenches/] [tb_soc_uart.vhd] - Blame information for rev 44

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

Line No. Rev Author Line
1 7 skordal
-- The Potato Processor - A simple processor for FPGAs
2
-- (c) Kristian Klomsten Skordal 2014 - 2015 <kristian.skordal@wafflemail.net>
3
-- Report bugs and issues on <https://github.com/skordal/potato/issues>
4
 
5
library ieee;
6
use ieee.std_logic_1164.all;
7
 
8
entity tb_soc_uart is
9
end entity tb_soc_uart;
10
 
11
architecture testbench of tb_soc_uart is
12
 
13
        -- Clock signal:
14
        signal clk : std_logic := '0';
15
        constant clk_period : time := 10 ns;
16
 
17
        -- Reset signal:
18
        signal reset : std_logic := '1';
19
 
20
        -- UART ports:
21
        signal txd : std_logic;
22
        signal rxd : std_logic := '1';
23
 
24
        -- interrupt signals:
25
        signal irq_send_buffer_empty : std_logic;
26
        signal irq_data_received : std_logic;
27
 
28
        -- Wishbone ports:
29
        signal wb_adr_in  : std_logic_vector(1 downto 0) := (others => '0');
30
        signal wb_dat_in  : std_logic_vector(7 downto 0) := (others => '0');
31
        signal wb_dat_out : std_logic_vector(7 downto 0);
32
        signal wb_we_in   : std_logic := '0';
33
        signal wb_cyc_in  : std_logic := '0';
34
        signal wb_stb_in  : std_logic := '0';
35
        signal wb_ack_out : std_logic;
36
 
37
begin
38
 
39
        uut: entity work.pp_soc_uart
40
                port map(
41
                        clk => clk,
42
                        reset => reset,
43
                        txd => txd,
44
                        rxd => rxd,
45
                        irq_send_buffer_empty => irq_send_buffer_empty,
46
                        irq_data_received => irq_data_received,
47
                        wb_adr_in => wb_adr_in,
48
                        wb_dat_in => wb_dat_in,
49
                        wb_dat_out => wb_dat_out,
50
                        wb_we_in => wb_we_in,
51
                        wb_cyc_in => wb_cyc_in,
52
                        wb_stb_in => wb_stb_in,
53
                        wb_ack_out => wb_ack_out
54
                );
55
 
56
        -- Set up an internal loopback:
57
        rxd <= txd;
58
 
59
        clock: process
60
        begin
61
                clk <= '1';
62
                wait for clk_period / 2;
63
                clk <= '0';
64
                wait for clk_period / 2;
65
        end process clock;
66
 
67
        stimulus: process
68
        begin
69
                wait for clk_period * 2;
70
                reset <= '0';
71
 
72
                -- Write a 'P' (for Potato the Processor) to the UART:
73
                wb_adr_in <= b"00";
74
                wb_dat_in <= x"50";
75
                wb_we_in <= '1';
76
                wb_cyc_in <= '1';
77
                wb_stb_in <= '1';
78
 
79
                wait until wb_ack_out = '1';
80
                wait for clk_period;
81
                wb_stb_in <= '0';
82
                wait for clk_period;
83
 
84
                -- Write an 'o':
85
                wb_dat_in <= x"6f";
86
                wb_stb_in <= '1';
87
                wait until wb_ack_out = '1';
88
                wait for clk_period;
89
                wb_stb_in <= '0';
90
                wait for clk_period;
91
 
92
                wait;
93
        end process stimulus;
94
 
95
end architecture testbench;

powered by: WebSVN 2.1.0

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