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

Subversion Repositories potato

[/] [potato/] [trunk/] [testbenches/] [tb_soc_gpio.vhd] - Blame information for rev 12

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_gpio is
9
end entity tb_soc_gpio;
10
 
11
architecture testbench of tb_soc_gpio 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
        -- GPIOs:
21
        signal gpio : std_logic_vector(31 downto 0);
22
 
23
        -- Wishbone bus:
24
        signal wb_adr_in  : std_logic_vector( 1 downto 0) := (others => '0');
25
        signal wb_dat_in  : std_logic_vector(31 downto 0) := (others => '0');
26
        signal wb_dat_out : std_logic_vector(31 downto 0);
27
        signal wb_cyc_in  : std_logic := '0';
28
        signal wb_stb_in  : std_logic := '0';
29
        signal wb_we_in   : std_logic := '0';
30
        signal wb_ack_out : std_logic;
31
begin
32
 
33
        uut: entity work.pp_soc_gpio
34
                generic map(
35
                        NUM_GPIOS => 32
36
                ) port map(
37
                        clk => clk,
38
                        reset => reset,
39
                        gpio => gpio,
40
                        wb_adr_in => wb_adr_in,
41
                        wb_dat_in => wb_dat_in,
42
                        wb_dat_out => wb_dat_out,
43
                        wb_cyc_in => wb_cyc_in,
44
                        wb_stb_in => wb_stb_in,
45
                        wb_we_in => wb_we_in,
46
                        wb_ack_out => wb_ack_out
47
                );
48
 
49
        clock: process
50
        begin
51
                clk <= '1';
52
                wait for clk_period / 2;
53
                clk <= '0';
54
                wait for clk_period / 2;
55
        end process clock;
56
 
57
        stimulus: process
58
        begin
59
                wait for clk_period * 2;
60
                reset <= '0';
61
 
62
                -- Set the upper half of the GPIOs as inputs, the rest as outputs:
63
                wb_dat_in <= x"0000ffff";
64
                wb_adr_in <= b"10";
65
                wb_we_in <= '1';
66
                wb_cyc_in <= '1';
67
                wb_stb_in <= '1';
68
                wait until wb_ack_out = '1';
69
                wait for clk_period;
70
                wb_stb_in <= '0';
71
                wb_cyc_in <= '0';
72
                wb_we_in <= '0';
73
                wait for clk_period;
74
 
75
                -- Set the outputs to aa, see if the upper half gets ignored correctly:
76
                wb_dat_in <= x"aaaaaaaa";
77
                wb_adr_in <= b"01";
78
                wb_we_in <= '1';
79
                wb_cyc_in <= '1';
80
                wb_stb_in <= '1';
81
                wait until wb_ack_out = '1';
82
                wait for clk_period;
83
                wb_stb_in <= '0';
84
                wb_cyc_in <= '0';
85
                wb_we_in <= '0';
86
                wait for clk_period;
87
 
88
                wait;
89
        end process stimulus;
90
 
91
end architecture testbench;

powered by: WebSVN 2.1.0

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