1 |
2 |
ste.fis |
--------------------------------------------------------------------------------
|
2 |
|
|
-- This sourcecode is released under BSD license.
|
3 |
|
|
-- Please see http://www.opensource.org/licenses/bsd-license.php for details!
|
4 |
|
|
--------------------------------------------------------------------------------
|
5 |
|
|
--
|
6 |
|
|
-- Copyright (c) 2010, Stefan Fischer <Ste.Fis@OpenCores.org>
|
7 |
|
|
-- All rights reserved.
|
8 |
|
|
--
|
9 |
|
|
-- Redistribution and use in source and binary forms, with or without
|
10 |
|
|
-- modification, are permitted provided that the following conditions are met:
|
11 |
|
|
--
|
12 |
|
|
-- * Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
-- this list of conditions and the following disclaimer.
|
14 |
|
|
-- * Redistributions in binary form must reproduce the above copyright notice,
|
15 |
|
|
-- this list of conditions and the following disclaimer in the documentation
|
16 |
|
|
-- and/or other materials provided with the distribution.
|
17 |
|
|
-- * Neither the name of the author nor the names of his contributors may be
|
18 |
|
|
-- used to endorse or promote products derived from this software without
|
19 |
|
|
-- specific prior written permission.
|
20 |
|
|
--
|
21 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
22 |
|
|
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
23 |
|
|
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
24 |
|
|
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
25 |
|
|
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
26 |
|
|
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27 |
|
|
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28 |
|
|
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29 |
|
|
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30 |
|
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31 |
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
32 |
|
|
--
|
33 |
|
|
--------------------------------------------------------------------------------
|
34 |
|
|
-- filename: picoblaze_wb_gpio_tb.vhd
|
35 |
|
|
-- description: testbench for picoblaze_wb_gpio example
|
36 |
|
|
-- todo4user: modify stimulus as needed
|
37 |
|
|
-- version: 0.0.0
|
38 |
|
|
-- changelog: - 0.0.0, initial release
|
39 |
|
|
-- - ...
|
40 |
|
|
--------------------------------------------------------------------------------
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
library ieee;
|
44 |
|
|
use ieee.std_logic_1164.all;
|
45 |
|
|
use ieee.numeric_std.all;
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
entity picoblaze_wb_gpio_tb is
|
49 |
|
|
end picoblaze_wb_gpio_tb;
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
architecture behavioral of picoblaze_wb_gpio_tb is
|
53 |
|
|
|
54 |
|
|
component picoblaze_wb_gpio is
|
55 |
|
|
port
|
56 |
|
|
(
|
57 |
|
|
p_rst_i : in std_logic;
|
58 |
|
|
p_clk_i : in std_logic;
|
59 |
|
|
|
60 |
|
|
p_gpio_io : inout std_logic_vector(7 downto 0)
|
61 |
|
|
);
|
62 |
|
|
end component;
|
63 |
|
|
|
64 |
|
|
signal rst : std_logic := '1';
|
65 |
|
|
signal clk : std_logic := '1';
|
66 |
|
|
|
67 |
|
|
signal gpio : std_logic_vector(7 downto 0) := (others => 'Z');
|
68 |
|
|
|
69 |
|
|
constant PERIOD : time := 20 ns;
|
70 |
|
|
|
71 |
|
|
signal test_data_in : std_logic_vector(7 downto 4) := (others => '0');
|
72 |
|
|
|
73 |
|
|
begin
|
74 |
|
|
|
75 |
|
|
rst <= '0' after PERIOD*2;
|
76 |
|
|
clk <= not clk after PERIOD/2;
|
77 |
|
|
|
78 |
|
|
process
|
79 |
|
|
begin
|
80 |
|
|
wait for 2500 ns;
|
81 |
|
|
test_data_in <= std_logic_vector(unsigned(test_data_in) + 1);
|
82 |
|
|
end process;
|
83 |
|
|
gpio(7 downto 4) <= test_data_in;
|
84 |
|
|
|
85 |
|
|
dut : picoblaze_wb_gpio
|
86 |
|
|
port map
|
87 |
|
|
(
|
88 |
|
|
p_rst_i => rst,
|
89 |
|
|
p_clk_i => clk,
|
90 |
|
|
|
91 |
|
|
p_gpio_io => gpio
|
92 |
|
|
);
|
93 |
|
|
|
94 |
|
|
end behavioral;
|