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

Subversion Repositories cpu8080

[/] [cpu8080/] [trunk/] [project/] [cpu_tbw.tfw] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 samiam9512
////////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 1995-2003 Xilinx, Inc.
3
// All Right Reserved.
4
////////////////////////////////////////////////////////////////////////////////
5
//   ____  ____
6
//  /   /\/   /
7
// /___/  \  /    Vendor: Xilinx
8
// \   \   \/     Version : 8.2.02i
9
//  \   \         Application : ISE
10
//  /   /         Filename : cpu_tbw.tfw
11
// /___/   /\     Timestamp : Sat Sep 23 19:23:16 2006
12
// \   \  /  \
13
//  \___\/\___\
14
//
15
//Command:
16
//Design Name: cpu_tbw
17
//Device: Xilinx
18
//
19
`timescale 1ns/1ps
20
 
21
module cpu_tbw;
22
    wire [15:0] addr;
23
    reg [7:0] data$inout$reg = 8'bZZZZZZZZ;
24
    wire [7:0] data = data$inout$reg;
25
    wire readmem;
26
    wire writemem;
27
    wire readio;
28
    wire writeio;
29
    reg intr = 1'b0;
30
    wire inta;
31
    reg waitr = 1'b0;
32
    reg reset = 1'b1;
33
    reg clock = 1'b0;
34
 
35
    parameter PERIOD = 200;
36
    parameter real DUTY_CYCLE = 0.5;
37
    parameter OFFSET = 0;
38
 
39
    initial    // Clock process for clock
40
    begin
41
        #OFFSET;
42
        forever
43
        begin
44
            clock = 1'b0;
45
            #(PERIOD-(PERIOD*DUTY_CYCLE)) clock = 1'b1;
46
            #(PERIOD*DUTY_CYCLE);
47
        end
48
    end
49
 
50
    testbench UUT (
51
        .addr(addr),
52
        .data(data),
53
        .readmem(readmem),
54
        .writemem(writemem),
55
        .readio(readio),
56
        .writeio(writeio),
57
        .intr(intr),
58
        .inta(inta),
59
        .waitr(waitr),
60
        .reset(reset),
61
        .clock(clock));
62
 
63
    integer TX_FILE = 0;
64
    integer TX_ERROR = 0;
65
 
66
    initial begin  // Open the results file...
67
        TX_FILE = $fopen("results.txt");
68
        #10200 // Final time:  10200 ns
69
        if (TX_ERROR == 0) begin
70
            $display("No errors or warnings.");
71
            $fdisplay(TX_FILE, "No errors or warnings.");
72
        end else begin
73
            $display("%d errors found in simulation.", TX_ERROR);
74
            $fdisplay(TX_FILE, "%d errors found in simulation.", TX_ERROR);
75
        end
76
        $fclose(TX_FILE);
77
        $stop;
78
    end
79
 
80
    initial begin
81
        // -------------  Current Time:  115ns
82
        #115;
83
        CHECK_inta(1'b0);
84
        CHECK_readio(1'b0);
85
        CHECK_readmem(1'b0);
86
        CHECK_writeio(1'b0);
87
        CHECK_writemem(1'b0);
88
        // -------------------------------------
89
        // -------------  Current Time:  485ns
90
        #370;
91
        reset = 1'b0;
92
        // -------------------------------------
93
        // -------------  Current Time:  515ns
94
        #30;
95
        CHECK_readmem(1'b1);
96
        CHECK_addr(16'b0000000000000000);
97
        // -------------------------------------
98
        // -------------  Current Time:  715ns
99
        #200;
100
        CHECK_readmem(1'b0);
101
        // -------------------------------------
102
        // -------------  Current Time:  915ns
103
        #200;
104
        CHECK_readmem(1'b1);
105
        CHECK_addr(16'b0000000000000001);
106
        // -------------------------------------
107
        // -------------  Current Time:  1115ns
108
        #200;
109
        CHECK_readmem(1'b0);
110
        // -------------------------------------
111
        // -------------  Current Time:  1315ns
112
        #200;
113
        CHECK_readmem(1'b1);
114
        CHECK_addr(16'b0000000000000010);
115
        // -------------------------------------
116
        // -------------  Current Time:  1515ns
117
        #200;
118
        CHECK_readmem(1'b0);
119
        // -------------------------------------
120
        // -------------  Current Time:  1715ns
121
        #200;
122
        CHECK_readmem(1'b1);
123
        CHECK_addr(16'b0000000000000011);
124
        // -------------------------------------
125
        // -------------  Current Time:  1915ns
126
        #200;
127
        CHECK_readmem(1'b0);
128
        // -------------------------------------
129
        // -------------  Current Time:  2315ns
130
        #400;
131
        CHECK_readmem(1'b1);
132
        CHECK_addr(16'b0000000000000000);
133
        // -------------------------------------
134
        // -------------  Current Time:  2515ns
135
        #200;
136
        CHECK_readmem(1'b0);
137
        // -------------------------------------
138
        // -------------  Current Time:  2715ns
139
        #200;
140
        CHECK_readmem(1'b1);
141
        CHECK_addr(16'b0000000000000001);
142
        // -------------------------------------
143
        // -------------  Current Time:  2915ns
144
        #200;
145
        CHECK_readmem(1'b0);
146
        // -------------------------------------
147
        // -------------  Current Time:  3115ns
148
        #200;
149
        CHECK_readmem(1'b1);
150
        CHECK_addr(16'b0000000000000010);
151
        // -------------------------------------
152
        // -------------  Current Time:  3315ns
153
        #200;
154
        CHECK_readmem(1'b0);
155
        // -------------------------------------
156
        // -------------  Current Time:  3515ns
157
        #200;
158
        CHECK_readmem(1'b1);
159
        CHECK_addr(16'b0000000000000011);
160
        // -------------------------------------
161
        // -------------  Current Time:  3715ns
162
        #200;
163
        CHECK_readmem(1'b0);
164
        // -------------------------------------
165
        // -------------  Current Time:  4115ns
166
        #400;
167
        CHECK_readmem(1'b1);
168
        CHECK_addr(16'b0000000000000000);
169
        // -------------------------------------
170
        // -------------  Current Time:  4315ns
171
        #200;
172
        CHECK_readmem(1'b0);
173
        // -------------------------------------
174
        // -------------  Current Time:  4515ns
175
        #200;
176
        CHECK_readmem(1'b1);
177
        CHECK_addr(16'b0000000000000001);
178
        // -------------------------------------
179
        // -------------  Current Time:  4715ns
180
        #200;
181
        CHECK_readmem(1'b0);
182
        // -------------------------------------
183
        // -------------  Current Time:  4915ns
184
        #200;
185
        CHECK_readmem(1'b1);
186
        CHECK_addr(16'b0000000000000010);
187
        // -------------------------------------
188
        // -------------  Current Time:  5115ns
189
        #200;
190
        CHECK_readmem(1'b0);
191
        // -------------------------------------
192
        // -------------  Current Time:  5315ns
193
        #200;
194
        CHECK_readmem(1'b1);
195
        CHECK_addr(16'b0000000000000011);
196
        // -------------------------------------
197
        // -------------  Current Time:  5515ns
198
        #200;
199
        CHECK_readmem(1'b0);
200
        // -------------------------------------
201
        // -------------  Current Time:  5915ns
202
        #400;
203
        CHECK_readmem(1'b1);
204
        CHECK_addr(16'b0000000000000000);
205
        // -------------------------------------
206
        // -------------  Current Time:  6115ns
207
        #200;
208
        CHECK_readmem(1'b0);
209
        // -------------------------------------
210
        // -------------  Current Time:  6315ns
211
        #200;
212
        CHECK_readmem(1'b1);
213
        CHECK_addr(16'b0000000000000001);
214
        // -------------------------------------
215
        // -------------  Current Time:  6515ns
216
        #200;
217
        CHECK_readmem(1'b0);
218
        // -------------------------------------
219
        // -------------  Current Time:  6715ns
220
        #200;
221
        CHECK_readmem(1'b1);
222
        CHECK_addr(16'b0000000000000010);
223
        // -------------------------------------
224
        // -------------  Current Time:  6915ns
225
        #200;
226
        CHECK_readmem(1'b0);
227
        // -------------------------------------
228
        // -------------  Current Time:  7115ns
229
        #200;
230
        CHECK_readmem(1'b1);
231
        CHECK_addr(16'b0000000000000011);
232
        // -------------------------------------
233
        // -------------  Current Time:  7315ns
234
        #200;
235
        CHECK_readmem(1'b0);
236
        // -------------------------------------
237
        // -------------  Current Time:  7715ns
238
        #400;
239
        CHECK_readmem(1'b1);
240
        CHECK_addr(16'b0000000000000000);
241
        // -------------------------------------
242
        // -------------  Current Time:  7915ns
243
        #200;
244
        CHECK_readmem(1'b0);
245
        // -------------------------------------
246
        // -------------  Current Time:  8115ns
247
        #200;
248
        CHECK_readmem(1'b1);
249
        CHECK_addr(16'b0000000000000001);
250
        // -------------------------------------
251
        // -------------  Current Time:  8315ns
252
        #200;
253
        CHECK_readmem(1'b0);
254
        // -------------------------------------
255
        // -------------  Current Time:  8515ns
256
        #200;
257
        CHECK_readmem(1'b1);
258
        CHECK_addr(16'b0000000000000010);
259
        // -------------------------------------
260
        // -------------  Current Time:  8715ns
261
        #200;
262
        CHECK_readmem(1'b0);
263
        // -------------------------------------
264
        // -------------  Current Time:  8915ns
265
        #200;
266
        CHECK_readmem(1'b1);
267
        CHECK_addr(16'b0000000000000011);
268
        // -------------------------------------
269
        // -------------  Current Time:  9115ns
270
        #200;
271
        CHECK_readmem(1'b0);
272
        // -------------------------------------
273
        // -------------  Current Time:  9515ns
274
        #400;
275
        CHECK_readmem(1'b1);
276
        CHECK_addr(16'b0000000000000000);
277
        // -------------------------------------
278
        // -------------  Current Time:  9715ns
279
        #200;
280
        CHECK_readmem(1'b0);
281
        // -------------------------------------
282
        // -------------  Current Time:  9915ns
283
        #200;
284
        CHECK_readmem(1'b1);
285
        CHECK_addr(16'b0000000000000001);
286
        // -------------------------------------
287
    end
288
 
289
    task CHECK_addr;
290
        input [15:0] NEXT_addr;
291
 
292
        #0 begin
293
            if (NEXT_addr !== addr) begin
294
                $display("Error at time=%dns addr=%b, expected=%b", $time, addr, NEXT_addr);
295
                $fdisplay(TX_FILE, "Error at time=%dns addr=%b, expected=%b", $time, addr, NEXT_addr);
296
                $fflush(TX_FILE);
297
                TX_ERROR = TX_ERROR + 1;
298
            end
299
        end
300
    endtask
301
    task CHECK_readmem;
302
        input NEXT_readmem;
303
 
304
        #0 begin
305
            if (NEXT_readmem !== readmem) begin
306
                $display("Error at time=%dns readmem=%b, expected=%b", $time, readmem, NEXT_readmem);
307
                $fdisplay(TX_FILE, "Error at time=%dns readmem=%b, expected=%b", $time, readmem, NEXT_readmem);
308
                $fflush(TX_FILE);
309
                TX_ERROR = TX_ERROR + 1;
310
            end
311
        end
312
    endtask
313
    task CHECK_writemem;
314
        input NEXT_writemem;
315
 
316
        #0 begin
317
            if (NEXT_writemem !== writemem) begin
318
                $display("Error at time=%dns writemem=%b, expected=%b", $time, writemem, NEXT_writemem);
319
                $fdisplay(TX_FILE, "Error at time=%dns writemem=%b, expected=%b", $time, writemem, NEXT_writemem);
320
                $fflush(TX_FILE);
321
                TX_ERROR = TX_ERROR + 1;
322
            end
323
        end
324
    endtask
325
    task CHECK_readio;
326
        input NEXT_readio;
327
 
328
        #0 begin
329
            if (NEXT_readio !== readio) begin
330
                $display("Error at time=%dns readio=%b, expected=%b", $time, readio, NEXT_readio);
331
                $fdisplay(TX_FILE, "Error at time=%dns readio=%b, expected=%b", $time, readio, NEXT_readio);
332
                $fflush(TX_FILE);
333
                TX_ERROR = TX_ERROR + 1;
334
            end
335
        end
336
    endtask
337
    task CHECK_writeio;
338
        input NEXT_writeio;
339
 
340
        #0 begin
341
            if (NEXT_writeio !== writeio) begin
342
                $display("Error at time=%dns writeio=%b, expected=%b", $time, writeio, NEXT_writeio);
343
                $fdisplay(TX_FILE, "Error at time=%dns writeio=%b, expected=%b", $time, writeio, NEXT_writeio);
344
                $fflush(TX_FILE);
345
                TX_ERROR = TX_ERROR + 1;
346
            end
347
        end
348
    endtask
349
    task CHECK_inta;
350
        input NEXT_inta;
351
 
352
        #0 begin
353
            if (NEXT_inta !== inta) begin
354
                $display("Error at time=%dns inta=%b, expected=%b", $time, inta, NEXT_inta);
355
                $fdisplay(TX_FILE, "Error at time=%dns inta=%b, expected=%b", $time, inta, NEXT_inta);
356
                $fflush(TX_FILE);
357
                TX_ERROR = TX_ERROR + 1;
358
            end
359
        end
360
    endtask
361
 
362
endmodule
363
 

powered by: WebSVN 2.1.0

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