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

Subversion Repositories spislave

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

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

powered by: WebSVN 2.1.0

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