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

Subversion Repositories sdr_ctrl

[/] [sdr_ctrl/] [trunk/] [verif/] [model/] [mt48lc8m16a2.v] - Blame information for rev 29

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

Line No. Rev Author Line
1 17 dinesha
/****************************************************************************************
2
*
3
*    File Name:  MT48LC8M16A2.V
4
*      Version:  0.0f
5
*         Date:  July 8th, 1999
6
*        Model:  BUS Functional
7
*    Simulator:  Model Technology (PC version 5.2e PE)
8
*
9
* Dependencies:  None
10
*
11
*       Author:  Son P. Huynh
12
*        Email:  sphuynh@micron.com
13
*        Phone:  (208) 368-3825
14
*      Company:  Micron Technology, Inc.
15
*        Model:  MT48LC8M16A2 (2Meg x 16 x 4 Banks)
16
*
17
*  Description:  Micron 128Mb SDRAM Verilog model
18
*
19
*   Limitation:  - Doesn't check for 4096 cycle refresh
20
*
21
*         Note:  - Set simulator resolution to "ps" accuracy
22
*                - Set Debug = 0 to disable $display messages
23
*
24
*   Disclaimer:  THESE DESIGNS ARE PROVIDED "AS IS" WITH NO WARRANTY
25
*                WHATSOEVER AND MICRON SPECIFICALLY DISCLAIMS ANY
26
*                IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
27
*                A PARTICULAR PURPOSE, OR AGAINST INFRINGEMENT.
28
*
29
*                Copyright © 1998 Micron Semiconductor Products, Inc.
30
*                All rights researved
31
*
32
* Rev   Author          Phone         Date        Changes
33
* ----  ----------------------------  ----------  ---------------------------------------
34
* 0.0f  Son Huynh       208-368-3825  07/08/1999  - Fix tWR = 1 Clk + 7.5 ns (Auto)
35
*       Micron Technology Inc.                    - Fix tWR = 15 ns (Manual)
36
*                                                 - Fix tRP (Autoprecharge to AutoRefresh)
37
*
38
* 0.0a  Son Huynh       208-368-3825  05/13/1998  - First Release (from 64Mb rev 0.0e)
39
*       Micron Technology Inc.
40
****************************************************************************************/
41
 
42
`timescale 1ns / 100ps
43
 
44
module mt48lc8m16a2 (Dq, Addr, Ba, Clk, Cke, Cs_n, Ras_n, Cas_n, We_n, Dqm);
45
 
46
    parameter addr_bits =      12;
47
    parameter data_bits =      16;
48
    parameter col_bits  =       9;
49
    parameter mem_sizes = 2097151;                                  // 2 Meg
50
 
51
    inout     [data_bits - 1 : 0] Dq;
52
    input     [addr_bits - 1 : 0] Addr;
53
    input                 [1 : 0] Ba;
54
    input                         Clk;
55
    input                         Cke;
56
    input                         Cs_n;
57
    input                         Ras_n;
58
    input                         Cas_n;
59
    input                         We_n;
60
    input                 [1 : 0] Dqm;
61
 
62
    reg       [data_bits - 1 : 0] Bank0 [0 : mem_sizes];
63
    reg       [data_bits - 1 : 0] Bank1 [0 : mem_sizes];
64
    reg       [data_bits - 1 : 0] Bank2 [0 : mem_sizes];
65
    reg       [data_bits - 1 : 0] Bank3 [0 : mem_sizes];
66
 
67
    reg                   [1 : 0] Bank_addr [0 : 3];                // Bank Address Pipeline
68
    reg        [col_bits - 1 : 0] Col_addr [0 : 3];                 // Column Address Pipeline
69
    reg                   [3 : 0] Command [0 : 3];                  // Command Operation Pipeline
70
    reg                   [1 : 0] Dqm_reg0, Dqm_reg1;               // DQM Operation Pipeline
71
    reg       [addr_bits - 1 : 0] B0_row_addr, B1_row_addr, B2_row_addr, B3_row_addr;
72
 
73
    reg       [addr_bits - 1 : 0] Mode_reg;
74
    reg       [data_bits - 1 : 0] Dq_reg, Dq_dqm;
75
    reg        [col_bits - 1 : 0] Col_temp, Burst_counter;
76
 
77
    reg                           Act_b0, Act_b1, Act_b2, Act_b3;   // Bank Activate
78
    reg                           Pc_b0, Pc_b1, Pc_b2, Pc_b3;       // Bank Precharge
79
 
80
    reg                   [1 : 0] Bank_precharge     [0 : 3];       // Precharge Command
81
    reg                           A10_precharge      [0 : 3];       // Addr[10] = 1 (All banks)
82
    reg                           Auto_precharge     [0 : 3];       // RW AutoPrecharge (Bank)
83
    reg                           Read_precharge     [0 : 3];       // R  AutoPrecharge
84
    reg                           Write_precharge    [0 : 3];       //  W AutoPrecharge
85
    integer                       Count_precharge    [0 : 3];       // RW AutoPrecharge (Counter)
86
    reg                           RW_interrupt_read  [0 : 3];       // RW Interrupt Read with Auto Precharge
87
    reg                           RW_interrupt_write [0 : 3];       // RW Interrupt Write with Auto Precharge
88
 
89
    reg                           Data_in_enable;
90
    reg                           Data_out_enable;
91
 
92
    reg                   [1 : 0] Bank, Previous_bank;
93
    reg       [addr_bits - 1 : 0] Row;
94
    reg        [col_bits - 1 : 0] Col, Col_brst;
95
 
96
    // Internal system clock
97
    reg                           CkeZ, Sys_clk;
98
 
99
    // Commands Decode
100
    wire      Active_enable    = ~Cs_n & ~Ras_n &  Cas_n &  We_n;
101
    wire      Aref_enable      = ~Cs_n & ~Ras_n & ~Cas_n &  We_n;
102
    wire      Burst_term       = ~Cs_n &  Ras_n &  Cas_n & ~We_n;
103
    wire      Mode_reg_enable  = ~Cs_n & ~Ras_n & ~Cas_n & ~We_n;
104
    wire      Prech_enable     = ~Cs_n & ~Ras_n &  Cas_n & ~We_n;
105
    wire      Read_enable      = ~Cs_n &  Ras_n & ~Cas_n &  We_n;
106
    wire      Write_enable     = ~Cs_n &  Ras_n & ~Cas_n & ~We_n;
107
 
108
    // Burst Length Decode
109
    wire      Burst_length_1   = ~Mode_reg[2] & ~Mode_reg[1] & ~Mode_reg[0];
110
    wire      Burst_length_2   = ~Mode_reg[2] & ~Mode_reg[1] &  Mode_reg[0];
111
    wire      Burst_length_4   = ~Mode_reg[2] &  Mode_reg[1] & ~Mode_reg[0];
112
    wire      Burst_length_8   = ~Mode_reg[2] &  Mode_reg[1] &  Mode_reg[0];
113
 
114
    // CAS Latency Decode
115
    wire      Cas_latency_2    = ~Mode_reg[6] &  Mode_reg[5] & ~Mode_reg[4];
116
    wire      Cas_latency_3    = ~Mode_reg[6] &  Mode_reg[5] &  Mode_reg[4];
117
 
118
    // Write Burst Mode
119
    wire      Write_burst_mode = Mode_reg[9];
120
 
121
    reg       Debug;                         // Debug messages : 1 = On
122
    wire      Dq_chk           = Sys_clk & Data_in_enable;      // Check setup/hold time for DQ
123
 
124
    assign    Dq               = Dq_reg;                        // DQ buffer
125
 
126
    // Commands Operation
127
    `define   ACT       0
128
    `define   NOP       1
129
    `define   READ      2
130
    `define   READ_A    3
131
    `define   WRITE     4
132
    `define   WRITE_A   5
133
    `define   PRECH     6
134
    `define   A_REF     7
135
    `define   BST       8
136
    `define   LMR       9
137
 
138
    // Timing Parameters for -75 (PC133) and CAS Latency = 2
139
    parameter tAC  =   6.0;
140
    parameter tHZ  =   7.0;
141
    parameter tOH  =   2.7;
142
    parameter tMRD =   2.0;     // 2 Clk Cycles
143
    parameter tRAS =  44.0;
144
    parameter tRC  =  66.0;
145
    parameter tRCD =  20.0;
146
    parameter tRP  =  20.0;
147
    parameter tRRD =  15.0;
148
    parameter tWRa =   7.5;     // A2 Version - Auto precharge mode only (1 Clk + 7.5 ns)
149
    parameter tWRp =  15.0;     // A2 Version - Precharge mode only (15 ns)
150
 
151
    // Timing Check variable
152
    integer   MRD_chk;
153
    integer   WR_counter [0 : 3];
154
    time      WR_chk [0 : 3];
155
    time      RC_chk, RRD_chk;
156
    time      RAS_chk0, RAS_chk1, RAS_chk2, RAS_chk3;
157
    time      RCD_chk0, RCD_chk1, RCD_chk2, RCD_chk3;
158
    time      RP_chk0, RP_chk1, RP_chk2, RP_chk3;
159
 
160
    initial begin
161
       Debug = 1'b0;
162
 
163
        Dq_reg = {data_bits{1'bz}};
164
        {Data_in_enable, Data_out_enable} = 0;
165
        {Act_b0, Act_b1, Act_b2, Act_b3} = 4'b0000;
166
        {Pc_b0, Pc_b1, Pc_b2, Pc_b3} = 4'b0000;
167
        {WR_chk[0], WR_chk[1], WR_chk[2], WR_chk[3]} = 0;
168
        {WR_counter[0], WR_counter[1], WR_counter[2], WR_counter[3]} = 0;
169
        {RW_interrupt_read[0], RW_interrupt_read[1], RW_interrupt_read[2], RW_interrupt_read[3]} = 0;
170
        {RW_interrupt_write[0], RW_interrupt_write[1], RW_interrupt_write[2], RW_interrupt_write[3]} = 0;
171
        {MRD_chk, RC_chk, RRD_chk} = 0;
172
        {RAS_chk0, RAS_chk1, RAS_chk2, RAS_chk3} = 0;
173
        {RCD_chk0, RCD_chk1, RCD_chk2, RCD_chk3} = 0;
174
        {RP_chk0, RP_chk1, RP_chk2, RP_chk3} = 0;
175
        $timeformat (-9, 0, " ns", 12);
176
        //$readmemh("bank0.txt", Bank0);
177
        //$readmemh("bank1.txt", Bank1);
178
        //$readmemh("bank2.txt", Bank2);
179
        //$readmemh("bank3.txt", Bank3);
180
    end
181
 
182
    // System clock generator
183
    always begin
184
        @ (posedge Clk) begin
185
            Sys_clk = CkeZ;
186
            CkeZ = Cke;
187
        end
188
        @ (negedge Clk) begin
189
            Sys_clk = 1'b0;
190
        end
191
    end
192
 
193
    always @ (posedge Sys_clk) begin
194
        // Internal Commamd Pipelined
195
        Command[0] = Command[1];
196
        Command[1] = Command[2];
197
        Command[2] = Command[3];
198
        Command[3] = `NOP;
199
 
200
        Col_addr[0] = Col_addr[1];
201
        Col_addr[1] = Col_addr[2];
202
        Col_addr[2] = Col_addr[3];
203
        Col_addr[3] = {col_bits{1'b0}};
204
 
205
        Bank_addr[0] = Bank_addr[1];
206
        Bank_addr[1] = Bank_addr[2];
207
        Bank_addr[2] = Bank_addr[3];
208
        Bank_addr[3] = 2'b0;
209
 
210
        Bank_precharge[0] = Bank_precharge[1];
211
        Bank_precharge[1] = Bank_precharge[2];
212
        Bank_precharge[2] = Bank_precharge[3];
213
        Bank_precharge[3] = 2'b0;
214
 
215
        A10_precharge[0] = A10_precharge[1];
216
        A10_precharge[1] = A10_precharge[2];
217
        A10_precharge[2] = A10_precharge[3];
218
        A10_precharge[3] = 1'b0;
219
 
220
        // Dqm pipeline for Read
221
        Dqm_reg0 = Dqm_reg1;
222
        Dqm_reg1 = Dqm;
223
 
224
        // Read or Write with Auto Precharge Counter
225
        if (Auto_precharge[0] == 1'b1) begin
226
            Count_precharge[0] = Count_precharge[0] + 1;
227
        end
228
        if (Auto_precharge[1] == 1'b1) begin
229
            Count_precharge[1] = Count_precharge[1] + 1;
230
        end
231
        if (Auto_precharge[2] == 1'b1) begin
232
            Count_precharge[2] = Count_precharge[2] + 1;
233
        end
234
        if (Auto_precharge[3] == 1'b1) begin
235
            Count_precharge[3] = Count_precharge[3] + 1;
236
        end
237
 
238
        // tMRD Counter
239
        MRD_chk = MRD_chk + 1;
240
 
241
        // tWR Counter for Write
242
        WR_counter[0] = WR_counter[0] + 1;
243
        WR_counter[1] = WR_counter[1] + 1;
244
        WR_counter[2] = WR_counter[2] + 1;
245
        WR_counter[3] = WR_counter[3] + 1;
246
 
247
        // Auto Refresh
248
        if (Aref_enable == 1'b1) begin
249
            if (Debug) $display ("at time %t AREF : Auto Refresh", $time);
250
            // Auto Refresh to Auto Refresh
251
            if ($time - RC_chk < tRC) begin
252
               //->tb.test_control.error_detected;
253
                $display ("at time %t ERROR: tRC violation during Auto Refresh", $time);
254
            end
255
            // Precharge to Auto Refresh
256
            if ($time - RP_chk0 < tRP || $time - RP_chk1 < tRP || $time - RP_chk2 < tRP || $time - RP_chk3 < tRP) begin
257
               //->tb.test_control.error_detected;
258
                $display ("at time %t ERROR: tRP violation during Auto Refresh", $time);
259
            end
260
            // Precharge to Refresh
261
            if (Pc_b0 == 1'b0 || Pc_b1 == 1'b0 || Pc_b2 == 1'b0 || Pc_b3 == 1'b0) begin
262
               //->tb.test_control.error_detected;
263
                $display ("at time %t ERROR: All banks must be Precharge before Auto Refresh", $time);
264
            end
265
            // Record Current tRC time
266
            RC_chk = $time;
267
        end
268
 
269
        // Load Mode Register
270
        if (Mode_reg_enable == 1'b1) begin
271
            // Decode CAS Latency, Burst Length, Burst Type, and Write Burst Mode
272
            if (Pc_b0 == 1'b1 && Pc_b1 == 1'b1 && Pc_b2 == 1'b1 && Pc_b3 == 1'b1) begin
273
                Mode_reg = Addr;
274
                if (Debug) begin
275
                    $display ("at time %t LMR  : Load Mode Register", $time);
276
                    // CAS Latency
277
                    if (Addr[6 : 4] == 3'b010)
278
                        $display ("                            CAS Latency      = 2");
279
                    else if (Addr[6 : 4] == 3'b011)
280
                        $display ("                            CAS Latency      = 3");
281
                    else
282
                        $display ("                            CAS Latency      = Reserved");
283
                    // Burst Length
284
                    if (Addr[2 : 0] == 3'b000)
285
                        $display ("                            Burst Length     = 1");
286
                    else if (Addr[2 : 0] == 3'b001)
287
                        $display ("                            Burst Length     = 2");
288
                    else if (Addr[2 : 0] == 3'b010)
289
                        $display ("                            Burst Length     = 4");
290
                    else if (Addr[2 : 0] == 3'b011)
291
                        $display ("                            Burst Length     = 8");
292
                    else if (Addr[3 : 0] == 4'b0111)
293
                        $display ("                            Burst Length     = Full");
294
                    else
295
                        $display ("                            Burst Length     = Reserved");
296
                    // Burst Type
297
                    if (Addr[3] == 1'b0)
298
                        $display ("                            Burst Type       = Sequential");
299
                    else if (Addr[3] == 1'b1)
300
                        $display ("                            Burst Type       = Interleaved");
301
                    else
302
                        $display ("                            Burst Type       = Reserved");
303
                    // Write Burst Mode
304
                    if (Addr[9] == 1'b0)
305
                        $display ("                            Write Burst Mode = Programmed Burst Length");
306
                    else if (Addr[9] == 1'b1)
307
                        $display ("                            Write Burst Mode = Single Location Access");
308
                    else
309
                        $display ("                            Write Burst Mode = Reserved");
310
                end
311
            end else begin
312
 
313
               //->tb.test_control.error_detected;
314
                $display ("at time %t ERROR: all banks must be Precharge before Load Mode Register", $time);
315
            end
316
            // REF to LMR
317
            if ($time - RC_chk < tRC) begin
318
 
319
               //->tb.test_control.error_detected;
320
                $display ("at time %t ERROR: tRC violation during Load Mode Register", $time);
321
            end
322
            // LMR to LMR
323
            if (MRD_chk < tMRD) begin
324
 
325
               //->tb.test_control.error_detected;
326
                $display ("at time %t ERROR: tMRD violation during Load Mode Register", $time);
327
            end
328
            MRD_chk = 0;
329
        end
330
 
331
        // Active Block (Latch Bank Address and Row Address)
332
        if (Active_enable == 1'b1) begin
333
            if (Ba == 2'b00 && Pc_b0 == 1'b1) begin
334
                {Act_b0, Pc_b0} = 2'b10;
335
                B0_row_addr = Addr [addr_bits - 1 : 0];
336
                RCD_chk0 = $time;
337
                RAS_chk0 = $time;
338
                if (Debug) $display ("at time %t ACT  : Bank = 0 Row = %d", $time, Addr);
339
                // Precharge to Activate Bank 0
340
                if ($time - RP_chk0 < tRP) begin
341
 
342
                   //->tb.test_control.error_detected;
343
                   $display ("at time %t ERROR: tRP violation during Activate bank 0", $time);
344
                end
345
            end else if (Ba == 2'b01 && Pc_b1 == 1'b1) begin
346
                {Act_b1, Pc_b1} = 2'b10;
347
                B1_row_addr = Addr [addr_bits - 1 : 0];
348
                RCD_chk1 = $time;
349
                RAS_chk1 = $time;
350
                if (Debug) $display ("at time %t ACT  : Bank = 1 Row = %d", $time, Addr);
351
                // Precharge to Activate Bank 1
352
                if ($time - RP_chk1 < tRP) begin
353
 
354
                   //->tb.test_control.error_detected;
355
                    $display ("at time %t ERROR: tRP violation during Activate bank 1", $time);
356
                end
357
            end else if (Ba == 2'b10 && Pc_b2 == 1'b1) begin
358
                {Act_b2, Pc_b2} = 2'b10;
359
                B2_row_addr = Addr [addr_bits - 1 : 0];
360
                RCD_chk2 = $time;
361
                RAS_chk2 = $time;
362
                if (Debug) $display ("at time %t ACT  : Bank = 2 Row = %d", $time, Addr);
363
                // Precharge to Activate Bank 2
364
                if ($time - RP_chk2 < tRP) begin
365
 
366
                   //->tb.test_control.error_detected;
367
                    $display ("at time %t ERROR: tRP violation during Activate bank 2", $time);
368
                end
369
            end else if (Ba == 2'b11 && Pc_b3 == 1'b1) begin
370
                {Act_b3, Pc_b3} = 2'b10;
371
                B3_row_addr = Addr [addr_bits - 1 : 0];
372
                RCD_chk3 = $time;
373
                RAS_chk3 = $time;
374
                if (Debug) $display ("at time %t ACT  : Bank = 3 Row = %d", $time, Addr);
375
                // Precharge to Activate Bank 3
376
                if ($time - RP_chk3 < tRP) begin
377
 
378
                   //->tb.test_control.error_detected;
379
                    $display ("at time %t ERROR: tRP violation during Activate bank 3", $time);
380
                end
381
            end else if (Ba == 2'b00 && Pc_b0 == 1'b0) begin
382
 
383
               //->tb.test_control.error_detected;
384
                $display ("at time %t ERROR: Bank 0 is not Precharged.", $time);
385
            end else if (Ba == 2'b01 && Pc_b1 == 1'b0) begin
386
 
387
               //->tb.test_control.error_detected;
388
                $display ("at time %t ERROR: Bank 1 is not Precharged.", $time);
389
            end else if (Ba == 2'b10 && Pc_b2 == 1'b0) begin
390
 
391
               //->tb.test_control.error_detected;
392
                $display ("at time %t ERROR: Bank 2 is not Precharged.", $time);
393
            end else if (Ba == 2'b11 && Pc_b3 == 1'b0) begin
394
 
395
               //->tb.test_control.error_detected;
396
                $display ("at time %t ERROR: Bank 3 is not Precharged.", $time);
397
            end
398
            // Active Bank A to Active Bank B
399
            if ((Previous_bank != Ba) && ($time - RRD_chk < tRRD)) begin
400
 
401
               //->tb.test_control.error_detected;
402
                $display ("at time %t ERROR: tRRD violation during Activate bank = %d", $time, Ba);
403
            end
404
            // Load Mode Register to Active
405
            if (MRD_chk < tMRD ) begin
406
 
407
               //->tb.test_control.error_detected;
408
                $display ("at time %t ERROR: tMRD violation during Activate bank = %d", $time, Ba);
409
            end
410
            // Auto Refresh to Activate
411
            if ($time - RC_chk < tRC) begin
412
 
413
               //->tb.test_control.error_detected;
414
                $display ("at time %t ERROR: tRC violation during Activate bank = %d", $time, Ba);
415
            end
416
            // Record variables for checking violation
417
            RRD_chk = $time;
418
            Previous_bank = Ba;
419
        end
420
 
421
        // Precharge Block
422
        if (Prech_enable == 1'b1) begin
423
            if (Addr[10] == 1'b1) begin
424
                {Pc_b0, Pc_b1, Pc_b2, Pc_b3} = 4'b1111;
425
                {Act_b0, Act_b1, Act_b2, Act_b3} = 4'b0000;
426
                RP_chk0 = $time;
427
                RP_chk1 = $time;
428
                RP_chk2 = $time;
429
                RP_chk3 = $time;
430
                if (Debug) $display ("at time %t PRE  : Bank = ALL",$time);
431
                // Activate to Precharge all banks
432
                if (($time - RAS_chk0 < tRAS) || ($time - RAS_chk1 < tRAS) ||
433
                    ($time - RAS_chk2 < tRAS) || ($time - RAS_chk3 < tRAS)) begin
434
 
435
                   //->tb.test_control.error_detected;
436
                    $display ("at time %t ERROR: tRAS violation during Precharge all bank", $time);
437
                end
438
                // tWR violation check for write
439
                if (($time - WR_chk[0] < tWRp) || ($time - WR_chk[1] < tWRp) ||
440
                    ($time - WR_chk[2] < tWRp) || ($time - WR_chk[3] < tWRp)) begin
441
 
442
                   //->tb.test_control.error_detected;
443
                    $display ("at time %t ERROR: tWR violation during Precharge all bank", $time);
444
                end
445
            end else if (Addr[10] == 1'b0) begin
446
                if (Ba == 2'b00) begin
447
                    {Pc_b0, Act_b0} = 2'b10;
448
                    RP_chk0 = $time;
449
                    if (Debug) $display ("at time %t PRE  : Bank = 0",$time);
450
                    // Activate to Precharge Bank 0
451
                    if ($time - RAS_chk0 < tRAS) begin
452
 
453
                       //->tb.test_control.error_detected;
454
                        $display ("at time %t ERROR: tRAS violation during Precharge bank 0", $time);
455
                    end
456
                end else if (Ba == 2'b01) begin
457
                    {Pc_b1, Act_b1} = 2'b10;
458
                    RP_chk1 = $time;
459
                    if (Debug) $display ("at time %t PRE  : Bank = 1",$time);
460
                    // Activate to Precharge Bank 1
461
                    if ($time - RAS_chk1 < tRAS) begin
462
 
463
                       //->tb.test_control.error_detected;
464
                        $display ("at time %t ERROR: tRAS violation during Precharge bank 1", $time);
465
                    end
466
                end else if (Ba == 2'b10) begin
467
                    {Pc_b2, Act_b2} = 2'b10;
468
                    RP_chk2 = $time;
469
                    if (Debug) $display ("at time %t PRE  : Bank = 2",$time);
470
                    // Activate to Precharge Bank 2
471
                    if ($time - RAS_chk2 < tRAS) begin
472
 
473
                       //->tb.test_control.error_detected;
474
                        $display ("at time %t ERROR: tRAS violation during Precharge bank 2", $time);
475
                    end
476
                end else if (Ba == 2'b11) begin
477
                    {Pc_b3, Act_b3} = 2'b10;
478
                    RP_chk3 = $time;
479
                    if (Debug) $display ("at time %t PRE  : Bank = 3",$time);
480
                    // Activate to Precharge Bank 3
481
                    if ($time - RAS_chk3 < tRAS) begin
482
 
483
                       //->tb.test_control.error_detected;
484
                        $display ("at time %t ERROR: tRAS violation during Precharge bank 3", $time);
485
                    end
486
                end
487
                // tWR violation check for write
488
                if ($time - WR_chk[Ba] < tWRp) begin
489
 
490
                   //->tb.test_control.error_detected;
491
                    $display ("at time %t ERROR: tWR violation during Precharge bank %d", $time, Ba);
492
                end
493
            end
494
            // Terminate a Write Immediately (if same bank or all banks)
495
            if (Data_in_enable == 1'b1 && (Bank == Ba || Addr[10] == 1'b1)) begin
496
                Data_in_enable = 1'b0;
497
            end
498
            // Precharge Command Pipeline for Read
499
            if (Cas_latency_3 == 1'b1) begin
500
                Command[2] = `PRECH;
501
                Bank_precharge[2] = Ba;
502
                A10_precharge[2] = Addr[10];
503
            end else if (Cas_latency_2 == 1'b1) begin
504
                Command[1] = `PRECH;
505
                Bank_precharge[1] = Ba;
506
                A10_precharge[1] = Addr[10];
507
            end
508
        end
509
 
510
        // Burst terminate
511
        if (Burst_term == 1'b1) begin
512
            // Terminate a Write Immediately
513
            if (Data_in_enable == 1'b1) begin
514
                Data_in_enable = 1'b0;
515
            end
516
            // Terminate a Read Depend on CAS Latency
517
            if (Cas_latency_3 == 1'b1) begin
518
                Command[2] = `BST;
519
            end else if (Cas_latency_2 == 1'b1) begin
520
                Command[1] = `BST;
521
            end
522
            if (Debug) $display ("at time %t BST  : Burst Terminate",$time);
523
        end
524
 
525
        // Read, Write, Column Latch
526
        if (Read_enable == 1'b1 || Write_enable == 1'b1) begin
527
            // Check to see if bank is open (ACT)
528
            if ((Ba == 2'b00 && Pc_b0 == 1'b1) || (Ba == 2'b01 && Pc_b1 == 1'b1) ||
529
                (Ba == 2'b10 && Pc_b2 == 1'b1) || (Ba == 2'b11 && Pc_b3 == 1'b1)) begin
530
 
531
               //->tb.test_control.error_detected;
532
                $display("at time %t ERROR: Cannot Read or Write - Bank %d is not Activated", $time, Ba);
533
            end
534
            // Activate to Read or Write
535
            if ((Ba == 2'b00) && ($time - RCD_chk0 < tRCD))
536
              begin
537
                 //->tb.test_control.error_detected;
538
                 $display("at time %t ERROR: tRCD violation during Read or Write to Bank 0", $time);
539
              end
540
 
541
            if ((Ba == 2'b01) && ($time - RCD_chk1 < tRCD))
542
              begin
543
                 //->tb.test_control.error_detected;
544
                 $display("at time %t ERROR: tRCD violation during Read or Write to Bank 1", $time);
545
              end
546
            if ((Ba == 2'b10) && ($time - RCD_chk2 < tRCD))
547
              begin
548
                 //->tb.test_control.error_detected;
549
                 $display("at time %t ERROR: tRCD violation during Read or Write to Bank 2", $time);
550
              end
551
            if ((Ba == 2'b11) && ($time - RCD_chk3 < tRCD))
552
              begin
553
                 //->tb.test_control.error_detected;
554
                 $display("at time %t ERROR: tRCD violation during Read or Write to Bank 3", $time);
555
              end
556
            // Read Command
557
            if (Read_enable == 1'b1) begin
558
                // CAS Latency pipeline
559
                if (Cas_latency_3 == 1'b1) begin
560
                    if (Addr[10] == 1'b1) begin
561
                        Command[2] = `READ_A;
562
                    end else begin
563
                        Command[2] = `READ;
564
                    end
565
                    Col_addr[2] = Addr;
566
                    Bank_addr[2] = Ba;
567
                end else if (Cas_latency_2 == 1'b1) begin
568
                    if (Addr[10] == 1'b1) begin
569
                        Command[1] = `READ_A;
570
                    end else begin
571
                        Command[1] = `READ;
572
                    end
573
                    Col_addr[1] = Addr;
574
                    Bank_addr[1] = Ba;
575
                end
576
 
577
                // Read interrupt Write (terminate Write immediately)
578
                if (Data_in_enable == 1'b1) begin
579
                    Data_in_enable = 1'b0;
580
                end
581
 
582
            // Write Command
583
            end else if (Write_enable == 1'b1) begin
584
                if (Addr[10] == 1'b1) begin
585
                    Command[0] = `WRITE_A;
586
                end else begin
587
                    Command[0] = `WRITE;
588
                end
589
                Col_addr[0] = Addr;
590
                Bank_addr[0] = Ba;
591
 
592
                // Write interrupt Write (terminate Write immediately)
593
                if (Data_in_enable == 1'b1) begin
594
                    Data_in_enable = 1'b0;
595
                end
596
 
597
                // Write interrupt Read (terminate Read immediately)
598
                if (Data_out_enable == 1'b1) begin
599
                    Data_out_enable = 1'b0;
600
                end
601
            end
602
 
603
            // Interrupting a Write with Autoprecharge
604
            if (Auto_precharge[Bank] == 1'b1 && Write_precharge[Bank] == 1'b1) begin
605
                RW_interrupt_write[Bank] = 1'b1;
606
                if (Debug) $display ("at time %t NOTE : Read/Write Bank %d interrupt Write Bank %d with Autoprecharge", $time, Ba, Bank);
607
            end
608
 
609
            // Interrupting a Read with Autoprecharge
610
            if (Auto_precharge[Bank] == 1'b1 && Read_precharge[Bank] == 1'b1) begin
611
                RW_interrupt_read[Bank] = 1'b1;
612
                if (Debug) $display ("at time %t NOTE : Read/Write Bank %d interrupt Read Bank %d with Autoprecharge", $time, Ba, Bank);
613
            end
614
 
615
            // Read or Write with Auto Precharge
616
            if (Addr[10] == 1'b1) begin
617
                Auto_precharge[Ba] = 1'b1;
618
                Count_precharge[Ba] = 0;
619
                if (Read_enable == 1'b1) begin
620
                    Read_precharge[Ba] = 1'b1;
621
                end else if (Write_enable == 1'b1) begin
622
                    Write_precharge[Ba] = 1'b1;
623
                end
624
            end
625
        end
626
 
627
        //  Read with Auto Precharge Calculation
628
        //      The device start internal precharge:
629
        //          1.  CAS Latency - 1 cycles before last burst
630
        //      and 2.  Meet minimum tRAS requirement
631
        //       or 3.  Interrupt by a Read or Write (with or without AutoPrecharge)
632
        if ((Auto_precharge[0] == 1'b1) && (Read_precharge[0] == 1'b1)) begin
633
            if ((($time - RAS_chk0 >= tRAS) &&                                                      // Case 2
634
                ((Burst_length_1 == 1'b1 && Count_precharge[0] >= 1) ||                             // Case 1
635
                 (Burst_length_2 == 1'b1 && Count_precharge[0] >= 2) ||
636
                 (Burst_length_4 == 1'b1 && Count_precharge[0] >= 4) ||
637
                 (Burst_length_8 == 1'b1 && Count_precharge[0] >= 8))) ||
638
                 (RW_interrupt_read[0] == 1'b1)) begin                                              // Case 3
639
                    Pc_b0 = 1'b1;
640
                    Act_b0 = 1'b0;
641
                    RP_chk0 = $time;
642
                    Auto_precharge[0] = 1'b0;
643
                    Read_precharge[0] = 1'b0;
644
                    RW_interrupt_read[0] = 1'b0;
645
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 0", $time);
646
            end
647
        end
648
        if ((Auto_precharge[1] == 1'b1) && (Read_precharge[1] == 1'b1)) begin
649
            if ((($time - RAS_chk1 >= tRAS) &&
650
                ((Burst_length_1 == 1'b1 && Count_precharge[1] >= 1) ||
651
                 (Burst_length_2 == 1'b1 && Count_precharge[1] >= 2) ||
652
                 (Burst_length_4 == 1'b1 && Count_precharge[1] >= 4) ||
653
                 (Burst_length_8 == 1'b1 && Count_precharge[1] >= 8))) ||
654
                 (RW_interrupt_read[1] == 1'b1)) begin
655
                    Pc_b1 = 1'b1;
656
                    Act_b1 = 1'b0;
657
                    RP_chk1 = $time;
658
                    Auto_precharge[1] = 1'b0;
659
                    Read_precharge[1] = 1'b0;
660
                    RW_interrupt_read[1] = 1'b0;
661
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 1", $time);
662
            end
663
        end
664
        if ((Auto_precharge[2] == 1'b1) && (Read_precharge[2] == 1'b1)) begin
665
            if ((($time - RAS_chk2 >= tRAS) &&
666
                ((Burst_length_1 == 1'b1 && Count_precharge[2] >= 1) ||
667
                 (Burst_length_2 == 1'b1 && Count_precharge[2] >= 2) ||
668
                 (Burst_length_4 == 1'b1 && Count_precharge[2] >= 4) ||
669
                 (Burst_length_8 == 1'b1 && Count_precharge[2] >= 8))) ||
670
                 (RW_interrupt_read[2] == 1'b1)) begin
671
                    Pc_b2 = 1'b1;
672
                    Act_b2 = 1'b0;
673
                    RP_chk2 = $time;
674
                    Auto_precharge[2] = 1'b0;
675
                    Read_precharge[2] = 1'b0;
676
                    RW_interrupt_read[2] = 1'b0;
677
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 2", $time);
678
            end
679
        end
680
        if ((Auto_precharge[3] == 1'b1) && (Read_precharge[3] == 1'b1)) begin
681
            if ((($time - RAS_chk3 >= tRAS) &&
682
                ((Burst_length_1 == 1'b1 && Count_precharge[3] >= 1) ||
683
                 (Burst_length_2 == 1'b1 && Count_precharge[3] >= 2) ||
684
                 (Burst_length_4 == 1'b1 && Count_precharge[3] >= 4) ||
685
                 (Burst_length_8 == 1'b1 && Count_precharge[3] >= 8))) ||
686
                 (RW_interrupt_read[3] == 1'b1)) begin
687
                    Pc_b3 = 1'b1;
688
                    Act_b3 = 1'b0;
689
                    RP_chk3 = $time;
690
                    Auto_precharge[3] = 1'b0;
691
                    Read_precharge[3] = 1'b0;
692
                    RW_interrupt_read[3] = 1'b0;
693
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 3", $time);
694
            end
695
        end
696
 
697
        // Internal Precharge or Bst
698
        if (Command[0] == `PRECH) begin                         // Precharge terminate a read with same bank or all banks
699
            if (Bank_precharge[0] == Bank || A10_precharge[0] == 1'b1) begin
700
                if (Data_out_enable == 1'b1) begin
701
                    Data_out_enable = 1'b0;
702
                end
703
            end
704
        end else if (Command[0] == `BST) begin                  // BST terminate a read to current bank
705
            if (Data_out_enable == 1'b1) begin
706
                Data_out_enable = 1'b0;
707
            end
708
        end
709
 
710
        if (Data_out_enable == 1'b0) begin
711
            Dq_reg <= #tOH {data_bits{1'bz}};
712
        end
713
 
714
        // Detect Read or Write command
715
        if (Command[0] == `READ || Command[0] == `READ_A) begin
716
            Bank = Bank_addr[0];
717
            Col = Col_addr[0];
718
            Col_brst = Col_addr[0];
719
            if (Bank_addr[0] == 2'b00) begin
720
                Row = B0_row_addr;
721
            end else if (Bank_addr[0] == 2'b01) begin
722
                Row = B1_row_addr;
723
            end else if (Bank_addr[0] == 2'b10) begin
724
                Row = B2_row_addr;
725
            end else if (Bank_addr[0] == 2'b11) begin
726
                Row = B3_row_addr;
727
            end
728
            Burst_counter = 0;
729
            Data_in_enable = 1'b0;
730
            Data_out_enable = 1'b1;
731
        end else if (Command[0] == `WRITE || Command[0] == `WRITE_A) begin
732
            Bank = Bank_addr[0];
733
            Col = Col_addr[0];
734
            Col_brst = Col_addr[0];
735
            if (Bank_addr[0] == 2'b00) begin
736
                Row = B0_row_addr;
737
            end else if (Bank_addr[0] == 2'b01) begin
738
                Row = B1_row_addr;
739
            end else if (Bank_addr[0] == 2'b10) begin
740
                Row = B2_row_addr;
741
            end else if (Bank_addr[0] == 2'b11) begin
742
                Row = B3_row_addr;
743
            end
744
            Burst_counter = 0;
745
            Data_in_enable = 1'b1;
746
            Data_out_enable = 1'b0;
747
        end
748
 
749
        // DQ buffer (Driver/Receiver)
750
        if (Data_in_enable == 1'b1) begin                                   // Writing Data to Memory
751
            // Array buffer
752
            if (Bank == 2'b00) Dq_dqm [15 : 0] = Bank0 [{Row, Col}];
753
            if (Bank == 2'b01) Dq_dqm [15 : 0] = Bank1 [{Row, Col}];
754
            if (Bank == 2'b10) Dq_dqm [15 : 0] = Bank2 [{Row, Col}];
755
            if (Bank == 2'b11) Dq_dqm [15 : 0] = Bank3 [{Row, Col}];
756
            // Dqm operation
757
            if (Dqm[0] == 1'b0) Dq_dqm [ 7 : 0] = Dq [ 7 : 0];
758
            if (Dqm[1] == 1'b0) Dq_dqm [15 : 8] = Dq [15 : 8];
759
            // Write to memory
760
            if (Bank == 2'b00) Bank0 [{Row, Col}] = Dq_dqm [15 : 0];
761
            if (Bank == 2'b01) Bank1 [{Row, Col}] = Dq_dqm [15 : 0];
762
            if (Bank == 2'b10) Bank2 [{Row, Col}] = Dq_dqm [15 : 0];
763
            if (Bank == 2'b11) Bank3 [{Row, Col}] = Dq_dqm [15 : 0];
764
            // Output result
765
            if (Dqm == 2'b11) begin
766
                if (Debug) $display("at time %t WRITE: Bank = %d Row = %d, Col = %d, Data = Hi-Z due to DQM", $time, Bank, Row, Col);
767
            end else begin
768
                if (Debug) $display("at time %t WRITE: Bank = %d Row = %d, Col = %d, Data = %h, Dqm = %b", $time, Bank, Row, Col, Dq_dqm, Dqm);
769
                // Record tWR time and reset counter
770
                WR_chk [Bank] = $time;
771
                WR_counter [Bank] = 0;
772
            end
773
            // Advance burst counter subroutine
774
            #tHZ Burst;
775
        end else if (Data_out_enable == 1'b1) begin                         // Reading Data from Memory
776
            // Array buffer
777
            if (Bank == 2'b00) Dq_dqm [15 : 0] = Bank0 [{Row, Col}];
778
            if (Bank == 2'b01) Dq_dqm [15 : 0] = Bank1 [{Row, Col}];
779
            if (Bank == 2'b10) Dq_dqm [15 : 0] = Bank2 [{Row, Col}];
780
            if (Bank == 2'b11) Dq_dqm [15 : 0] = Bank3 [{Row, Col}];
781
            // Dqm operation
782
            if (Dqm_reg0[0] == 1'b1) Dq_dqm [ 7 : 0] = 8'bz;
783
            if (Dqm_reg0[1] == 1'b1) Dq_dqm [15 : 8] = 8'bz;
784
            // Display result
785
            Dq_reg [15 : 0] = #tAC Dq_dqm [15 : 0];
786
            if (Dqm_reg0 == 2'b11) begin
787
                if (Debug) $display("at time %t READ : Bank = %d Row = %d, Col = %d, Data = Hi-Z due to DQM", $time, Bank, Row, Col);
788
            end else begin
789
                if (Debug) $display("at time %t READ : Bank = %d Row = %d, Col = %d, Data = %h, Dqm = %b", $time, Bank, Row, Col, Dq_reg, Dqm_reg0);
790
            end
791
            // Advance burst counter subroutine
792
            Burst;
793
        end
794
    end
795
 
796
    //  Write with Auto Precharge Calculation
797
    //      The device start internal precharge:
798
    //          1.  tWR Clock after last burst
799
    //      and 2.  Meet minimum tRAS requirement
800
    //       or 3.  Interrupt by a Read or Write (with or without AutoPrecharge)
801
    always @ (WR_counter[0]) begin
802
        if ((Auto_precharge[0] == 1'b1) && (Write_precharge[0] == 1'b1)) begin
803
            if ((($time - RAS_chk0 >= tRAS) &&                                                          // Case 2
804
               (((Burst_length_1 == 1'b1 || Write_burst_mode == 1'b1) && Count_precharge [0] >= 1) ||   // Case 1
805
                 (Burst_length_2 == 1'b1 && Count_precharge [0] >= 2) ||
806
                 (Burst_length_4 == 1'b1 && Count_precharge [0] >= 4) ||
807
                 (Burst_length_8 == 1'b1 && Count_precharge [0] >= 8))) ||
808
                 (RW_interrupt_write[0] == 1'b1 && WR_counter[0] >= 2)) begin                           // Case 3 (stop count when interrupt)
809
                    Auto_precharge[0] = 1'b0;
810
                    Write_precharge[0] = 1'b0;
811
                    RW_interrupt_write[0] = 1'b0;
812
                    #tWRa;                          // Wait for tWR
813
                    Pc_b0 = 1'b1;
814
                    Act_b0 = 1'b0;
815
                    RP_chk0 = $time;
816
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 0", $time);
817
            end
818
        end
819
    end
820
    always @ (WR_counter[1]) begin
821
        if ((Auto_precharge[1] == 1'b1) && (Write_precharge[1] == 1'b1)) begin
822
            if ((($time - RAS_chk1 >= tRAS) &&
823
               (((Burst_length_1 == 1'b1 || Write_burst_mode == 1'b1) && Count_precharge [1] >= 1) ||
824
                 (Burst_length_2 == 1'b1 && Count_precharge [1] >= 2) ||
825
                 (Burst_length_4 == 1'b1 && Count_precharge [1] >= 4) ||
826
                 (Burst_length_8 == 1'b1 && Count_precharge [1] >= 8))) ||
827
                 (RW_interrupt_write[1] == 1'b1 && WR_counter[1] >= 2)) begin
828
                    Auto_precharge[1] = 1'b0;
829
                    Write_precharge[1] = 1'b0;
830
                    RW_interrupt_write[1] = 1'b0;
831
                    #tWRa;                          // Wait for tWR
832
                    Pc_b1 = 1'b1;
833
                    Act_b1 = 1'b0;
834
                    RP_chk1 = $time;
835
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 1", $time);
836
            end
837
        end
838
    end
839
    always @ (WR_counter[2]) begin
840
        if ((Auto_precharge[2] == 1'b1) && (Write_precharge[2] == 1'b1)) begin
841
            if ((($time - RAS_chk2 >= tRAS) &&
842
               (((Burst_length_1 == 1'b1 || Write_burst_mode == 1'b1) && Count_precharge [2] >= 1) ||
843
                 (Burst_length_2 == 1'b1 && Count_precharge [2] >= 2) ||
844
                 (Burst_length_4 == 1'b1 && Count_precharge [2] >= 4) ||
845
                 (Burst_length_8 == 1'b1 && Count_precharge [2] >= 8))) ||
846
                 (RW_interrupt_write[2] == 1'b1 && WR_counter[2] >= 2)) begin
847
                    Auto_precharge[2] = 1'b0;
848
                    Write_precharge[2] = 1'b0;
849
                    RW_interrupt_write[2] = 1'b0;
850
                    #tWRa;                          // Wait for tWR
851
                    Pc_b2 = 1'b1;
852
                    Act_b2 = 1'b0;
853
                    RP_chk2 = $time;
854
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 2", $time);
855
            end
856
        end
857
    end
858
    always @ (WR_counter[3]) begin
859
        if ((Auto_precharge[3] == 1'b1) && (Write_precharge[3] == 1'b1)) begin
860
            if ((($time - RAS_chk3 >= tRAS) &&
861
               (((Burst_length_1 == 1'b1 || Write_burst_mode == 1'b1) && Count_precharge [3] >= 1) ||
862
                 (Burst_length_2 == 1'b1 && Count_precharge [3] >= 2) ||
863
                 (Burst_length_4 == 1'b1 && Count_precharge [3] >= 4) ||
864
                 (Burst_length_8 == 1'b1 && Count_precharge [3] >= 8))) ||
865
                 (RW_interrupt_write[3] == 1'b1 && WR_counter[3] >= 2)) begin
866
                    Auto_precharge[3] = 1'b0;
867
                    Write_precharge[3] = 1'b0;
868
                    RW_interrupt_write[3] = 1'b0;
869
                    #tWRa;                          // Wait for tWR
870
                    Pc_b3 = 1'b1;
871
                    Act_b3 = 1'b0;
872
                    RP_chk3 = $time;
873
                    if (Debug) $display ("at time %t NOTE : Start Internal Auto Precharge for Bank 3", $time);
874
            end
875
        end
876
    end
877
 
878
    task Burst;
879
        begin
880
            // Advance Burst Counter
881
            Burst_counter = Burst_counter + 1;
882
 
883
            // Burst Type
884
            if (Mode_reg[3] == 1'b0) begin                                  // Sequential Burst
885
                Col_temp = Col + 1;
886
            end else if (Mode_reg[3] == 1'b1) begin                         // Interleaved Burst
887
                Col_temp[2] =  Burst_counter[2] ^  Col_brst[2];
888
                Col_temp[1] =  Burst_counter[1] ^  Col_brst[1];
889
                Col_temp[0] =  Burst_counter[0] ^  Col_brst[0];
890
            end
891
 
892
            // Burst Length
893
            if (Burst_length_2) begin                                       // Burst Length = 2
894
                Col [0] = Col_temp [0];
895
            end else if (Burst_length_4) begin                              // Burst Length = 4
896
                Col [1 : 0] = Col_temp [1 : 0];
897
            end else if (Burst_length_8) begin                              // Burst Length = 8
898
                Col [2 : 0] = Col_temp [2 : 0];
899
            end else begin                                                  // Burst Length = FULL
900
                Col = Col_temp;
901
            end
902
 
903
            // Burst Read Single Write            
904
            if (Write_burst_mode == 1'b1) begin
905
                Data_in_enable = 1'b0;
906
            end
907
 
908
            // Data Counter
909
            if (Burst_length_1 == 1'b1) begin
910
                if (Burst_counter >= 1) begin
911
                    Data_in_enable = 1'b0;
912
                    Data_out_enable = 1'b0;
913
                end
914
            end else if (Burst_length_2 == 1'b1) begin
915
                if (Burst_counter >= 2) begin
916
                    Data_in_enable = 1'b0;
917
                    Data_out_enable = 1'b0;
918
                end
919
            end else if (Burst_length_4 == 1'b1) begin
920
                if (Burst_counter >= 4) begin
921
                    Data_in_enable = 1'b0;
922
                    Data_out_enable = 1'b0;
923
                end
924
            end else if (Burst_length_8 == 1'b1) begin
925
                if (Burst_counter >= 8) begin
926
                    Data_in_enable = 1'b0;
927
                    Data_out_enable = 1'b0;
928
                end
929
            end
930
        end
931
    endtask
932
 
933
    // Timing Parameters for -75 (PC133) and CAS Latency = 2
934
    specify
935
        specparam
936
                    tAH  =  0.8,                                        // Addr, Ba Hold Time
937
                    tAS  =  1.5,                                        // Addr, Ba Setup Time
938
                    tCH  =  2.5,                                        // Clock High-Level Width
939
                    tCL  =  2.5,                                        // Clock Low-Level Width
940
                    tCK  = 10,                                          // Clock Cycle Time
941
                    tDH  =  0.8,                                        // Data-in Hold Time
942
                    tDS  =  1.5,                                        // Data-in Setup Time
943
                    tCKH =  0.8,                                        // CKE Hold  Time
944
                    tCKS =  1.5,                                        // CKE Setup Time
945
                    tCMH =  0.8,                                        // CS#, RAS#, CAS#, WE#, DQM# Hold  Time
946
                    tCMS =  1.5;                                        // CS#, RAS#, CAS#, WE#, DQM# Setup Time
947
        $width    (posedge Clk,           tCH);
948
        $width    (negedge Clk,           tCL);
949
        $period   (negedge Clk,           tCK);
950
        $period   (posedge Clk,           tCK);
951
        $setuphold(posedge Clk,    Cke,   tCKS, tCKH);
952
        $setuphold(posedge Clk,    Cs_n,  tCMS, tCMH);
953
        $setuphold(posedge Clk,    Cas_n, tCMS, tCMH);
954
        $setuphold(posedge Clk,    Ras_n, tCMS, tCMH);
955
        $setuphold(posedge Clk,    We_n,  tCMS, tCMH);
956
        $setuphold(posedge Clk,    Addr,  tAS,  tAH);
957
        $setuphold(posedge Clk,    Ba,    tAS,  tAH);
958
        $setuphold(posedge Clk,    Dqm,   tCMS, tCMH);
959
        $setuphold(posedge Dq_chk, Dq,    tDS,  tDH);
960
    endspecify
961
 
962
endmodule
963
 

powered by: WebSVN 2.1.0

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