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

Subversion Repositories mem_ctrl

[/] [mem_ctrl/] [trunk/] [bench/] [verilog/] [160b3ver/] [t160b3b.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 test28F160B3B();
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("f160b3b.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'h01000);
144
        #200
145
        ReadData(`AddrSize'h02000);
146
        #200
147
        ReadData(`AddrSize'h03000);
148
        #200
149
        ReadData(`AddrSize'h04000);
150
        #200
151
        ReadData(`AddrSize'hE8000);
152
        #200
153
        ReadData(`AddrSize'hF0000);
154
        #200
155
        ReadData(`AddrSize'hF8000);
156
    $display("READ DATA, Loose Timing, toggle Addr");
157
        //Verify Reads (OE LOW)
158
        #200
159
        address = `AddrSize'h00F00;
160
        #200
161
        address = `AddrSize'h01F00;
162
        #200
163
        address = `AddrSize'h02F00;
164
        #200
165
        address = `AddrSize'h03FFF;
166
        #200
167
        address = `AddrSize'h04FFF;
168
        #200
169
        address = `AddrSize'hEFFFF;
170
        #200
171
        address = `AddrSize'hF4000;
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);  //LockBlock
179
        #200
180
        ProgramData(`AddrSize'h01000,   `MaxOutputs'h0001);  //LockBlock
181
        #200
182
        ProgramData(`AddrSize'h02000,   `MaxOutputs'h0002);
183
        #200
184
        ProgramData(`AddrSize'h03000,   `MaxOutputs'h0003);
185
        #200
186
        ProgramData(`AddrSize'h04000,   `MaxOutputs'h0004);
187
        #200
188
        ProgramData(`AddrSize'hE8000,   `MaxOutputs'h0036);
189
        #200
190
        ProgramData(`AddrSize'hF0000,   `MaxOutputs'h0037);
191
        #200
192
        ProgramData(`AddrSize'hF8000,   `MaxOutputs'h0038);
193
        #200
194
        ProgramData(`AddrSize'h00F00,   `MaxOutputs'h0005);  //LockBlock
195
        #200
196
        ProgramData(`AddrSize'h01F00,   `MaxOutputs'h0006);  //LockBlock
197
        #200
198
        ProgramData(`AddrSize'h02F00,   `MaxOutputs'h0007);
199
        #200
200
        ProgramData(`AddrSize'h03FFF,   `MaxOutputs'h0008);
201
        #200
202
        ProgramData2(`AddrSize'h04FFF,   `MaxOutputs'h0009);
203
        #200
204
        ProgramData2(`AddrSize'hEFFFF,   `MaxOutputs'h000A);
205
        #200
206
        ProgramData2(`AddrSize'hF4000,   `MaxOutputs'h000B);
207
        #200
208
        ProgramData2(`AddrSize'hFFFFF,   `MaxOutputs'h000C);
209
    $display("READ DATA, Loose Timing, toggle OE");
210
        #200
211
        SetReadMode;
212
        #200
213
        ReadData(`AddrSize'h0);
214
        #200
215
        ReadData(`AddrSize'h01000);
216
        #200
217
        ReadData(`AddrSize'h02000);
218
        #200
219
        ReadData(`AddrSize'h03000);
220
        #200
221
        ReadData(`AddrSize'h04000);
222
        #200
223
        ReadData(`AddrSize'hE8000);
224
        #200
225
        ReadData(`AddrSize'hF0000);
226
        #200
227
        ReadData(`AddrSize'hF8000);
228
    $display("READ DATA, Loose Timing, toggle Addr");
229
        //Verify Reads (OE LOW)
230
        #200
231
        address = `AddrSize'h00F00;
232
        #200
233
        address = `AddrSize'h01F00;
234
        #200
235
        address = `AddrSize'h02F00;
236
        #200
237
        address = `AddrSize'h03FFF;
238
        #200
239
        address = `AddrSize'h04FFF;
240
        #200
241
        address = `AddrSize'hEFFFF;
242
        #200
243
        address = `AddrSize'hF4000;
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'h00000,   `MaxOutputs'h005A);
254
        #200
255
        ProgramData(`AddrSize'h01000,   `MaxOutputs'h0001);
256
        #200
257
        ProgramData(`AddrSize'h00F00,   `MaxOutputs'h0005);
258
        #200
259
        ProgramData(`AddrSize'h01F00,   `MaxOutputs'h0006);
260
    $display("READ DATA, Loose Timing,  Toggle OE");
261
        #200
262
        SetReadMode;
263
        #200
264
        ReadData(`AddrSize'h00000);
265
        #200
266
        address = `AddrSize'h01000;
267
        #200
268
        address = `AddrSize'h00F00;
269
        #200
270
        address = `AddrSize'h01F00;
271
        #200
272
        oeb = `VIH;
273
    $display("WRITE SUSPEND TEST");
274
      begin:  WriteSuspend
275
        #200
276
        StartProgram(`AddrSize'h05000, `MaxOutputs'h5000);
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'h04FFF);
289
        #200
290
        ReadData(`AddrSize'hFFFFF);
291
        #200
292
        ReadData(`AddrSize'h05000);
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'h05001);
317
        #200
318
        ReadData(`AddrSize'h05000);
319
        #200
320
        ReadData(`AddrSize'hA0000);
321
        #200
322
        oeb = `VIH;
323
      end  //WriteSuspend
324
    $display("ERASE Block");
325
        #200
326
        EraseBlock(`AddrSize'h04F00);
327
    $display("READ DATA, Loose Timing");
328
        #300
329
        SetReadMode;
330
        #200
331
        ReadData(`AddrSize'h04000);
332
        #200
333
        address = `AddrSize'h03FFF;
334
        #200
335
        address = `AddrSize'h04FFF;
336
        #200
337
        oeb = `VIH;
338
    $display("ERASE Locked Block");
339
        #200
340
        wpb = `VIL;
341
        #500
342
        EraseBlock(`AddrSize'h01F00);
343
        #200
344
        wpb = `VIH;
345
    $display("READ DATA, Loose Timing");
346
        #300
347
        SetReadMode;
348
        #200
349
        ReadData(`AddrSize'h01000);
350
        #200
351
        address = `AddrSize'h01F00;
352
        #200
353
        oeb = `VIH;
354
        //Bad Erase Confirm
355
    $display("BAD Erase confirm test");
356
      begin: BadErase
357
        #200
358
        address = `AddrSize'hEA000;
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'hE8000);
398
        #200
399
        oeb = `VIH;
400
    $display("Erase Suspend test");
401
      begin: EraseSuspendTest
402
        #200
403
        StartErase(`AddrSize'hEA000);
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'h02000);
420
        #200
421
        ReadData(`AddrSize'hEFFFF);
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'hE8000);
446
        #200
447
        address = `AddrSize'h50000;
448
        #200
449
        address = `AddrSize'hEFFFF;
450
        #200
451
        oeb = `VIH;
452
      end // EraseSuspendTest
453
        #500
454
    $display("Embedded Suspend Mode");
455
      begin:  EraseSuspend_
456
        #100
457
        StartErase(`AddrSize'hF5000);
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'hF8000);
470
        #200
471
        oeb = `VIH;
472
        begin:  WriteSuspend_
473
          $display("EMBEDDED WRITE SUSPEND TEST");
474
          #200
475
          StartProgram(`AddrSize'h00000, `MaxOutputs'h00A5);
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'h01000);
488
          #200
489
          ReadData(`AddrSize'h00F00);
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'h00000);
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'h03000);
538
        #200
539
        address = `AddrSize'hF0000;
540
        #200
541
        address = `AddrSize'h03FFF;
542
        #200
543
        address = `AddrSize'hF4000;
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'hF8F00);
554
        #200
555
        vpp = 12000;
556
        #200
557
        SetReadMode;
558
        #200
559
        ReadData(`AddrSize'h33333);
560
        #200
561
        address = `AddrSize'hF8000;
562
        #200
563
        address = `AddrSize'hFFFFF;
564
        #200
565
        oeb = `VIH;
566
        #1000
567
        powerdown;
568
        #1000 $finish;
569
    end
570
 
571
always @(dq or address or ceb or rpb or oeb or web or wpb or vcc or vpp)
572
    begin
573
    $display(
574
        "%d Addr = %h, Data = %h, CEb=%b, RPb=%b, OEb=%b, WEb=%d, WPb=%b, vcc=%d, vpp = %d",
575
        $time, address, dq, ceb, rpb, oeb, web, wpb, vcc, vpp);
576
  end
577
 
578
task powerup;
579
  begin
580
    $display("  POWERUP TASK");
581
    rpb = `VIL;         //reset
582
    #200
583
    address = 0;
584
    #200
585
    web = `VIH;         //write enable high
586
    #200
587
    oeb = `VIH;         //output ts
588
    #200
589
    ceb = `VIH;         //disabled
590
    #200
591
    vcc = 3300;         //power up vcc
592
    #5000
593
    vpp = 12000;        //ramp up vpp
594
    #5000
595
    rpb = `VIH;         //out of reset
596
    #500
597
    wpb = `VIL;         //blocks locked
598
    #200
599
    oeb = `VIL;         //enable outputs
600
    #200
601
    ceb = `VIL;         //enable chip
602
  end
603
endtask
604
 
605
 
606
task powerdown;
607
  begin
608
    $display("  POWERDOWN TASK");
609
    address = 0;
610
    #200
611
    rpb = `VIL;     //reset
612
    #200
613
    oeb = `VIH;     //output ts
614
    #200
615
    web = `VIH;     //we high
616
    #200
617
    ceb = `VIH;     //disabled
618
    #200
619
    vpp = 0;        //power down vpp
620
    #5000
621
    vcc = 0;        //ramp down vcc
622
  end
623
endtask
624
 
625
 
626
task ReadData;
627
  input [`AddrSize-1:0] addr;
628
  begin
629
    $display("  READDATA TASK");
630
    oeb = `VIH;
631
    #200
632
    address = addr;
633
    #200
634
    oeb = `VIL;
635
  end
636
endtask
637
 
638
task SetReadMode;
639
  begin
640
    $display("  SETREADMODE TASK");
641
    oeb = `VIH;
642
    #200
643
    dq_reg = `ReadArrayCmd;
644
    #200
645
    web = `VIL;
646
    #200
647
    web = `VIH;
648
    #200
649
    dq_reg = `MaxOutputs'hz;
650
  end
651
endtask
652
 
653
task ReadID;
654
  begin
655
    $display("  READID TASK");
656
    oeb = `VIH;
657
    #200
658
    address = `AddrSize'h0;
659
    #200
660
    dq_reg = `ReadIDCmd;
661
    #200
662
    web = `VIL;
663
    #200
664
    web = `VIH;
665
    #200
666
    dq_reg = `MaxOutputs'hz;
667
    #200
668
    oeb = `VIL;
669
    #200
670
    address = `AddrSize'h1;
671
  end
672
endtask
673
 
674
 
675
task ReadCSRMode;
676
  begin
677
    $display("  READCSR MODE TASK");
678
    oeb = `VIH;
679
    #200
680
    dq_reg = `ReadCSRCmd;
681
    #200
682
    web = `VIL;
683
    #200
684
    web = `VIH;
685
    #200
686
    dq_reg = `MaxOutputs'hz;
687
    #200
688
    oeb = `VIL;
689
  end
690
endtask
691
 
692
task ClearCSRMode;
693
  begin
694
    $display("  CLEARCSRMODE TASK");
695
    oeb = `VIH;
696
    #200
697
    dq_reg = `ClearCSRCmd;
698
    #200
699
    web = `VIL;
700
    #200
701
    web = `VIH;
702
    #200
703
    dq_reg = `MaxOutputs'hz;
704
  end
705
endtask
706
 
707
 
708
task StartProgram;
709
  input [`AddrSize-1:0] addr;
710
  input [`MaxOutputs-1:0] data;
711
  begin
712
    $display("  STARTPROGRAM TASK");
713
    #200
714
    address = addr;
715
    #200
716
    dq_reg = `Program2Cmd;
717
    #200
718
    web = `VIL;
719
    #200
720
    web = `VIH;
721
    #200
722
    dq_reg = data;
723
    #200
724
    web = `VIL;
725
    #200
726
    web = `VIH;
727
    #200
728
    dq_reg = `MaxOutputs'hz;
729
  end
730
endtask
731
 
732
 
733
task ProgramData;
734
  input [`AddrSize-1:0] addr;
735
  input [`MaxOutputs-1:0] data;
736
  begin
737
    $display("  PROGRAMDATA TASK");
738
    StartProgram(addr, data);
739
    #200
740
    oeb = `VIL;
741
    #((`AC_ProgramTime_Word_27_12*`TimerPeriod_)-500)
742
    begin:  Poll
743
      forever
744
        begin
745
          oeb = `VIH;
746
          #200
747
          oeb = `VIL;
748
          #200
749
          if (dq[7] == `VIH)
750
            disable Poll;
751
        end //forever
752
    end //Poll
753
    #300
754
    ClearCSRMode;
755
    end
756
endtask
757
 
758
 
759
task StartProgram2;
760
  input [`AddrSize-1:0] addr;
761
  input [`MaxOutputs-1:0] data;
762
  begin
763
    $display("  STARTPROGRAM2 TASK");
764
    #200
765
    address = addr;
766
    #200
767
    dq_reg = `Program2Cmd;
768
    #200
769
    web = `VIL;
770
    #10
771
    ceb = `VIL;
772
    #200
773
    ceb = `VIH;
774
    #10
775
    web = `VIH;
776
    #200
777
    dq_reg = data;
778
    #200
779
    web = `VIL;
780
    #10
781
    ceb = `VIL;
782
    #200
783
    ceb = `VIH;
784
    #10
785
    web = `VIH;
786
    #200
787
    ceb = `VIL;
788
    dq_reg = `MaxOutputs'hz;
789
  end
790
endtask
791
 
792
 
793
task ProgramData2;
794
  input [`AddrSize-1:0] addr;
795
  input [`MaxOutputs-1:0] data;
796
  begin
797
    $display("  PROGRAMDATA2 TASK");
798
    ceb = `VIH;
799
    StartProgram2(addr, data);
800
    #200
801
    oeb = `VIL;
802
    #((`AC_ProgramTime_Word_27_12*`TimerPeriod_)-500)
803
    begin:  Poll
804
      forever
805
        begin
806
          oeb = `VIH;
807
          #200
808
          oeb = `VIL;
809
          #200
810
          if (dq[7] == `VIH)
811
            disable Poll;
812
        end //forever
813
    end //Poll
814
    #300
815
    ClearCSRMode;
816
  end
817
endtask
818
 
819
 
820
task StartErase;
821
  input [`AddrSize-1:0] BlockAddr;
822
  begin
823
    $display("  STARTERASE TASK");
824
    #200
825
    address = BlockAddr;
826
    #200
827
    dq_reg = `EraseBlockCmd;
828
    #200
829
    web = `VIL;
830
    #200
831
    web = `VIH;
832
    #200
833
    dq_reg = `ConfirmCmd;
834
    #200
835
    web = `VIL;
836
    #200
837
    web = `VIH;
838
    #200
839
    dq_reg = `MaxOutputs'hz;
840
  end
841
endtask
842
 
843
 
844
task EraseBlock;
845
  input [`AddrSize-1:0] BlockAddr;
846
  time EraseTime;
847
  begin
848
    $display("  ERASEBLOCK TASK");
849
    StartErase(BlockAddr);
850
    #200
851
    oeb = `VIL;
852
    if (BlockAddr < `AddrSize'h08000)
853
      EraseTime = ((`AC_EraseTime_Param_27_12*`TimerPeriod_)-5000);
854
    else
855
      EraseTime = ((`AC_EraseTime_Main_27_12*`TimerPeriod_)-5000);
856
    #EraseTime
857
    begin:  Poll
858
      forever
859
        begin
860
          oeb = `VIH;
861
          #1000
862
          oeb = `VIL;
863
          #1000
864
          if (dq[7] == `VIH)
865
            disable Poll;
866
        end //forever
867
    end //Poll
868
    #300
869
    ClearCSRMode;
870
  end
871
endtask
872
 
873
task Suspend;
874
  begin
875
    $display("  SUSPEND TASK");
876
    #200
877
    dq_reg = `SuspendCmd;
878
    #200
879
    web = `VIL;
880
    #200
881
    web = `VIH;
882
    #200
883
    dq_reg = `MaxOutputs'hz;
884
    #200
885
    oeb = `VIL;
886
    #3000
887
    begin:  Poll
888
      forever
889
        begin
890
          oeb = `VIH;
891
          #500
892
          oeb = `VIL;
893
          #500
894
          if (dq[7] == `VIH)
895
            disable Poll;
896
       end //forever
897
    end //Poll
898
    #300
899
    ClearCSRMode;
900
  end
901
endtask
902
 
903
task Resume;
904
  begin
905
    $display("  RESUME TASK");
906
    #200
907
    dq_reg = `ResumeCmd;
908
    #200
909
    web = `VIL;
910
    #200
911
    web = `VIH;
912
    #200
913
    dq_reg = `MaxOutputs'hz;
914
/*    #200
915
    oeb = `VIL;
916
    #(((`AC_EraseTime_Main_27_12/2)*`TimerPeriod_)-1000)
917
    begin:  Poll
918
      forever
919
        begin
920
          oeb = `VIH;
921
          #1000
922
          oeb = `VIL;
923
          #1000
924
          if (dq[7] == `VIH)
925
            disable Poll;
926
        end //forever
927
    end //Poll
928
    #300
929
    ClearCSRMode;
930
*/
931
  end
932
endtask
933
 
934
endmodule
935
 

powered by: WebSVN 2.1.0

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