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

Subversion Repositories wb4pb

[/] [wb4pb/] [trunk/] [sim/] [hdl/] [picoblaze_wb_gpio_tb.vhd] - Blame information for rev 31

Details | Compare with Previous | View Log

Line No. Rev Author Line
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 31 ste.fis
--    and/or other materials provided with the distribution.
17 2 ste.fis
--
18
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
19
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
20
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
21
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
22
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
23
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
24
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
25
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
26
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
27
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
28
-- POSSIBILITY OF SUCH DAMAGE.
29
--
30
--------------------------------------------------------------------------------
31
-- filename: picoblaze_wb_gpio_tb.vhd
32
-- description: testbench for picoblaze_wb_gpio example
33
-- todo4user: modify stimulus as needed
34
-- version: 0.0.0
35
-- changelog: - 0.0.0, initial release
36
--            - ...
37
--------------------------------------------------------------------------------
38
 
39
 
40
library ieee;
41
use ieee.std_logic_1164.all;
42
use ieee.numeric_std.all;
43
 
44
 
45
entity picoblaze_wb_gpio_tb is
46
end picoblaze_wb_gpio_tb;
47
 
48
 
49
architecture behavioral of picoblaze_wb_gpio_tb is
50
 
51
  component picoblaze_wb_gpio is
52
    port
53
    (
54 18 ste.fis
      p_rst_n_i : in std_logic;
55 2 ste.fis
      p_clk_i : in std_logic;
56
 
57
      p_gpio_io : inout std_logic_vector(7 downto 0)
58
    );
59
  end component;
60
 
61 18 ste.fis
  signal rst_n : std_logic := '0';
62 2 ste.fis
  signal clk : std_logic := '1';
63
 
64
  signal gpio : std_logic_vector(7 downto 0) := (others => 'Z');
65
 
66
  constant PERIOD : time := 20 ns;
67
 
68
  signal test_data_in : std_logic_vector(7 downto 4) := (others => '0');
69
 
70
begin
71
 
72 18 ste.fis
  -- system signal generation
73
  rst_n <= '1' after PERIOD*2;
74 2 ste.fis
  clk <= not clk after PERIOD/2;
75
 
76 18 ste.fis
  -- 4 bit counting data, changing after some micro seconds
77
  test_data_in <= std_logic_vector(unsigned(test_data_in) + 1) after 3000 ns;
78
  -- stimulus at upper gpio nibble
79 2 ste.fis
  gpio(7 downto 4) <= test_data_in;
80
 
81 18 ste.fis
  -- design under test instance
82 2 ste.fis
  dut : picoblaze_wb_gpio
83
    port map
84
    (
85 18 ste.fis
      p_rst_n_i => rst_n,
86 2 ste.fis
      p_clk_i => clk,
87
 
88
      p_gpio_io => gpio
89
    );
90
 
91
end behavioral;

powered by: WebSVN 2.1.0

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