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

Subversion Repositories potato

[/] [potato/] [trunk/] [testbenches/] [tb_soc_timer.vhd] - Blame information for rev 32

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_timer is
9
end entity tb_soc_timer;
10
 
11
architecture behaviour of tb_soc_timer 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
        -- IRQ signal:
21
        signal irq : std_logic;
22
 
23
        -- Wishbone interface:
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
 
32
begin
33
 
34
        uut: entity work.pp_soc_timer
35
                port map(
36
                        clk => clk,
37
                        reset => reset,
38
                        irq => irq,
39
                        wb_adr_in => wb_adr_in,
40
                        wb_dat_in => wb_dat_in,
41
                        wb_dat_out => wb_dat_out,
42
                        wb_cyc_in => wb_cyc_in,
43
                        wb_stb_in => wb_stb_in,
44
                        wb_we_in => wb_we_in,
45
                        wb_ack_out => wb_ack_out
46
                );
47
 
48
        clock: process
49
        begin
50
                clk <= '1';
51
                wait for clk_period / 2;
52
                clk <= '0';
53
                wait for clk_period / 2;
54
        end process clock;
55
 
56
        stimulus: process
57
        begin
58
                wait for clk_period * 2;
59
                reset <= '0';
60
 
61
                wait for clk_period;
62
 
63
                -- Set the compare register to 50:
64
                wb_cyc_in <= '1';
65
                wb_stb_in <= '1';
66
                wb_adr_in <= b"01";
67
                wb_dat_in <= x"00000032";
68
                wb_we_in <= '1';
69
                wait until wb_ack_out = '1';
70
                wait for clk_period;
71
 
72
                wb_stb_in <= '0';
73
                wait for clk_period;
74
 
75
                -- Start the timer:
76
                wb_stb_in <= '1';
77
                wb_adr_in <= b"00";
78
                wb_dat_in <= x"00000003";
79
                wait until wb_ack_out = '1';
80
                wait for clk_period;
81
 
82
                wb_stb_in <= '0';
83
                wb_cyc_in <= '0';
84
                wb_we_in <= '0';
85
                wait for clk_period;
86
 
87
                -- Wait for the interrupt:
88
                wait until irq = '1';
89
                wait for clk_period;
90
 
91
                -- Reset the interrupt:
92
                wb_cyc_in <= '1';
93
                wb_stb_in <= '1';
94
                wb_we_in <= '1';
95
                wb_adr_in <= b"00";
96
                wb_dat_in <= x"00000003";
97
                wait until wb_ack_out = '1';
98
                wait for clk_period;
99
 
100
                wb_stb_in <= '0';
101
                wb_cyc_in <= '0';
102
                wb_we_in <= '0';
103
                wait for clk_period;
104
 
105
                wait;
106
        end process stimulus;
107
 
108
end architecture behaviour;

powered by: WebSVN 2.1.0

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