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

Subversion Repositories m16c5x

[/] [m16c5x/] [trunk/] [RTL/] [Sim/] [tb_SSPx_Slv.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 MichaelA
///////////////////////////////////////////////////////////////////////////////
2
//
3
//  Copyright 2008-2013 by Michael A. Morris, dba M. A. Morris & Associates
4
//
5
//  All rights reserved. The source code contained herein is publicly released
6
//  under the terms and conditions of the GNU Lesser Public License. No part of
7
//  this source code may be reproduced or transmitted in any form or by any
8
//  means, electronic or mechanical, including photocopying, recording, or any
9
//  information storage and retrieval system in violation of the license under
10
//  which the source code is released.
11
//
12
//  The source code contained herein is free; it may be redistributed and/or 
13
//  modified in accordance with the terms of the GNU Lesser General Public
14
//  License as published by the Free Software Foundation; either version 2.1 of
15
//  the GNU Lesser General Public License, or any later version.
16
//
17
//  The source code contained herein is freely released WITHOUT ANY WARRANTY;
18
//  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
19
//  PARTICULAR PURPOSE. (Refer to the GNU Lesser General Public License for
20
//  more details.)
21
//
22
//  A copy of the GNU Lesser General Public License should have been received
23
//  along with the source code contained herein; if not, a copy can be obtained
24
//  by writing to:
25
//
26
//  Free Software Foundation, Inc.
27
//  51 Franklin Street, Fifth Floor
28
//  Boston, MA  02110-1301 USA
29
//
30
//  Further, no use of this source code is permitted in any form or means
31
//  without inclusion of this banner prominently in any derived works. 
32
//
33
//  Michael A. Morris
34
//  Huntsville, AL
35
//
36
///////////////////////////////////////////////////////////////////////////////`timescale 1ns / 1ps
37
 
38
`timescale 1ns / 1ps
39
 
40
///////////////////////////////////////////////////////////////////////////////
41
// Company:         M. A. Morris & Associates
42
// Engineer:        Michael A. Morris
43
//
44
// Create Date:     09:03:15 05/10/2008
45
// Design Name:     LTAS 
46
// Module Name:     C:/XProjects/ISE10.1i/LTAS/tb_SSPx_Slv.v
47
// Project Name:    LTAS 
48
// Target Devices:  XC3S700AN-5FFG484I 
49
// Tool versions:   ISE 10.1i SP3 
50
//
51
// Description: This test bench is intended to test the SSP Slave interface
52
//              that will be used with the LPC2148 ARM microcomputer.
53
//
54
// Verilog Test Fixture created by ISE for module: SSPx_Slv
55
//
56
// Dependencies:
57
// 
58
// Revision History:
59
//
60
//  0.01    08E10   MAM     File Created
61
//
62
// Additional Comments: 
63
//
64
///////////////////////////////////////////////////////////////////////////////
65
 
66
module tb_SSPx_Slv_v;
67
 
68
// UUT Ports
69
 
70
reg     Rst;
71
reg     SSEL;
72
reg     SCK;
73
reg     MOSI;
74
wire    MISO;
75
 
76
wire    [2:0] RA;
77
wire    WnR;
78
wire    En;
79
wire    EOC;
80
wire    [11:0] DI;
81
reg     [11:0] DO;
82
 
83
wire    [3:0] BC;
84
 
85
// Instantiate the Unit Under Test (UUT)
86
 
87
SSPx_Slv    uut (
88
                .Rst(Rst),
89
 
90
                .SSEL(SSEL),
91
                .SCK(SCK),
92
                .MOSI(MOSI),
93
                .MISO(MISO),
94
 
95
                .RA(RA),
96
                .WnR(WnR),
97
                .En(En),
98
                .EOC(EOC),
99
                .DI(DI),
100
                .DO(DO),
101
 
102
                .BC(BC)
103
            );
104
 
105
initial begin
106
    // Initialize Inputs
107
    Rst  = 1;
108
    SSEL = 0;
109
    SCK  = 0;
110
    MOSI = 0;
111
    DO   = 16'b0;
112
 
113
    // Wait 100 ns for global reset to finish
114
    #100 Rst = 0;
115
 
116
    // Add stimulus here
117
 
118
    #100;
119
 
120
    SSP(3'h7, 1'b1, 12'h556, 12'hAA9);
121
 
122
end
123
 
124
//  Task SSP Write
125
 
126
task SSP;
127
    input   [2:0] RAIn;
128
    input   Cmd;
129
    input   [11:0] DIn;
130
    input   [11:0] DOut;
131
 
132
    begin
133
           SSEL = 1; MOSI = RAIn[2]; DO = DOut;
134
        #5 SCK  = 1;
135
        #5 SCK  = 0; MOSI = RAIn[1];
136
        #5 SCK  = 1;
137
        #5 SCK  = 0; MOSI = RAIn[0];
138
        #5 SCK  = 1;
139
        #5 SCK  = 0; MOSI = Cmd;
140
        #5 SCK  = 1;
141
        #5 SCK  = 0; MOSI = DIn[11];
142
        #5 SCK  = 1;
143
        #5 SCK  = 0; MOSI = DIn[10];
144
        #5 SCK  = 1;
145
        #5 SCK  = 0; MOSI = DIn[ 9];
146
        #5 SCK  = 1;
147
        #5 SCK  = 0; MOSI = DIn[ 8];
148
        #5 SCK  = 1;
149
        #5 SCK  = 0; MOSI = DIn[ 7];
150
        #5 SCK  = 1;
151
        #5 SCK  = 0; MOSI = DIn[ 6];
152
        #5 SCK  = 1;
153
        #5 SCK  = 0; MOSI = DIn[ 5];
154
        #5 SCK  = 1;
155
        #5 SCK  = 0; MOSI = DIn[ 4];
156
        #5 SCK  = 1;
157
        #5 SCK  = 0; MOSI = DIn[ 3];
158
        #5 SCK  = 1;
159
        #5 SCK  = 0; MOSI = DIn[ 2];
160
        #5 SCK  = 1;
161
        #5 SCK  = 0; MOSI = DIn[ 1];
162
        #5 SCK  = 1;
163
        #5 SCK  = 0; MOSI = DIn[ 0];
164
        #5 SCK  = 1;
165
        #5 SCK  = 0; SSEL = 0;
166
        #10;
167
    end
168
endtask
169
 
170
endmodule
171
 

powered by: WebSVN 2.1.0

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