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

Subversion Repositories wb4pb

[/] [wb4pb/] [trunk/] [sim/] [hdl/] [picoblaze_wb_gpio_tb.v] - Blame information for rev 18

Go to most recent revision | 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
//    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.v
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
`uselib lib = unisims_ver
44
 
45
`timescale 1 ns / 1 ps
46
 
47
 
48
module picoblaze_wb_gpio_tb;
49
 
50 18 ste.fis
  reg rst_n;
51 2 ste.fis
  reg clk;
52
 
53
  wire[7:0] gpio;
54
 
55
  parameter PERIOD = 20;
56
 
57
  reg[7:4] test_data_in;
58
 
59 18 ste.fis
  // system signal generation
60 2 ste.fis
  initial begin
61
    test_data_in = 4'h0;
62
    clk = 1'b1;
63 18 ste.fis
    rst_n = 1'b0;
64
    #(PERIOD*2) rst_n = 1'b1;
65 2 ste.fis
  end
66
  always #(PERIOD/2) clk = ! clk;
67
 
68 18 ste.fis
  // 4 bit counting data, changing after some micro seconds
69
  always #3000 test_data_in = test_data_in + 1;
70
  // stimulus at upper gpio nibble
71 2 ste.fis
  assign gpio[7:4] = test_data_in;
72
 
73 18 ste.fis
  // design under test instance
74 2 ste.fis
  picoblaze_wb_gpio dut (
75 18 ste.fis
    .p_rst_n_i(rst_n),
76 2 ste.fis
    .p_clk_i(clk),
77
 
78
    .p_gpio_io(gpio)
79
  );
80
 
81
endmodule

powered by: WebSVN 2.1.0

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