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

Subversion Repositories spislave

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

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

powered by: WebSVN 2.1.0

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