test_64.v
8.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
//****************************************************************************************
// K9F6408U0A, 64Mbit(x8) 2nd Generation NAND FLASH TIMING VECTOR FOR PROGRAM MODE TEST
// Programmed By NAND Flash Memory Product Planning Team, Samsung Semiconductor Co. LTD.
// Rev. 1.1
//****************************************************************************************
`timescale 1ns/1ps
`define PWRUP 5000 // Wait Time
`define TPROGRAM 200100 // Program Time
`define TERASE 2000100 // Erase Time
`define TREAD 10100 // Data Transfer form Cell to Register
module nand_driver();
reg [7:0] io;
wire [7:0] i_o=io;
reg ceb, cle, ale, web, reb, seb, wpb;
integer i;
km29u64 flash(.ceb(ceb), .cle(cle), .ale(ale),
.web(web), .reb(reb), .io(i_o),
.seb(seb), .wpb(wpb), .rbb(rbb));
initial
begin
$dumpvars();
$dumpfile("test.dump");
end
initial
begin
ceb = 1;
cle = 0;
ale = 0;
web = 1;
reb = 1;
io = 8'hzz;
seb = 0;
wpb = 1;
end
// Timing for command latch
task cmd_latch;
input [7:0] cmd;
begin
#20
ceb = 0;
web = 1;
cle = 0;
ale = 0;
#10
cle = 1;
#1
web = 0;
io = cmd;
#26
web = 1;
#11
io = 8'hzz;
#6
cle = 0;
#10
ceb = 1;
end
endtask
// Timing for address latch
task add_latch;
input [7:0] add;
begin
ceb = 0;
#20
cle = 0;
ale = 1;
#1
web = 0;
#5
io = add;
#22
web = 1;
#11
io = 8'hzz;
#6
ale = 0;
ceb = 0;
end
endtask
// Timing for data latch
task data_latch;
input [10:0] cnt;
input [7:0] data;
begin
for (i=0; i < cnt; i=i+1)
begin
#20
ceb = 0;
#1
web = 0;
#5
io = data + i;
#22
web = 1;
#11
io = 8'hzz;
end
end
endtask
// Timing for data latch with ceb don't care
task data_latch1;
input [10:0] cnt1;
input [7:0] data1;
begin
for (i=0; i < cnt1; i=i+1)
begin
#5
ceb = 0;
#8
web = 0;
#5
io = data1 + i;
#22
web = 1;
#11
ceb = 1;
#11
io = 8'hzz;
end
end
endtask
// Timing for serial read
task serial_read;
input [16:0] cnt;
begin
cle = 0;
ale = 0;
web = 1;
for ( i=0; i < cnt; i = i+1)
begin
#16
reb = 0;
#36
reb = 1;
end
end
endtask
// Timing for serial read with ceb don't care
task serial_read1;
input [16:0] cnt1;
begin
cle = 0;
ale = 0;
web = 1;
for ( i=0; i<cnt1; i = i+1)
begin
#26
reb = 0;
ceb = 0;
//reb = 0;
#50
reb = 1;
ceb = 1;
end
end
endtask
// Timing for serial read with ceb don't care
task serial_read2;
input [16:0] cnt2;
begin
cle = 0;
ale = 0;
web = 1;
for ( i=0; i<cnt2; i = i+1)
begin
#20
reb = 0;
#6
ceb = 0;
//reb = 0;
#50
reb = 1;
#6
ceb = 1;
//reb = 1;
end
end
endtask
// Timing for serial read with ceb don't care
task serial_read3;
input [16:0] cnt3;
begin
cle = 0;
ale = 0;
web = 1;
for ( i=0; i<cnt3; i = i+1)
begin
#20
ceb = 0;
#6
reb = 0;
#50
ceb = 1;
#6
reb = 1;
//reb = 1;
end
end
endtask
//******************************
// User Test Vector Here
//******************************
initial
begin
#`PWRUP
// This function is PRELOAD function and you can read external data(2blocks size=528Byte*16pages*2blocks=16896Bytes) from External_File.txt.
// If you don't want to use this operating, you have to remove this function.
cmd_latch(8'h00);
add_latch(8'h00);
add_latch(8'h00);
add_latch(8'h00);
#`TREAD
serial_read(16'h210); // Sequential read from the 1st block's 1st page.
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
ceb = 1'b1;
#1000
cmd_latch(8'h00);
add_latch(8'h00);
add_latch(8'h20);
add_latch(8'h00);
#`TREAD
serial_read(16'h210); // Sequential read from the 2nd block's 1st page.
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
#`TREAD
serial_read(16'h210);
ceb = 1'b1;
#10000
// ID Read
cmd_latch(8'h90);
add_latch(8'h00);
add_latch(8'h00);
#100
serial_read(16'h2);
#20000
// Block Erase
cmd_latch(8'h60);
add_latch(8'he0);
add_latch(8'h00);
cmd_latch(8'hD0);
#`TERASE
cmd_latch(8'h70); // Status Check Command
ceb = 1'b0;
serial_read(16'h1);
ceb = 1'b1;
#1000
// 1st Page Program
cmd_latch(8'h80);
add_latch(8'h00);
add_latch(8'he0);
add_latch(8'h00);
data_latch(10'h200,8'h10);
data_latch(10'h10,8'h90);
cmd_latch(8'h10);
#`TPROGRAM
cmd_latch(8'h70); //Status Check Command
ceb = 1'b0;
serial_read(16'h1);
ceb = 1'b1;
#1000
// 2nd Page program
cmd_latch(8'h80);
add_latch(8'h00);
add_latch(8'he1);
add_latch(8'h00);
data_latch1(10'h210,8'h20);
cmd_latch(8'h10);
#`TPROGRAM
cmd_latch(8'h70); //Status Check Command
ceb = 1'b0;
serial_read(16'h1);
ceb = 1'b1;
#1000
// Sequential Read
cmd_latch(8'h00);
add_latch(8'h00);
add_latch(8'he0);
add_latch(8'h00);
#`TREAD
serial_read(16'h20f);
#20
reb = 0;
#50
ceb = 1;
#50
reb = 1;
#40
#`TREAD
serial_read3(16'h210);
ceb = 1'b1;
#1000
// Read with ceb don't care
cmd_latch(8'h00);
add_latch(8'h00);
add_latch(8'he0);
add_latch(8'h00);
#`TREAD
ceb = 1;
reb = 1;
#20
ceb = 0;
reb = 0;
serial_read1(16'h210);
ceb = 1'b1;
#1000
// Read spare area
cmd_latch(8'h50);
add_latch(8'h00);
add_latch(8'he0);
add_latch(8'h00);
#`TREAD
serial_read(16'h10); //1Byte read
#`TREAD
serial_read1(16'h10);
ceb = 1'b1;
#1000
cmd_latch(8'h50);
add_latch(8'h01);
add_latch(8'he0);
add_latch(8'h00);
#`TREAD
serial_read1(16'h3); //3Byte read
ceb = 1'b1;
#1000
$finish;
end
endmodule