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

Subversion Repositories mem_ctrl

[/] [mem_ctrl/] [trunk/] [bench/] [verilog/] [160b3ver/] [t160b3t.v] - Blame information for rev 28

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 rudi
/*
2
 INTEL DEVELOPER'S SOFTWARE LICENSE AGREEMENT
3
 
4
BY USING THIS SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE TERMS OF
5
THIS AGREEMENT.  DO NOT USE THE SOFTWARE UNTIL YOU HAVE CAREFULLY READ
6
AND AGREED TO THE FOLLOWING TERMS AND CONDITIONS.  IF YOU DO NOT AGREE
7
TO THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN THE SOFTWARE PACKAGE AND
8
ANY ACCOMPANYING ITEMS.
9
 
10
IF YOU USE THIS SOFTWARE, YOU WILL BE BOUND BY THE TERMS OF THIS
11
AGREEMENT
12
 
13
LICENSE: Intel Corporation ("Intel") grants you the non-exclusive right
14
to use the enclosed software program ("Software").  You will not use,
15
copy, modify, rent, sell or transfer the Software or any portion
16
thereof, except as provided in this Agreement.
17
 
18
System OEM Developers may:
19
1.      Copy the Software for support, backup or archival purposes;
20
2.      Install, use, or distribute Intel owned Software in object code
21
        only;
22
3.      Modify and/or use Software source code that Intel directly makes
23
        available to you as an OEM Developer;
24
4.      Install, use, modify, distribute, and/or make or have made
25
        derivatives ("Derivatives") of Intel owned Software under the
26
        terms and conditions in this Agreement, ONLY if you are a System
27
        OEM Developer and NOT an end-user.
28
 
29
RESTRICTIONS:
30
 
31
YOU WILL NOT:
32
1.      Copy the Software, in whole or in part, except as provided for
33
        in this Agreement;
34
2.      Decompile or reverse engineer any Software provided in object
35
        code format;
36
3.      Distribute any Software or Derivative code to any end-users,
37
        unless approved by Intel in a prior writing.
38
 
39
TRANSFER: You may transfer the Software to another OEM Developer if the
40
receiving party agrees to the terms of this Agreement at the sole risk
41
of any receiving party.
42
 
43
OWNERSHIP AND COPYRIGHT OF SOFTWARE: Title to the Software and all
44
copies thereof remain with Intel or its vendors.  The Software is
45
copyrighted and is protected by United States and international
46
copyright laws.  You will not remove the copyright notice from the
47
Software.  You agree to prevent any unauthorized copying of the
48
Software.
49
 
50
DERIVATIVE WORK: OEM Developers that make or have made Derivatives will
51
not be required to provide Intel with a copy of the source or object
52
code.  OEM Developers shall be authorized to use, market, sell, and/or
53
distribute Derivatives to other OEM Developers at their own risk and
54
expense. Title to Derivatives and all copies thereof shall be in the
55
particular OEM Developer creating the Derivative.  Such OEMs shall
56
remove the Intel copyright notice from all Derivatives if such notice is
57
contained in the Software source code.
58
 
59
DUAL MEDIA SOFTWARE: If the Software package contains multiple media,
60
you may only use the medium appropriate for your system.
61
 
62
WARRANTY: Intel warrants that it has the right to license you to use,
63
modify, or distribute the Software as provided in this Agreement. The
64
Software is provided "AS IS".  Intel makes no representations to
65
upgrade, maintain, or support the Software at any time. Intel warrants
66
that the media on which the Software is furnished will be free from
67
defects in material and workmanship for a period of one (1) year from
68
the date of purchase.  Upon return of such defective media, Intel's
69
entire liability and your exclusive remedy shall be the replacement of
70
the Software.
71
 
72
THE ABOVE WARRANTIES ARE THE ONLY WARRANTIES OF ANY KIND, EITHER EXPRESS
73
OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
74
PARTICULAR PURPOSE.
75
 
76
LIMITATION OF LIABILITY: NEITHER INTEL NOR ITS VENDORS OR AGENTS SHALL
77
BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
78
INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
79
CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
80
OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
81
 
82
TERMINATION OF THIS LICENSE: Intel reserves the right to conduct or have
83
conducted audits to verify your compliance with this Agreement.  Intel
84
may terminate this Agreement at any time if you are in breach of any of
85
its terms and conditions.  Upon termination, you will immediately
86
destroy, and certify in writing the destruction of, the Software or
87
return all copies of the Software and documentation to Intel.
88
 
89
U.S. GOVERNMENT RESTRICTED RIGHTS: The Software and documentation were
90
developed at private expense and are provided with "RESTRICTED RIGHTS".
91
Use, duplication or disclosure by the Government is subject to
92
restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq.
93
or its successor.
94
 
95
EXPORT LAWS: You agree that the distribution and export/re-export of the
96
Software is in compliance with the laws, regulations, orders or other
97
restrictions of the U.S. Export Administration Regulations.
98
 
99
APPLICABLE LAW: This Agreement is governed by the laws of the State of
100
California and the United States, including patent and copyright laws.
101
Any claim arising out of this Agreement will be brought in Santa Clara
102
County, California.
103
 
104
*/
105
 
106
`timescale   1ns/1ns
107
 
108
 
109
module test28F160B3T();
110
 
111
reg     [`AddrSize-1:0]  address;
112
 
113
reg     [31:0]  vcc,
114
                vpp;
115
 
116
reg             ceb,
117
                oeb,
118
                web,
119
                wpb,
120
                rpb;
121
 
122
reg    [`MaxOutputs-1:0]  dq_reg;
123
wire   [`MaxOutputs-1:0]  dq = dq_reg;
124
 
125
IntelAdvBoot IFlash (dq, address, ceb, oeb, web, rpb, wpb, vpp, vcc);
126
 
127
initial
128
  begin
129
//        $dumpfile("f160b3t.dmp");
130
//        $dumpoff;
131
//        $dumpvars(???,dq,address,ceb,oeb,web,rpb,wpb);
132
        dq_reg = `MaxOutputs'hz;
133
        powerup;
134
        ReadID;
135
        //Verify READS with loose timing (OE Toggling)
136
        #200
137
        SetReadMode;
138
        #200
139
    $display("READ DATA, Loose Timing, toggle OE");
140
        #200
141
        ReadData(`AddrSize'h0);
142
        #200
143
        ReadData(`AddrSize'h08000);
144
        #200
145
        ReadData(`AddrSize'h10000);
146
        #200
147
        ReadData(`AddrSize'hFB000);
148
        #200
149
        ReadData(`AddrSize'hFC000);
150
        #200
151
        ReadData(`AddrSize'hFD000);
152
        #200
153
        ReadData(`AddrSize'hFE000);
154
        #200
155
        ReadData(`AddrSize'hFF000);
156
    $display("READ DATA, Loose Timing, toggle Addr");
157
        //Verify Reads (OE LOW)
158
        #200
159
        address = `AddrSize'h07FFF;
160
        #200
161
        address = `AddrSize'h0A000;
162
        #200
163
        address = `AddrSize'h17FFF;
164
        #200
165
        address = `AddrSize'hFBFFF;
166
        #200
167
        address = `AddrSize'hFCFFF;
168
        #200
169
        address = `AddrSize'hFDF00;
170
        #200
171
        address = `AddrSize'hFEF00;
172
        #200
173
        address = `AddrSize'hFFFFF;
174
        #200
175
        oeb = `VIH;
176
    $display("PROGRAM DATA, Loose Timing, Boot Locked");
177
        #200
178
        ProgramData(`AddrSize'h00000,   `MaxOutputs'h0000);
179
        #200
180
        ProgramData(`AddrSize'h08000,   `MaxOutputs'h0001);
181
        #200
182
        ProgramData(`AddrSize'h10000,   `MaxOutputs'h0002);
183
        #200
184
        ProgramData(`AddrSize'hFB000,   `MaxOutputs'h0034);
185
        #200
186
        ProgramData(`AddrSize'hFC000,   `MaxOutputs'h0035);
187
        #200
188
        ProgramData(`AddrSize'hFD000,   `MaxOutputs'h0036);
189
        #200
190
        ProgramData(`AddrSize'hFE000,   `MaxOutputs'h0037);  //LockBlock
191
        #200
192
        ProgramData(`AddrSize'hFF000,   `MaxOutputs'h0038);  //LockBlock
193
        #200
194
        ProgramData(`AddrSize'h07FFF,   `MaxOutputs'h1001);
195
        #200
196
        ProgramData(`AddrSize'h0A000,   `MaxOutputs'h1000);
197
        #200
198
        ProgramData(`AddrSize'h17FFF,   `MaxOutputs'h2000);
199
        #200
200
        ProgramData(`AddrSize'hFBFFF,   `MaxOutputs'h3400);
201
        #200
202
        ProgramData2(`AddrSize'hFCFFF,   `MaxOutputs'h3500);
203
        #200
204
        ProgramData2(`AddrSize'hFDF00,   `MaxOutputs'h3600);
205
        #200
206
        ProgramData2(`AddrSize'hFEF00,   `MaxOutputs'h3700);  //LockBlock
207
        #200
208
        ProgramData2(`AddrSize'hFFFFF,   `MaxOutputs'h3800);  //LockBlock
209
    $display("READ DATA, Loose Timing, toggle OE");
210
        #200
211
        SetReadMode;
212
        #200
213
        ReadData(`AddrSize'h0);
214
        #200
215
        ReadData(`AddrSize'h08000);
216
        #200
217
        ReadData(`AddrSize'h10000);
218
        #200
219
        ReadData(`AddrSize'hFB000);
220
        #200
221
        ReadData(`AddrSize'hFC000);
222
        #200
223
        ReadData(`AddrSize'hFD000);
224
        #200
225
        ReadData(`AddrSize'hFE000);
226
        #200
227
        ReadData(`AddrSize'hFF000);
228
    $display("READ DATA, Loose Timing, toggle Addr");
229
        //Verify Reads (OE LOW)
230
        #200
231
        address = `AddrSize'h07FFF;
232
        #200
233
        address = `AddrSize'h0A000;
234
        #200
235
        address = `AddrSize'h17FFF;
236
        #200
237
        address = `AddrSize'hFBFFF;
238
        #200
239
        address = `AddrSize'hFCFFF;
240
        #200
241
        address = `AddrSize'hFDF00;
242
        #200
243
        address = `AddrSize'hFEF00;
244
        #200
245
        address = `AddrSize'hFFFFF;
246
        #200
247
        oeb = `VIH;
248
    $display("Unlock BOOT (WP#)");
249
        #200
250
        wpb = `VIH;      //UNLOCK
251
    $display("PROGRAM DATA, Boot Unlocked");
252
        #200
253
        ProgramData(`AddrSize'hFE000,   `MaxOutputs'h0037);
254
        #200
255
        ProgramData(`AddrSize'hFF000,   `MaxOutputs'h0038);
256
        #200
257
        ProgramData(`AddrSize'hFEF00,   `MaxOutputs'h3700);
258
        #200
259
        ProgramData(`AddrSize'hFFFFF,   `MaxOutputs'h3800);
260
    $display("READ DATA, Loose Timing,  Toggle OE");
261
        #200
262
        SetReadMode;
263
        #200
264
        ReadData(`AddrSize'hFE000);
265
        #200
266
        address = `AddrSize'hFF000;
267
        #200
268
        address = `AddrSize'hFEF00;
269
        #200
270
        address = `AddrSize'hFFFFF;
271
        #200
272
        oeb = `VIH;
273
    $display("WRITE SUSPEND TEST");
274
      begin:  WriteSuspend
275
        #200
276
        StartProgram(`AddrSize'hFA000, `MaxOutputs'h3300);
277
        #200
278
        oeb = `VIH;
279
        #200
280
        oeb = `VIL;
281
        #200
282
        oeb = `VIH;
283
        #(((`AC_ProgramTime_Word_27_12/2)*`TimerPeriod_)-1000)
284
        Suspend;
285
        #200
286
        SetReadMode;
287
        #200
288
        ReadData(`AddrSize'hF9FFF);
289
        #200
290
        ReadData(`AddrSize'hFFFFF);
291
        #200
292
        ReadData(`AddrSize'hFA000);
293
        #200
294
        oeb = `VIH;
295
        #200
296
        StartProgram(`AddrSize'hA0000, `MaxOutputs'hAAAA);
297
        #300
298
        Resume;
299
        #200
300
        oeb = `VIL;
301
        #(((`AC_ProgramTime_Word_27_12/2)*`TimerPeriod_)-1000)
302
        begin: Poll
303
          forever
304
            begin
305
              oeb = `VIH;
306
              #500
307
              oeb = `VIL;
308
              #500
309
              if (dq[7] == `VIH)
310
                disable Poll;
311
            end
312
        end
313
        #300
314
        SetReadMode;
315
        #200
316
        ReadData(`AddrSize'hFA001);
317
        #200
318
        ReadData(`AddrSize'hFA000);
319
        #200
320
        ReadData(`AddrSize'hA0000);
321
        #200
322
        oeb = `VIH;
323
      end  //WriteSuspend
324
    $display("ERASE Block");
325
        #200
326
        EraseBlock(`AddrSize'hFBF00);
327
    $display("READ DATA, Loose Timing");
328
        #300
329
        SetReadMode;
330
        #200
331
        ReadData(`AddrSize'hFB000);
332
        #200
333
        address = `AddrSize'hFCFFF;
334
        #200
335
        address = `AddrSize'hFBFFF;
336
        #200
337
        oeb = `VIH;
338
    $display("ERASE Locked Block");
339
        #200
340
        wpb = `VIL;
341
        #500
342
        EraseBlock(`AddrSize'hFE500);
343
        #200
344
        wpb = `VIH;
345
    $display("READ DATA, Loose Timing");
346
        #300
347
        SetReadMode;
348
        #200
349
        ReadData(`AddrSize'hFE000);
350
        #200
351
        address = `AddrSize'hFEF00;
352
        #200
353
        oeb = `VIH;
354
        //Bad Erase Confirm
355
    $display("BAD Erase confirm test");
356
      begin: BadErase
357
        #200
358
        address = `AddrSize'h04000;
359
        #200
360
        dq_reg = `EraseBlockCmd;
361
        #200
362
        web = `VIL;
363
        #200
364
        web = `VIH;
365
        #200
366
        dq_reg = `ReadArrayCmd;
367
        #200
368
        web = `VIL;
369
        #200
370
        web = `VIH;
371
        #200
372
        dq_reg = `MaxOutputs'hz;
373
        #200
374
        oeb = `VIL;
375
        #1000
376
        begin:  Poll
377
          forever
378
            begin
379
              oeb = `VIH;
380
              #1000
381
              oeb = `VIL;
382
              #1000
383
              if (dq[7] == `VIH)
384
                disable Poll;
385
            end //forever
386
        end //Poll
387
      end // BadErase
388
        #500
389
        ReadCSRMode;
390
        #500
391
        ClearCSRMode;
392
        #500
393
        ReadCSRMode;
394
        #500
395
        SetReadMode;
396
        #200
397
        ReadData(`AddrSize'h00000);
398
        #200
399
        oeb = `VIH;
400
    $display("Erase Suspend test");
401
      begin: EraseSuspendTest
402
        #200
403
        StartErase(`AddrSize'h04000);
404
        #1000
405
        oeb = `VIH;
406
        #200
407
        oeb = `VIL;
408
        #200
409
        oeb = `VIH;
410
        #(((`AC_EraseTime_Main_27_12/2)*`TimerPeriod_)-1000)
411
        Suspend;
412
        #200
413
        ReadCSRMode;
414
        #200
415
        SetReadMode;
416
        #200
417
        ReadData(`AddrSize'h00000);
418
        #200
419
        ReadData(`AddrSize'h08000);
420
        #200
421
        ReadData(`AddrSize'hFDF00);
422
        #200
423
        oeb = `VIH;
424
        #200
425
        ProgramData(`AddrSize'h50000,  `MaxOutputs'h0055);
426
        #1000
427
        Resume;
428
        #200
429
        oeb = `VIL;
430
        #(((`AC_EraseTime_Main_27_12/2)*`TimerPeriod_)-1000)
431
        begin: Poll
432
          forever
433
            begin
434
              oeb = `VIH;
435
              #500
436
              oeb = `VIL;
437
              #500
438
              if (dq[7] == `VIH)
439
                disable Poll;
440
            end
441
        end
442
        #300
443
        SetReadMode;
444
        #200
445
        ReadData(`AddrSize'h00000);
446
        #200
447
        address = `AddrSize'h50000;
448
        #200
449
        address = `AddrSize'h07FFF;
450
        #200
451
        oeb = `VIH;
452
      end // EraseSuspendTest
453
        #500
454
    $display("Embedded Suspend Mode");
455
      begin:  EraseSuspend_
456
        #100
457
        StartErase(`AddrSize'h0F000);
458
        #1000
459
        oeb = `VIH;
460
        #200
461
        oeb = `VIL;
462
        #200
463
        oeb = `VIH;
464
        #(((`AC_EraseTime_Main_27_12/2)*`TimerPeriod_)-1000)
465
        Suspend;
466
        #200
467
        SetReadMode;
468
        #200
469
        ReadData(`AddrSize'h10000);
470
        #200
471
        oeb = `VIH;
472
        begin:  WriteSuspend_
473
          $display("EMBEDDED WRITE SUSPEND TEST");
474
          #200
475
          StartProgram(`AddrSize'hFF000, `MaxOutputs'h3800);
476
          #200
477
          oeb = `VIH;
478
          #200
479
          oeb = `VIL;
480
          #200
481
          oeb = `VIH;
482
          #((`AC_ProgramTime_Word_27_12/2)*`TimerPeriod_)
483
          Suspend;
484
          #200
485
          SetReadMode;
486
          #200
487
          ReadData(`AddrSize'hFE000);
488
          #200
489
          ReadData(`AddrSize'hFFFFF);
490
          #200
491
          oeb = `VIH;
492
          #500
493
          Resume;  //Write Operation
494
          #200
495
          oeb = `VIL;
496
//          #500
497
          #(((`AC_ProgramTime_Word_27_12/2)*`TimerPeriod_)-2000)
498
          begin: Poll
499
            forever
500
              begin
501
                oeb = `VIH;
502
                #500
503
                oeb = `VIL;
504
                #500
505
                if (dq[7] == `VIH)
506
                  disable Poll;
507
              end
508
          end
509
          #300
510
          SetReadMode;
511
          #200
512
          ReadData(`AddrSize'hFF000);
513
          #200
514
          oeb = `VIH;
515
        end  //WriteSuspend_
516
        #300
517
        Resume;  //Erase Operation
518
        #200
519
        oeb = `VIL;
520
        #(((`AC_EraseTime_Main_27_12/2)*`TimerPeriod_)-1000)
521
        begin: Poll
522
          forever
523
            begin
524
              oeb = `VIH;
525
              #1000
526
              oeb = `VIL;
527
              #1000
528
              if (dq[7] == `VIH)
529
                disable Poll;
530
            end
531
        end
532
        #200
533
        ClearCSRMode;
534
        #300
535
        SetReadMode;
536
        #200
537
        ReadData(`AddrSize'hFD000);
538
        #200
539
        address = `AddrSize'h08000;
540
        #200
541
        address = `AddrSize'hFCFFF;
542
        #200
543
        address = `AddrSize'h0A000;
544
        #200
545
        oeb = `VIH;
546
      end  //EraseSuspend_
547
    $display("LOW Vpp OPERATION TEST");
548
        #200
549
        vpp =1300;
550
        #100
551
        ProgramData(`AddrSize'h33333, `MaxOutputs'h3333);
552
        #200
553
        EraseBlock(`AddrSize'h17000);
554
        #200
555
        vpp = 12000;
556
        #200
557
        SetReadMode;
558
        #200
559
        ReadData(`AddrSize'h33333);
560
        #200
561
        address = `AddrSize'h10000;
562
        #200
563
        address = `AddrSize'h17FFF;
564
        #200
565
        oeb = `VIH;
566
        #1000
567
        powerdown;
568
        #1000
569
        $finish;
570
    end
571
 
572
always @(dq or address or ceb or rpb or oeb or web or wpb or vcc or vpp)
573
    begin
574
    $display(
575
        "%d Addr = %h, Data = %h, CEb=%b, RPb=%b, OEb=%b, WEb=%d, WPb=%b, vcc=%d, vpp = %d",
576
        $time, address, dq, ceb, rpb, oeb, web, wpb, vcc, vpp);
577
  end
578
 
579
task powerup;
580
  begin
581
    $display("  POWERUP TASK");
582
    rpb = `VIL;         //reset
583
    #200
584
    address = 0;
585
    #200
586
    web = `VIH;         //write enable high
587
    #200
588
    oeb = `VIH;         //output ts
589
    #200
590
    ceb = `VIH;         //disabled
591
    #200
592
    vcc = 3300;         //power up vcc
593
    #5000
594
    vpp = 12000;        //ramp up vpp
595
    #5000
596
    rpb = `VIH;         //out of reset
597
    #500
598
    wpb = `VIL;         //blocks locked
599
    #200
600
    oeb = `VIL;         //enable outputs
601
    #200
602
    ceb = `VIL;         //enable chip
603
  end
604
endtask
605
 
606
 
607
task powerdown;
608
  begin
609
    $display("  POWERDOWN TASK");
610
    address = 0;
611
    #200
612
    rpb = `VIL;     //reset
613
    #200
614
    oeb = `VIH;     //output ts
615
    #200
616
    web = `VIH;     //we high
617
    #200
618
    ceb = `VIH;     //disabled
619
    #200
620
    vpp = 0;        //power down vpp
621
    #5000
622
    vcc = 0;        //ramp down vcc
623
  end
624
endtask
625
 
626
 
627
task ReadData;
628
  input [`AddrSize-1:0] addr;
629
  begin
630
    $display("  READDATA TASK");
631
    oeb = `VIH;
632
    #200
633
    address = addr;
634
    #200
635
    oeb = `VIL;
636
  end
637
endtask
638
 
639
task SetReadMode;
640
  begin
641
    $display("  SETREADMODE TASK");
642
    oeb = `VIH;
643
    #200
644
    dq_reg = `ReadArrayCmd;
645
    #200
646
    web = `VIL;
647
    #200
648
    web = `VIH;
649
    #200
650
    dq_reg = `MaxOutputs'hz;
651
  end
652
endtask
653
 
654
task ReadID;
655
  begin
656
    $display("  READID TASK");
657
    oeb = `VIH;
658
    #200
659
    address = `AddrSize'h0;
660
    #200
661
    dq_reg = `ReadIDCmd;
662
    #200
663
    web = `VIL;
664
    #200
665
    web = `VIH;
666
    #200
667
    dq_reg = `MaxOutputs'hz;
668
    #200
669
    oeb = `VIL;
670
    #200
671
    address = `AddrSize'h1;
672
  end
673
endtask
674
 
675
 
676
task ReadCSRMode;
677
  begin
678
    $display("  READCSR MODE TASK");
679
    oeb = `VIH;
680
    #200
681
    dq_reg = `ReadCSRCmd;
682
    #200
683
    web = `VIL;
684
    #200
685
    web = `VIH;
686
    #200
687
    dq_reg = `MaxOutputs'hz;
688
    #200
689
    oeb = `VIL;
690
  end
691
endtask
692
 
693
task ClearCSRMode;
694
  begin
695
    $display("  CLEARCSRMODE TASK");
696
    oeb = `VIH;
697
    #200
698
    dq_reg = `ClearCSRCmd;
699
    #200
700
    web = `VIL;
701
    #200
702
    web = `VIH;
703
    #200
704
    dq_reg = `MaxOutputs'hz;
705
  end
706
endtask
707
 
708
 
709
task StartProgram;
710
  input [`AddrSize-1:0] addr;
711
  input [`MaxOutputs-1:0] data;
712
  begin
713
    $display("  STARTPROGRAM TASK");
714
    #200
715
    address = addr;
716
    #200
717
    dq_reg = `Program2Cmd;
718
    #200
719
    web = `VIL;
720
    #200
721
    web = `VIH;
722
    #200
723
    dq_reg = data;
724
    #200
725
    web = `VIL;
726
    #200
727
    web = `VIH;
728
    #200
729
    dq_reg = `MaxOutputs'hz;
730
  end
731
endtask
732
 
733
 
734
task ProgramData;
735
  input [`AddrSize-1:0] addr;
736
  input [`MaxOutputs-1:0] data;
737
  begin
738
    $display("  PROGRAMDATA TASK");
739
    StartProgram(addr, data);
740
    #200
741
    oeb = `VIL;
742
    #((`AC_ProgramTime_Word_27_12*`TimerPeriod_)-500)
743
    begin:  Poll
744
      forever
745
        begin
746
          oeb = `VIH;
747
          #200
748
          oeb = `VIL;
749
          #200
750
          if (dq[7] == `VIH)
751
            disable Poll;
752
        end //forever
753
    end //Poll
754
    #300
755
    ClearCSRMode;
756
    end
757
endtask
758
 
759
 
760
task StartProgram2;
761
  input [`AddrSize-1:0] addr;
762
  input [`MaxOutputs-1:0] data;
763
  begin
764
    $display("  STARTPROGRAM2 TASK");
765
    #200
766
    address = addr;
767
    #200
768
    dq_reg = `Program2Cmd;
769
    #200
770
    web = `VIL;
771
    #10
772
    ceb = `VIL;
773
    #200
774
    ceb = `VIH;
775
    #10
776
    web = `VIH;
777
    #200
778
    dq_reg = data;
779
    #200
780
    web = `VIL;
781
    #10
782
    ceb = `VIL;
783
    #200
784
    ceb = `VIH;
785
    #10
786
    web = `VIH;
787
    #200
788
    ceb = `VIL;
789
    dq_reg = `MaxOutputs'hz;
790
  end
791
endtask
792
 
793
 
794
task ProgramData2;
795
  input [`AddrSize-1:0] addr;
796
  input [`MaxOutputs-1:0] data;
797
  begin
798
    $display("  PROGRAMDATA2 TASK");
799
    ceb = `VIH;
800
    StartProgram2(addr, data);
801
    #200
802
    oeb = `VIL;
803
    #((`AC_ProgramTime_Word_27_12*`TimerPeriod_)-500)
804
    begin:  Poll
805
      forever
806
        begin
807
          oeb = `VIH;
808
          #200
809
          oeb = `VIL;
810
          #200
811
          if (dq[7] == `VIH)
812
            disable Poll;
813
        end //forever
814
    end //Poll
815
    #300
816
    ClearCSRMode;
817
  end
818
endtask
819
 
820
 
821
task StartErase;
822
  input [`AddrSize-1:0] BlockAddr;
823
  begin
824
    $display("  STARTERASE TASK");
825
    #200
826
    address = BlockAddr;
827
    #200
828
    dq_reg = `EraseBlockCmd;
829
    #200
830
    web = `VIL;
831
    #200
832
    web = `VIH;
833
    #200
834
    dq_reg = `ConfirmCmd;
835
    #200
836
    web = `VIL;
837
    #200
838
    web = `VIH;
839
    #200
840
    dq_reg = `MaxOutputs'hz;
841
  end
842
endtask
843
 
844
 
845
task EraseBlock;
846
  input [`AddrSize-1:0] BlockAddr;
847
  time EraseTime;
848
  begin
849
    $display("  ERASEBLOCK TASK");
850
    StartErase(BlockAddr);
851
    #200
852
    oeb = `VIL;
853
    if (BlockAddr < `AddrSize'h08000)
854
      EraseTime = ((`AC_EraseTime_Param_27_12*`TimerPeriod_)-5000);
855
    else
856
      EraseTime = ((`AC_EraseTime_Main_27_12*`TimerPeriod_)-5000);
857
    #EraseTime
858
    begin:  Poll
859
      forever
860
        begin
861
          oeb = `VIH;
862
          #1000
863
          oeb = `VIL;
864
          #1000
865
          if (dq[7] == `VIH)
866
            disable Poll;
867
        end //forever
868
    end //Poll
869
    #300
870
    ClearCSRMode;
871
  end
872
endtask
873
 
874
task Suspend;
875
  begin
876
    $display("  SUSPEND TASK");
877
    #200
878
    dq_reg = `SuspendCmd;
879
    #200
880
    web = `VIL;
881
    #200
882
    web = `VIH;
883
    #200
884
    dq_reg = `MaxOutputs'hz;
885
    #200
886
    oeb = `VIL;
887
    #3000
888
    begin:  Poll
889
      forever
890
        begin
891
          oeb = `VIH;
892
          #500
893
          oeb = `VIL;
894
          #500
895
          if (dq[7] == `VIH)
896
            disable Poll;
897
       end //forever
898
    end //Poll
899
    #300
900
    ClearCSRMode;
901
  end
902
endtask
903
 
904
task Resume;
905
  begin
906
    $display("  RESUME TASK");
907
    #200
908
    dq_reg = `ResumeCmd;
909
    #200
910
    web = `VIL;
911
    #200
912
    web = `VIH;
913
    #200
914
    dq_reg = `MaxOutputs'hz;
915
/*    #200
916
    oeb = `VIL;
917
    #(((`AC_EraseTime_Main_27_12/2)*`TimerPeriod_)-1000)
918
    begin:  Poll
919
      forever
920
        begin
921
          oeb = `VIH;
922
          #1000
923
          oeb = `VIL;
924
          #1000
925
          if (dq[7] == `VIH)
926
            disable Poll;
927
        end //forever
928
    end //Poll
929
    #300
930
    ClearCSRMode;
931
*/
932
  end
933
endtask
934
 
935
endmodule
936
 

powered by: WebSVN 2.1.0

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