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

Subversion Repositories ssp_slv

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 MichaelA
// ------------------------- CONFIDENTIAL ------------------------------------
2
//
3
//  Copyright 2011 by Michael A. Morris, dba M. A. Morris & Associates
4
//
5
//  All rights reserved.  No part of this source code may be reproduced or
6
//  transmitted in any form or by any means, electronic or mechanical,
7
//  including photocopying, recording, or any information storage and
8
//  retrieval system, without permission in writing from Northest Logic, Inc.
9
//
10
//  Further, no use of this source code is permitted in any form or means
11
//  without a valid, written license agreement with Northwest Logic, Inc.
12
//
13
//  Michael A. Morris
14
//  dba M. A. Morris & Associates
15
//  164 Raleigh Way
16
//  Huntsville, AL 35811, USA
17
//  Ph.  +1 256 508 5859
18
//
19
// Licensed To:     DopplerTech, Inc. (DTI)
20
//                  9345 E. South Frontage Rd.
21
//                  Yuma, AZ 85365
22
//
23
// ----------------------------------------------------------------------------
24
 
25
`timescale 1ns / 1ps
26
 
27
///////////////////////////////////////////////////////////////////////////////
28
// Company:         M. A. Morris & Associates
29
// Engineer:        Michael A. Morris
30
//
31
// Create Date:     09:03:15 05/10/2008
32
// Design Name:     LTAS 
33
// Module Name:     C:/XProjects/ISE10.1i/LTAS/tb_SSPx_Slv.v
34
// Project Name:    LTAS 
35
// Target Devices:  XC3S700AN-5FFG484I 
36
// Tool versions:   ISE 10.1i SP3 
37
//
38
// Description: This test bench is intended to test the SSP Slave interface
39
//              that will be used with the LPC2148 ARM microcomputer.
40
//
41
// Verilog Test Fixture created by ISE for module: SSPx_Slv
42
//
43
// Dependencies:
44
// 
45
// Revision History:
46
//
47
//  0.01    08E10   MAM     File Created
48
//
49
// Additional Comments: 
50
//
51
///////////////////////////////////////////////////////////////////////////////
52
 
53
module tb_SSPx_Slv_v;
54
 
55
// UUT Ports
56
 
57
reg     Rst;
58
reg     SSEL;
59
reg     SCK;
60
reg     MOSI;
61
wire    MISO;
62
 
63
wire    [2:0] RA;
64
wire    WnR;
65
wire    En;
66
wire    EOC;
67
wire    [11:0] DI;
68
reg     [11:0] DO;
69
 
70
wire    [3:0] BC;
71
 
72
// Instantiate the Unit Under Test (UUT)
73
 
74
SSPx_Slv    uut (
75
                .Rst(Rst),
76
 
77
                .SSEL(SSEL),
78
                .SCK(SCK),
79
                .MOSI(MOSI),
80
                .MISO(MISO),
81
 
82
                .RA(RA),
83
                .WnR(WnR),
84
                .En(En),
85
                .EOC(EOC),
86
                .DI(DI),
87
                .DO(DO),
88
 
89
                .BC(BC)
90
            );
91
 
92
initial begin
93
    // Initialize Inputs
94
    Rst  = 1;
95
    SSEL = 0;
96
    SCK  = 0;
97
    MOSI = 0;
98
    DO   = 16'b0;
99
 
100
    // Wait 100 ns for global reset to finish
101
    #100 Rst = 0;
102
 
103
    // Add stimulus here
104
 
105
    #100;
106
 
107
    SSP(3'h7, 1'b1, 12'h556, 12'hAA9);
108
 
109
end
110
 
111
//  Task SSP Write
112
 
113
task SSP;
114
    input   [2:0] RAIn;
115
    input   Cmd;
116
    input   [11:0] DIn;
117
    input   [11:0] DOut;
118
 
119
    begin
120
           SSEL = 1; MOSI = RAIn[2]; DO = DOut;
121
        #5 SCK  = 1;
122
        #5 SCK  = 0; MOSI = RAIn[1];
123
        #5 SCK  = 1;
124
        #5 SCK  = 0; MOSI = RAIn[0];
125
        #5 SCK  = 1;
126
        #5 SCK  = 0; MOSI = Cmd;
127
        #5 SCK  = 1;
128
        #5 SCK  = 0; MOSI = DIn[11];
129
        #5 SCK  = 1;
130
        #5 SCK  = 0; MOSI = DIn[10];
131
        #5 SCK  = 1;
132
        #5 SCK  = 0; MOSI = DIn[ 9];
133
        #5 SCK  = 1;
134
        #5 SCK  = 0; MOSI = DIn[ 8];
135
        #5 SCK  = 1;
136
        #5 SCK  = 0; MOSI = DIn[ 7];
137
        #5 SCK  = 1;
138
        #5 SCK  = 0; MOSI = DIn[ 6];
139
        #5 SCK  = 1;
140
        #5 SCK  = 0; MOSI = DIn[ 5];
141
        #5 SCK  = 1;
142
        #5 SCK  = 0; MOSI = DIn[ 4];
143
        #5 SCK  = 1;
144
        #5 SCK  = 0; MOSI = DIn[ 3];
145
        #5 SCK  = 1;
146
        #5 SCK  = 0; MOSI = DIn[ 2];
147
        #5 SCK  = 1;
148
        #5 SCK  = 0; MOSI = DIn[ 1];
149
        #5 SCK  = 1;
150
        #5 SCK  = 0; MOSI = DIn[ 0];
151
        #5 SCK  = 1;
152
        #5 SCK  = 0; SSEL = 0;
153
        #10;
154
    end
155
endtask
156
 
157
endmodule
158
 

powered by: WebSVN 2.1.0

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