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

Subversion Repositories ssp_uart

[/] [ssp_uart/] [trunk/] [Sim/] [tb_DPSFmnCE.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 MichaelA
///////////////////////////////////////////////////////////////////////////////
2
//
3
//  Copyright 2007-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:     14:41:48 12/22/2007
45
// Design Name:     DPSFnmCE
46
// Module Name:     tb_DPSFmnCE.v
47
// Project Name:    4020 HAWK ZAOM Upgrade, 0420-HAWKIF
48
// Target Device:   XC2S150-5PQ208I
49
// Tool versions:   ISE 8.2i
50
//  
51
// Description: Test bench for the Dual-Port Synchrnouse FIFO RAM. Default 
52
//              parameters are used for the module instantiation.
53
//
54
// Verilog Test Fixture created by ISE for module: DPSFnmCE
55
//
56
// Dependencies:    None
57
// 
58
// Revision:
59
//
60
//  0.01    07L22   MAM     File Created
61
//
62
// Additional Comments:
63
// 
64
////////////////////////////////////////////////////////////////////////////////
65
 
66
module tb_DPSFmnCE_v;
67
 
68
        // Inputs
69
        reg Rst;
70
        reg Clk;
71
        reg WE;
72
        reg RE;
73
        reg [15:0] DI;
74
 
75
        // Outputs
76
        wire [15:0] DO;
77
        wire FF;
78
        wire EF;
79
        wire HF;
80
        wire [4:0] Cnt;
81
 
82
        // Instantiate the Unit Under Test (UUT)
83
        DPSFnmCE uut (
84
                .Rst(Rst),
85
                .Clk(Clk),
86
                .WE(WE),
87
                .RE(RE),
88
                .DI(DI),
89
                .DO(DO),
90
                .FF(FF),
91
                .EF(EF),
92
                .HF(HF),
93
                .Cnt(Cnt)
94
        );
95
 
96
        initial begin
97
                // Initialize Inputs
98
                Rst = 1;
99
                Clk = 1;
100
                WE = 0;
101
                RE = 0;
102
                DI = 0;
103
 
104
                // Wait 100 ns for global reset to finish
105
                #100;
106
 
107
                // Add stimulus here
108
 
109
        Rst = 0;
110
 
111
        FIFO_Wr(16'h1111);
112
        FIFO_Wr(16'h2222);
113
        FIFO_Wr(16'h3333);
114
        FIFO_Wr(16'h4444);
115
 
116
        FIFO_Wr(16'h5555);
117
        FIFO_Wr(16'h6666);
118
        FIFO_Wr(16'h7777);
119
        FIFO_Wr(16'h8888);
120
 
121
        FIFO_Wr(16'h9999);
122
        FIFO_Wr(16'hAAAA);
123
        FIFO_Wr(16'hBBBB);
124
        FIFO_Wr(16'hCCCC);
125
 
126
        FIFO_Wr(16'hDDDD);
127
        FIFO_Wr(16'hEEEE);
128
        FIFO_Wr(16'hFFFF);
129
        FIFO_Wr(16'h0000);
130
 
131
        FIFO_Rd;
132
 
133
        FIFO_Wr(16'h0001);
134
 
135
        FIFO_Rd;
136
        FIFO_Rd;
137
        FIFO_Rd;
138
        FIFO_Rd;
139
        FIFO_Rd;
140
        FIFO_Rd;
141
        FIFO_Rd;
142
        FIFO_Rd;
143
        FIFO_Rd;
144
        FIFO_Rd;
145
        FIFO_Rd;
146
        FIFO_Rd;
147
        FIFO_Rd;
148
        FIFO_Rd;
149
        FIFO_Rd;
150
        FIFO_Rd;
151
 
152
        FIFO_Wr(16'h0001);
153
        FIFO_Wr(16'h0002);
154
        FIFO_Wr(16'h0004);
155
        FIFO_Wr(16'h0008);
156
        FIFO_Wr(16'h0010);
157
        FIFO_Wr(16'h0020);
158
        FIFO_Wr(16'h0040);
159
        FIFO_Wr(16'h0080);
160
        FIFO_Wr(16'h0100);
161
        FIFO_Wr(16'h0200);
162
        FIFO_Wr(16'h0400);
163
        FIFO_Wr(16'h0800);
164
        FIFO_Wr(16'h1000);
165
        FIFO_Wr(16'h2000);
166
        FIFO_Wr(16'h4000);
167
        FIFO_Wr(16'h8000);
168
 
169
        FIFO_Wr(16'h8001);
170
 
171
        FIFO_Rd;
172
        FIFO_Rd;
173
        FIFO_Rd;
174
        FIFO_Rd;
175
        FIFO_Rd;
176
        FIFO_Rd;
177
        FIFO_Rd;
178
        FIFO_Rd;
179
 
180
        FIFO_RW(16'h8001);
181
 
182
        FIFO_Rd;
183
        FIFO_Rd;
184
        FIFO_Rd;
185
        FIFO_Rd;
186
        FIFO_Rd;
187
        FIFO_Rd;
188
        FIFO_Rd;
189
        FIFO_Rd;
190
        end
191
 
192
    always #5 Clk = ~Clk;
193
 
194
    // FIFO Write Task
195
 
196
    task FIFO_Wr;
197
 
198
        input   [15:0] Data;
199
 
200
        begin
201
            @(posedge Clk);
202
            #1 WE = 1; DI = Data;
203
            @(posedge Clk);
204
            #1 WE = 0;
205
        end
206
 
207
    endtask
208
 
209
    // FIFO Read Task
210
 
211
    task FIFO_Rd;
212
 
213
        begin
214
            @(posedge Clk);
215
            #1 RE = 1;
216
            @(posedge Clk);
217
            #1 RE = 0;
218
        end
219
 
220
    endtask
221
 
222
    // FIFO Simultaneous Read/Write Task
223
 
224
    task FIFO_RW;
225
 
226
        input   [15:0] Data;
227
 
228
        begin
229
            @(posedge Clk);
230
            #1 WE = 1; RE = 1; DI = Data;
231
            @(posedge Clk);
232
            #1 WE = 0; RE = 0;
233
        end
234
 
235
    endtask
236
 
237
endmodule
238
 

powered by: WebSVN 2.1.0

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