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

Subversion Repositories potato

[/] [potato/] [trunk/] [testbenches/] [tb_soc_memory.vhd] - Blame information for rev 63

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

Line No. Rev Author Line
1 2 skordal
-- The Potato Processor - A simple processor for FPGAs
2
-- (c) Kristian Klomsten Skordal 2014 - 2015 <kristian.skordal@wafflemail.net>
3 3 skordal
-- Report bugs and issues on <http://opencores.org/project,potato,bugtracker>
4 2 skordal
 
5
library ieee;
6
use ieee.std_logic_1164.all;
7
use ieee.numeric_std.all;
8
 
9
entity tb_soc_memory is
10
end entity tb_soc_memory;
11
 
12
architecture testbench of tb_soc_memory is
13
 
14
        -- Clock signal:
15
        signal clk : std_logic;
16
        constant clk_period : time := 10 ns;
17
 
18
        -- Reset signal:
19
        signal reset : std_logic := '1';
20
 
21
        -- Wishbone signals:
22
        signal wb_adr_in  : std_logic_vector(31 downto 0);
23
        signal wb_dat_in  : std_logic_vector(31 downto 0);
24
        signal wb_dat_out : std_logic_vector(31 downto 0);
25
        signal wb_cyc_in  : std_logic := '0';
26
        signal wb_stb_in  : std_logic := '0';
27
        signal wb_sel_in  : std_logic_vector(3 downto 0) := (others => '1');
28
        signal wb_we_in   : std_logic := '0';
29
        signal wb_ack_out : std_logic;
30
 
31
begin
32
 
33
        uut: entity work.pp_soc_memory
34
                port map(
35
                        clk => clk,
36
                        reset => reset,
37
                        wb_adr_in => wb_adr_in,
38
                        wb_dat_in => wb_dat_in,
39
                        wb_dat_out => wb_dat_out,
40
                        wb_cyc_in => wb_cyc_in,
41
                        wb_stb_in => wb_stb_in,
42
                        wb_sel_in => wb_sel_in,
43
                        wb_we_in => wb_we_in,
44
                        wb_ack_out => wb_ack_out
45
                );
46
 
47
        clock: process
48
        begin
49
                clk <= '1';
50
                wait for clk_period / 2;
51
                clk <= '0';
52
                wait for clk_period / 2;
53
        end process clock;
54
 
55
        stimulus: process
56
        begin
57
                wait for clk_period;
58
                reset <= '0';
59
 
60
                -- Write 32 bit of data to address 0:
61
                wb_adr_in <= x"00000000";
62
                wb_dat_in <= x"deadbeef";
63
                wb_cyc_in <= '1';
64
                wb_stb_in <= '1';
65
                wb_we_in <= '1';
66
                wait for clk_period;
67
                wb_stb_in <= '0';
68
                wb_cyc_in <= '0';
69
                wait for clk_period;
70
 
71
                -- Write a block write of two 32-bit words at address 0 and 1:
72
                wb_adr_in <= x"00000000";
73
                wb_dat_in <= x"feedbeef";
74
                wb_cyc_in <= '1';
75
                wb_stb_in <= '1';
76
                wait for clk_period;
77
                wb_stb_in <= '0';
78
                wb_adr_in <= x"00000004";
79
                wb_dat_in <= x"f00dd00d";
80
                wait for clk_period;
81
                wb_stb_in <= '1';
82
                wait for clk_period;
83
                wb_stb_in <= '0';
84
                wb_cyc_in <= '0';
85
 
86
                -- Read address 4:
87
                wait for clk_period;
88
                wb_we_in <= '0';
89
                wb_adr_in <= x"00000000";
90
                wb_cyc_in <= '1';
91
                wb_stb_in <= '1';
92
                wait for clk_period;
93
 
94
                -- TODO: Make this testbench automatic.
95
 
96
                wait;
97
        end process stimulus;
98
 
99
end architecture testbench;

powered by: WebSVN 2.1.0

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