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

Subversion Repositories spislave

[/] [spislave/] [trunk/] [spislave/] [bench/] [tb_spigpio.v] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 siva12
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Test Bench for SPI SLAVE IP Core                             ////
4
////                                                              ////
5
//// This file is part of the spislave project                    ////
6
//// http://www.opencores.org/project,spislave                    ////
7
////                                                              ////
8
//// Description                                                  ////
9
//// TB Implementation of spislave IP core according to           ////
10
//// spislave IP core specification document.                     ////
11
////                                                              ////
12
//// To Do:                                                       ////
13
////   -                                                          ////
14
////                                                              ////
15
//// Author(s):                                                   ////
16 12 siva12
////      - Sivakumar.B ,                                         ////
17 11 siva12
////                      email: siva12@opencores.org             ////
18 12 siva12
////                      email: siva@zilogic.com                 ////
19
////                                                              ////
20 11 siva12
////        Engineer  Zilogic systems,chennai. www.zilogic.com    ////
21
////                                                              ////
22 7 siva12
//////////////////////////////////////////////////////////////////////
23
////                                                              ////
24 12 siva12
//// Copyright (C) 2009 Sivakumar.B,  siva@zilogic.com            ////
25
///             www.zilogic.com  and OPENCORES.ORG                ////
26 7 siva12
////                                                              ////
27
//// This source file may be used and distributed without         ////
28
//// restriction provided that this copyright statement is not    ////
29
//// removed from the file and that any derivative work contains  ////
30
//// the original copyright notice and the associated disclaimer. ////
31
////                                                              ////
32
//// This source file is free software; you can redistribute it   ////
33
//// and/or modify it under the terms of the GNU Lesser General   ////
34
//// Public License as published by the Free Software Foundation; ////
35
//// either version 2.1 of the License, or (at your option) any   ////
36
//// later version.                                               ////
37
////                                                              ////
38
//// This source is distributed in the hope that it will be       ////
39
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
40
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
41
//// PURPOSE. See the GNU Lesser General Public License for more  ////
42
//// details.                                                     ////
43
////                                                              ////
44
//// You should have received a copy of the GNU Lesser General    ////
45
//// Public License along with this source; if not, download it   ////
46
//// from http://www.opencores.org/lgpl.shtml                     ////
47
////                                                              ////
48
//////////////////////////////////////////////////////////////////////
49
//// test bench for spigpio for SPI GPIO -- shift 8 bit register  ////  
50
////                                                              ////
51
//// This is a iverilog simulation from icarus verilog            ////
52
//// you install it in your linux system                          ////
53
////        sudo apt-get install verilog                          ////  
54
//// or go through the following website                          ////  
55
//// http://www.icarus.com/eda/verilog/                           ////
56
//////////////////////////////////////////////////////////////////////   
57
 
58
 
59
module testbench;
60
 
61
   reg clk = 0;
62
   reg cs;
63
   reg sr_in;
64
   reg [7:0] data;
65
   wire      sr_out;
66
   wire [7:0] gpioout;
67
   integer    i;
68
 
69
   spigpio testbe(.clk(clk),
70
                  .cs(cs),
71
                  .sr_in(sr_in),
72
                  .gpioout(gpioout),
73
                  .sr_out(sr_out));
74
   initial
75
     begin
76
        i = 0;
77
        data = 8'hAA;
78
        cs = 1'b0;
79
        for (i = 0; i<9; i = i+1)
80
          begin
81
             #10 clk = 1;
82
             #10 clk = 0;
83
          end
84
        cs =  1'b1;
85
        for (i=0; i<4; i = i + 1)
86
          begin
87
             #10 clk = 1;
88
             #10 clk = 0;
89
          end
90
     end
91
   always @(negedge clk)
92
     begin
93
        sr_in =  data[7];
94
        data = data << 1;
95
     end
96
   initial
97
     begin
98
        $dumpfile("spigpio.vcd");
99
        $dumpvars(0,clk,cs,sr_in,gpioout,sr_out);
100
     end
101
endmodule

powered by: WebSVN 2.1.0

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