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

Subversion Repositories common

[/] [common/] [trunk/] [LPM_storage.v] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 bbeaver
//------------------------------------------------------------------------
2
//   This Verilog file was developed by Altera Corporation.  It may be
3
// freely copied and/or distributed at no cost.  Any persons using this
4
// file for any purpose do so at their own risk, and are responsible for
5
// the results of such use.  Altera Corporation does not guarantee that
6
// this file is complete, correct, or fit for any particular purpose.
7
// NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.  This notice must
8
// accompany any copy of this file.
9
//
10
//------------------------------------------------------------------------
11
// Imported to Opencores directory.   Date Sept 10, 2001
12
// Split related modules into separate files, as the manual splits them.
13
// Added example instantiations to the beginning of each file.
14
//
15
/* EXAMPLE INSTANTIATIONS:
16
 
17
lpm_latch
18
#( 1,                         // lpm_width
19
   "UNUSED",                  // lpm_avalue, aset value, optional, -1 if not set
20
   "UNUSED"                   // lpm_pvalue, power-up value, optional
21
 ) lpm_latch_example (
22
  .q                          (data_out[lpm_width-1:0]),
23
  .data                       (data_in[lpm_width-1:0]),
24
  .gate                       (pass_thru_when_HIGH),
25
  .aset                       (set_to_aset_value_when_HIGH),  // OPTIONAL
26
  .aclr                       (set_to_zero_when_HIGH)         // OPTIONAL
27
);
28
 
29
lpm_ff
30
#( 1,                         // lpm_width
31
   "UNUSED",                  // lpm_avalue, aset value, optional, -1 if not set
32
   "UNUSED",                  // lpm_svalue, sset value, optional, -1 if not set
33
   "UNUSED",                  // lpm_pvalue, power-up value, optional
34
   "DFF"                      // lpm_fftype, optional, {DFF, TFF}
35
 ) lpm_ff_example (
36
  .q                          (data_out[lpm_width-1:0]),
37
  .data                       (data_in[lpm_width-1:0]),
38
  .clock                      (rising_edge_flop_clock),
39
  .enable                     (clock_enable_when_HIGH),            // OPTIONAL
40
  .sload                      (load_data_to_toggle_flops_if_TFF),  // OPTIONAL
41
  .sset                       (load_data_from_svalue_if_HIGH),     // OPTIONAL
42
  .sclr                       (set_value_to_0_if_HIGH),            // OPTIONAL
43
  .aload                      (load_data_to_toggle_flops_if_TFF),  // OPTIONAL
44
  .aset                       (load_data_from_svalue_if_HIGH),     // OPTIONAL
45
  .aclr                       (set_value_to_0_if_HIGH)             // OPTIONAL
46
);
47
 
48
lpm_shiftreg
49
#( 1,                         // lpm_width
50
   "UNUSED",                  // lpm_avalue, aset value, optional, -1 if not set
51
   "UNUSED",                  // lpm_svalue, sset value, optional, -1 if not set
52
   "UNUSED",                  // lpm_pvalue, power-up value, optional
53
   "LEFT"                     // lpm_direction, optional, {LEFT, RIGHT}
54
 ) lpm_shiftreg_example (
55
  .q                          (data_out[lpm_width-1:0]),
56
  .shiftout                   (shift_data_from_LSB_or_MSB),
57
  .data                       (parallel_data_in[lpm_width-1:0]), // OPTIONAL
58
  .shiftin                    (shift_data_to_LSB_or_MSB),
59
  .clock                      (rising_edge_flop_clock),
60
  .enable                     (clock_enable_when_HIGH),          // OPTIONAL
61
  .load                       (parallel_load_data_when_HIGH),    // OPTIONAL
62
  .sset                       (load_data_from_svalue_if_HIGH),   // OPTIONAL
63
  .sclr                       (set_value_to_0_if_HIGH),          // OPTIONAL
64
  .aset                       (load_data_from_svalue_if_HIGH),   // OPTIONAL
65
  .aclr                       (set_value_to_0_if_HIGH)           // OPTIONAL
66
);
67
 
68
lpm_ram_dq
69
#( 1,                         // lpm_width
70
        parameter lpm_widthad = 1;
71
        parameter lpm_numwords = 1 << lpm_widthad;
72
        parameter lpm_indata = "REGISTERED";
73
        parameter lpm_address_control = "REGISTERED";
74
        parameter lpm_outdata = "REGISTERED";
75
        parameter lpm_file = "UNUSED";
76
 ) lpm_ram_dq_example (
77
  .q                          (data_out[lpm_width-1:0]),
78
  .data                       (parallel_data_in[lpm_width-1:0]),
79
);
80
// NOTE: WORKING
81
( q, data, inclock, outclock, we, address );
82
 
83
        input  [lpm_width-1:0] data;
84
        input  [lpm_widthad-1:0] address;
85
        input  inclock, outclock, we;
86
        output [lpm_width-1:0] q;
87
 
88
 
89
lpm_ram_dp
90
#( 1,                         // lpm_width
91
        parameter lpm_widthad = 1;
92
        parameter lpm_numwords = 1<< lpm_widthad;
93
        parameter lpm_indata = "REGISTERED";
94
        parameter lpm_outdata = "REGISTERED";
95
        parameter lpm_rdaddress_control  = "REGISTERED";
96
        parameter lpm_wraddress_control  = "REGISTERED";
97
        parameter lpm_file = "UNUSED";
98
 ) lpm_ram_dp_example (
99
  .q                          (data_out[lpm_width-1:0]),
100
  .data                       (parallel_data_in[lpm_width-1:0]),
101
);
102
( q, data, wraddress, rdaddress, rdclock, wrclock, rdclken, wrclken, rden, wren);
103
 
104
        input  [lpm_width-1:0] data;
105
        input  [lpm_widthad-1:0] rdaddress, wraddress;
106
        input  rdclock, wrclock, rdclken, wrclken, rden, wren;
107
        output [lpm_width-1:0] q;
108
 
109
 
110
lpm_ram_io
111
#( 1,                         // lpm_width
112
        parameter lpm_widthad = 1;
113
        parameter lpm_numwords = 1<< lpm_widthad;
114
        parameter lpm_indata = "REGISTERED";
115
        parameter lpm_address_control = "REGISTERED";
116
        parameter lpm_outdata = "REGISTERED";
117
        parameter lpm_file = "UNUSED";
118
 ) lpm_ram_io_example (
119
  .q                          (data_out[lpm_width-1:0]),
120
  .data                       (parallel_data_in[lpm_width-1:0]),
121
);
122
( dio, inclock, outclock, we, memenab, outenab, address );
123
 
124
        input  [lpm_widthad-1:0] address;
125
        input  inclock, outclock, we;
126
        input  memenab;
127
        input  outenab;
128
        inout  [lpm_width-1:0] dio;
129
 
130
lpm_rom
131
#( 1,                         // lpm_width
132
        parameter lpm_widthad = 1;
133
        parameter lpm_numwords = 1<< lpm_widthad;
134
        parameter lpm_address_control = "REGISTERED";
135
        parameter lpm_outdata = "REGISTERED";
136
        parameter lpm_file = "rom.hex";
137
 ) lpm_rom_example (
138
  .q                          (data_out[lpm_width-1:0]),
139
  .data                       (parallel_data_in[lpm_width-1:0]),
140
);
141
( q, inclock, outclock, memenab, address );
142
 
143
        input  [lpm_widthad-1:0] address;
144
        input  inclock, outclock;
145
        input  memenab;
146
        output [lpm_width-1:0] q;
147
 
148
lpm_fifo
149
#( 1,                         // lpm_width
150
        parameter lpm_widthu  = 1;
151
        parameter lpm_numwords = 2;
152
        parameter lpm_showahead = "OFF";
153
 ) lpm_fifo_example (
154
  .q                          (data_out[lpm_width-1:0]),
155
  .data                       (parallel_data_in[lpm_width-1:0]),
156
);
157
(data, clock, wrreq, rdreq, aclr, sclr, q, usedw, full, empty);
158
 
159
        input [lpm_width-1:0] data;
160
        input clock;
161
        input wrreq;
162
        input rdreq;
163
        input aclr;
164
        input sclr;
165
        output [lpm_width-1:0] q;
166
        output [lpm_widthu-1:0] usedw;
167
        output full;
168
        output empty;
169
 
170
 
171
lpm_fifo_dc
172
#( 1,                         // lpm_width
173
        parameter lpm_widthu = 1;
174
        parameter lpm_numwords = 2;
175
        parameter lpm_showahead = "OFF";
176
 ) lpm_fifo_dc_example (
177
  .q                          (data_out[lpm_width-1:0]),
178
  .data                       (parallel_data_in[lpm_width-1:0]),
179
);
180
( data, rdclock, wrclock, aclr, rdreq, wrreq, rdfull, wrfull, rdempty, wrempty, rdusedw, wrusedw, q );
181
 
182
        input [lpm_width-1:0] data;
183
        input rdclock;
184
        input wrclock;
185
        input wrreq;
186
        input rdreq;
187
        input aclr;
188
        output rdfull;
189
        output wrfull;
190
        output rdempty;
191
        output wrempty;
192
        output [lpm_width-1:0] q;
193
        output [lpm_widthu-1:0] rdusedw;
194
        output [lpm_widthu-1:0] wrusedw;
195
 
196
*/
197
 
198
//------------------------------------------------------------------------
199
// LPM Synthesizable Models
200
//------------------------------------------------------------------------
201
// Version 1.5 (lpm 220)      Date 12/17/99
202
//
203
// Modified LPM_ADD_SUB and LPM_MULT to accomodate LPM_WIDTH = 1.
204
//   Default values for LPM_WIDTH* are changed back to 1.
205
// Added LPM_HINT to LPM_DIVIDE.
206
// Rewritten LPM_FIFO_DC to output correctly.
207
// Modified LPM_FIFO to output 0s before first read, output correct
208
//   values after aclr and sclr, and output LPM_NUMWORDS mod
209
//   exp(2, LPM_WIDTHU) when FIFO is full.
210
//
211
//------------------------------------------------------------------------
212
// Version 1.4.1 (lpm 220)    Date 10/29/99
213
//
214
// Default values for LPM_WIDTH* of LPM_ADD_SUB and LPM_MULT are changed
215
//   from 1 to 2.
216
//
217
//------------------------------------------------------------------------
218
// Version 1.4 (lpm 220)      Date 10/18/99
219
//
220
// Default values for each optional inputs for ALL modules are added.
221
// Some LPM_PVALUE implementations were missing, and now implemented.
222
//
223
//------------------------------------------------------------------------
224
// Version 1.3 (lpm 220)      Date 06/23/99
225
//
226
// Corrected LPM_FIFO and LPM_FIFO_DC cout and empty/full flags.
227
// Implemented LPM_COUNTER cin/cout, and LPM_MODULUS is now working.
228
//
229
//------------------------------------------------------------------------
230
// Version 1.2 (lpm 220)      Date 06/16/99
231
//
232
// Added LPM_RAM_DP, LPM_RAM_DQ, LPM_IO, LPM_ROM, LPM_FIFO, LPM_FIFO_DC.
233
// Parameters and ports are added/discarded according to the spec.
234
//
235
//------------------------------------------------------------------------
236
// Version 1.1 (lpm 220)      Date 02/05/99
237
//
238
// Added LPM_DIVIDE module.
239
//
240
//------------------------------------------------------------------------
241
// Version 1.0                Date 07/09/97
242
//
243
//------------------------------------------------------------------------
244
// Excluded Functions:
245
//
246
//  LPM_FSM and LPM_TTABLE.
247
//
248
//------------------------------------------------------------------------
249
// Assumptions:
250
//
251
// 1. LPM_SVALUE, LPM_AVALUE, LPM_MODULUS, and LPM_NUMWORDS,
252
//    LPM_STRENGTH, LPM_DIRECTION, and LPM_PVALUE  default value is
253
//    string UNUSED.
254
//
255
//------------------------------------------------------------------------
256
// Verilog Language Issues:
257
//
258
// Two dimensional ports are not supported. Modules with two dimensional
259
// ports are implemented as one dimensional signal of (LPM_SIZE * LPM_WIDTH)
260
// bits wide.
261
//
262
//------------------------------------------------------------------------
263
// Synthesis Issues:
264
// 
265
// 1. LPM_COUNTER 
266
//
267
// Currently synthesis tools do not allow mixing of level and edge
268
// sensetive signals. To overcome that problem the "data" signal is
269
// removed from the clock always block of lpm_counter, however the
270
// synthesis result is accurate. For correct simulation add the "data"
271
// pin to the sensetivity list as follows:
272
//
273
//  always @(posedge clock or posedge aclr or posedge aset or 
274
//           posedge aload or data)
275
//------------------------------------------------------------------------
276
 
277
module lpm_latch ( q, data, gate, aset, aclr );
278
 
279
// NOTE: Parameters must be declared in the same order as the Properties
280
//       are specified in the Cell Specification document.
281
        parameter lpm_width = 1;
282
        parameter lpm_avalue = "UNUSED";
283
        parameter lpm_pvalue = "UNUSED";
284
        parameter lpm_type = "lpm_latch";
285
        parameter lpm_hint = "UNUSED";
286
        parameter lpm_source_version = "lpm 220 version 1.6";
287
 
288
        input  [lpm_width-1:0] data;
289
        input  gate, aset, aclr;
290
        output [lpm_width-1:0] q;
291
 
292
        reg [lpm_width-1:0] q;
293
 
294
        tri0 aset;
295
        tri0 aclr;
296
 
297
        buf (i_aset, aset);
298
        buf (i_aclr, aclr);
299
 
300
//---------------------------------------------------------------//
301
//  function integer str_to_int;
302
//---------------------------------------------------------------//
303
        function integer str_to_int;
304
                input  [8*16:1] s;
305
 
306
                reg [8*16:1] reg_s;
307
                reg [8:1] digit;
308
                reg [8:1] tmp;
309
                integer m , ivalue;
310
 
311
                begin
312
                        ivalue = 0;
313
                        reg_s = s;
314
                        for (m=1; m<=16; m= m+1)
315
                        begin
316
                                tmp = reg_s[128:121];
317
                                digit = tmp & 8'b00001111;
318
                                reg_s = reg_s << 8;
319
                                ivalue = ivalue * 10 + digit;
320
                        end
321
                        str_to_int = ivalue;
322
                end
323
        endfunction
324
//---------------------------------------------------------------//
325
 
326
        initial
327
        begin
328
                if (lpm_pvalue != "UNUSED")
329
                        q = str_to_int(lpm_pvalue);
330
        end
331
 
332
        always @(data or gate or i_aclr or i_aset)
333
        begin
334
                if (i_aclr)
335
                        q = 'b0;
336
                else if (i_aset)
337
                        begin
338
                                if (lpm_avalue == "UNUSED")
339
                                        q = {lpm_width{1'b1}};
340
                                else
341
                                        q = str_to_int(lpm_avalue);
342
                        end
343
                else if (gate)
344
                        q = data;
345
        end
346
 
347
// Check for previous Parameter declaration order
348
initial if ((lpm_width === "lpm_latch") || (lpm_type !== "lpm_latch"))
349
  begin
350
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
351
    $finish;
352
  end
353
endmodule // lpm_latch
354
 
355
//------------------------------------------------------------------------
356
 
357
module lpm_ff ( q, data, clock, enable, aclr, aset,
358
                                sclr, sset, aload, sload );
359
 
360
// NOTE: Parameters must be declared in the same order as the Properties
361
//       are specified in the Cell Specification document.
362
        parameter lpm_width  = 1;
363
        parameter lpm_avalue = "UNUSED";
364
        parameter lpm_svalue = "UNUSED";
365
        parameter lpm_pvalue = "UNUSED";
366
        parameter lpm_fftype = "DFF";
367
        parameter lpm_type = "lpm_ff";
368
        parameter lpm_hint = "UNUSED";
369
        parameter lpm_source_version = "lpm 220 version 1.6";
370
 
371
 
372
        input  [lpm_width-1:0] data;
373
        input  clock, enable;
374
        input  aclr, aset;
375
        input  sclr, sset;
376
        input  aload, sload ;
377
        output [lpm_width-1:0] q;
378
 
379
        reg   [lpm_width-1:0] tmp_q;
380
        integer i;
381
 
382
        tri1 enable;
383
        tri0 sload;
384
        tri0 sclr;
385
        tri0 sset;
386
        tri0 aload;
387
        tri0 aclr;
388
        tri0 aset;
389
 
390
        buf (i_enable, enable);
391
        buf (i_sload, sload);
392
        buf (i_sclr, sclr);
393
        buf (i_sset, sset);
394
        buf (i_aload, aload);
395
        buf (i_aclr, aclr);
396
        buf (i_aset, aset);
397
 
398
//---------------------------------------------------------------//
399
//  function integer str_to_int;
400
//---------------------------------------------------------------//
401
        function integer str_to_int;
402
                input  [8*16:1] s;
403
 
404
                reg [8*16:1] reg_s;
405
                reg [8:1]   digit;
406
                reg [8:1] tmp;
407
                integer   m , ivalue;
408
 
409
                begin
410
                        ivalue = 0;
411
                        reg_s = s;
412
                        for (m=1; m<=16; m= m+1)
413
                        begin
414
                                tmp = reg_s[128:121];
415
                                digit = tmp & 8'b00001111;
416
                                reg_s = reg_s << 8;
417
                                ivalue = ivalue * 10 + digit;
418
                        end
419
                        str_to_int = ivalue;
420
                end
421
        endfunction
422
//---------------------------------------------------------------//
423
 
424
        initial
425
        begin
426
                if (lpm_pvalue != "UNUSED")
427
                        tmp_q = str_to_int(lpm_pvalue);
428
        end
429
 
430
        always @(posedge clock or posedge i_aclr or posedge i_aset or
431
                          posedge i_aload)
432
        begin :asyn_block // Asynchronous process
433
                if (i_aclr)
434
                begin
435
                         tmp_q = 0;
436
                end
437
                else if (i_aset)
438
                begin
439
                        if (lpm_avalue == "UNUSED")
440
                                tmp_q = {lpm_width{1'b1}};
441
                        else
442
                                tmp_q = str_to_int(lpm_avalue);
443
                end
444
                else if (i_aload)
445
                begin
446
                                 tmp_q = data;
447
                end
448
                else
449
                begin :syn_block // Synchronous process
450
                        if (i_enable)
451
                        begin
452
                                if (i_sclr)
453
                                begin
454
                                        tmp_q = 0;
455
                                end
456
                                else if (i_sset)
457
                                begin
458
                                        if (lpm_svalue == "UNUSED")
459
                                                tmp_q = {lpm_width{1'b1}};
460
                                        else
461
                                                tmp_q = str_to_int(lpm_svalue);
462
                                end
463
                                else if (i_sload)  // Load data
464
                                begin
465
                                        tmp_q = data;
466
                                end
467
                                else
468
                                begin
469
                                        if (lpm_fftype == "TFF") // toggle
470
                                        begin
471
                                                for (i = 0; i < lpm_width; i=i+1)
472
                                                begin
473
                                                        if (data[i] == 1'b1)
474
                                                                tmp_q[i] = ~tmp_q[i];
475
                                                end
476
                                        end
477
                                        else
478
                                        if (lpm_fftype == "DFF") // load data
479
                                                tmp_q = data;
480
                                end
481
                        end
482
                end
483
        end
484
 
485
        assign q = tmp_q;
486
 
487
// Check for previous Parameter declaration order
488
initial if ((lpm_width === "lpm_ff") || (lpm_type !== "lpm_ff"))
489
  begin
490
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
491
    $finish;
492
  end
493
endmodule // lpm_ff
494
 
495
//------------------------------------------------------------------------
496
 
497
module lpm_shiftreg ( q, shiftout, data, clock, enable, aclr, aset,
498
                                          sclr, sset, shiftin, load );
499
 
500
// NOTE: Parameters must be declared in the same order as the Properties
501
//       are specified in the Cell Specification document.
502
        parameter lpm_width  = 1;
503
        parameter lpm_avalue = "UNUSED";
504
        parameter lpm_svalue = "UNUSED";
505
        parameter lpm_pvalue = "UNUSED";
506
        parameter lpm_direction = "LEFT";
507
        parameter lpm_type = "lpm_shiftreg";
508
        parameter lpm_hint  = "UNUSED";
509
        parameter lpm_source_version = "lpm 220 version 1.6";
510
 
511
        input  [lpm_width-1:0] data;
512
        input  clock, enable;
513
        input  aclr, aset;
514
        input  sclr, sset;
515
        input  shiftin, load;
516
        output [lpm_width-1:0] q;
517
        output shiftout;
518
 
519
        reg  [lpm_width-1:0] tmp_q;
520
        reg  abit;
521
        integer i;
522
 
523
        wire tmp_shiftout;
524
 
525
        tri1 enable;
526
        tri1 shiftin;
527
        tri0 load;
528
        tri0 sclr;
529
        tri0 sset;
530
        tri0 aclr;
531
        tri0 aset;
532
 
533
        buf (i_enable, enable);
534
        buf (i_shiftin, shiftin);
535
        buf (i_load, load);
536
        buf (i_sclr, sclr);
537
        buf (i_sset, sset);
538
        buf (i_aclr, aclr);
539
        buf (i_aset, aset);
540
 
541
 
542
//---------------------------------------------------------------//
543
//  function integer str_to_int;
544
//---------------------------------------------------------------//
545
        function integer str_to_int;
546
                input  [8*16:1] s;
547
 
548
                reg [8*16:1] reg_s;
549
                reg [8:1]   digit;
550
                reg [8:1] tmp;
551
                integer   m , ivalue;
552
 
553
                begin
554
                        ivalue = 0;
555
                        reg_s = s;
556
                        for (m=1; m<=16; m= m+1)
557
                        begin
558
                                tmp = reg_s[128:121];
559
                                digit = tmp & 8'b00001111;
560
                                reg_s = reg_s << 8;
561
                                ivalue = ivalue * 10 + digit;
562
                        end
563
                        str_to_int = ivalue;
564
                end
565
        endfunction
566
//---------------------------------------------------------------//
567
 
568
        initial
569
        begin
570
                if (lpm_pvalue != "UNUSED")
571
                        tmp_q = str_to_int(lpm_pvalue);
572
        end
573
 
574
        always @(posedge clock or posedge i_aclr or posedge i_aset)
575
        begin :asyn_block // Asynchronous process
576
                if (i_aclr)
577
                begin
578
                        tmp_q = 0;
579
                end
580
                else if (i_aset)
581
                begin
582
                        if (lpm_avalue === "UNUSED")
583
                                tmp_q = {lpm_width{1'b1}};
584
                        else
585
                                tmp_q = str_to_int(lpm_avalue);
586
                end
587
                else
588
                begin :syn_block // Synchronous process
589
                        if (i_enable)
590
                        begin
591
                                if (i_sclr)
592
                                begin
593
                                        tmp_q = 0;
594
                                end
595
                                else if (i_sset)
596
                                begin
597
                                        if (lpm_svalue === "UNUSED")
598
                                                tmp_q = {lpm_width{1'b1}};
599
                                        else
600
                                                tmp_q = str_to_int(lpm_svalue);
601
                                end
602
                                else if (i_load)
603
                                begin
604
                                        tmp_q = data;
605
                                end
606
                                else if (!i_load)
607
                                begin
608
                                        if (lpm_direction === "LEFT")
609
                                        begin
610
                                                {abit,tmp_q} = {tmp_q,i_shiftin};
611
                                        end
612
                                        else if (lpm_direction === "RIGHT")
613
                                        begin
614
                                                {tmp_q,abit} = {i_shiftin,tmp_q};
615
                                        end
616
                                end
617
                        end
618
                end
619
        end
620
 
621
 
622
        assign tmp_shiftout = (lpm_direction === "LEFT") ? tmp_q[lpm_width-1]
623
                                                                                                         : tmp_q[0];
624
        assign q = tmp_q;
625
        assign shiftout = tmp_shiftout;
626
 
627
// Check for previous Parameter declaration order
628
initial if ((lpm_width === "lpm_shiftreg") || (lpm_type !== "lpm_shiftreg"))
629
  begin
630
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
631
    $finish;
632
  end
633
endmodule // lpm_shiftreg
634
 
635
//------------------------------------------------------------------------
636
 
637
module lpm_ram_dq ( q, data, inclock, outclock, we, address );
638
 
639
// NOTE: Parameters must be declared in the same order as the Properties
640
//       are specified in the Cell Specification document.
641
        parameter lpm_width = 1;
642
        parameter lpm_widthad = 1;
643
        parameter lpm_numwords = 1 << lpm_widthad;
644
        parameter lpm_indata = "REGISTERED";
645
        parameter lpm_address_control = "REGISTERED";
646
        parameter lpm_outdata = "REGISTERED";
647
        parameter lpm_file = "UNUSED";
648
        parameter lpm_type = "lpm_ram_dq";
649
        parameter lpm_hint = "UNUSED";
650
        parameter lpm_source_version = "lpm 220 version 1.6";
651
 
652
        input  [lpm_width-1:0] data;
653
        input  [lpm_widthad-1:0] address;
654
        input  inclock, outclock, we;
655
        output [lpm_width-1:0] q;
656
 
657
 
658
  // internal reg 
659
        reg  [lpm_width-1:0] mem_data [lpm_numwords-1:0];
660
        reg  [lpm_width-1:0] tmp_q;
661
        reg  [lpm_width-1:0] pdata;
662
        reg  [lpm_width-1:0] in_data;
663
        reg  [lpm_widthad-1:0] paddress;
664
        reg  pwe;
665
        reg  [lpm_width-1:0]  ZEROS, UNKNOWN;
666
        reg  [8*256:1] ram_initf;
667
        integer i;
668
 
669
        tri0 inclock;
670
        tri0 outclock;
671
 
672
        buf (i_inclock, inclock);
673
        buf (i_outclock, outclock);
674
 
675
//---------------------------------------------------------------//
676
        function ValidAddress;
677
                input [lpm_widthad-1:0] paddress;
678
 
679
                begin
680
                        ValidAddress = 1'b0;
681
                        if (^paddress ==='bx)
682
                                $display("%d:Error! Invalid address.\n", $time);
683
                        else if (paddress >= lpm_numwords)
684
                                $display("%d:Error! Address out of bound on RAM.\n", $time);
685
                        else
686
                                ValidAddress = 1'b1;
687
                end
688
  endfunction
689
//---------------------------------------------------------------//
690
 
691
        initial
692
        begin
693
 
694
                // Initialize the internal data register.
695
                pdata = 0;
696
                paddress = 0;
697
                pwe = 0;
698
                tmp_q = 0;
699
 
700
                if (lpm_width <= 0)
701
                        $display("Error! lpm_width parameter must be greater than 0.");
702
 
703
                if (lpm_widthad <= 0)
704
                        $display("Error! lpm_widthad parameter must be greater than 0.");
705
                // check for number of words out of bound
706
                if ((lpm_numwords > (1 << lpm_widthad))
707
                        ||(lpm_numwords <= (1 << (lpm_widthad-1))))
708
                begin
709
                        $display("Error! lpm_numwords must equal to the ceiling of log2(lpm_widthad).");
710
 
711
                end
712
 
713
                if ((lpm_indata !== "REGISTERED") && (lpm_indata !== "UNREGISTERED"))
714
                begin
715
                        $display("Error! lpm_indata must be REGISTERED (the default) or UNREGISTERED.");
716
                end
717
 
718
                if ((lpm_address_control !== "REGISTERED") && (lpm_address_control !== "UNREGISTERED"))
719
                begin
720
                        $display("Error! lpm_address_control must be REGISTERED (the default) or UNREGISTERED.");
721
                end
722
 
723
                if ((lpm_outdata !== "REGISTERED") && (lpm_outdata !== "UNREGISTERED"))
724
                begin
725
                        $display("Error! lpm_outdata must be REGISTERED (the default) or UNREGISTERED.");
726
                end
727
 
728
                // check if lpm_indata or lpm_address_control is set to registered
729
                // inclock must be used.
730
                if (((lpm_indata === "REGISTERED") || (lpm_address_control === "REGISTERED")) && (inclock === 1'bz))
731
                begin
732
                        $display("Error! inclock = 1'bz. Inclock pin must be used.\n");
733
                end
734
 
735
                // check if lpm_outdata, outclock must be used
736
                if ((lpm_outdata === "REGISTERED") && (outclock === 1'bz))
737
                begin
738
                        $display("Error! lpm_outdata = REGISTERED, outclock = 1'bz . Outclock pin must be used.\n");
739
                end
740
 
741
                for (i=0; i < lpm_width; i=i+1)
742
                begin
743
                        ZEROS[i] = 1'b0;
744
                        UNKNOWN[i] = 1'bX;
745
                end
746
 
747
                for (i = 0; i < lpm_numwords; i=i+1)
748
                        mem_data[i] = ZEROS;
749
 
750
                // load data to the RAM
751
                if (lpm_file != "UNUSED")
752
                begin
753
                        $convert_hex2ver(lpm_file, lpm_width, ram_initf);
754
                        $readmemh(ram_initf, mem_data);
755
                end
756
 
757
        end
758
 
759
 
760
        always @(posedge i_inclock)
761
        begin
762
                if ((lpm_indata === "REGISTERED") && (lpm_address_control === "REGISTERED"))
763
                begin
764
                        paddress <= address;
765
                        pdata <= data;
766
                        pwe <= we;
767
                end
768
                else
769
                begin
770
                        if ((lpm_indata === "REGISTERED") && (lpm_address_control === "UNREGISTERED"))
771
                                pdata <= data;
772
 
773
                        if ((lpm_indata === "UNREGISTERED") && (lpm_address_control === "REGISTERED"))
774
                        begin
775
                                paddress <= address;
776
                                pwe <= we;
777
                        end
778
                end
779
        end
780
 
781
        always @(data)
782
        begin
783
                if (lpm_indata === "UNREGISTERED")
784
                        pdata <= data;
785
        end
786
 
787
        always @(address)
788
        begin
789
                if (lpm_address_control === "UNREGISTERED")
790
                        paddress <= address;
791
        end
792
 
793
        always @(we)
794
        begin
795
                if (lpm_address_control === "UNREGISTERED")
796
                        pwe <= we;
797
        end
798
 
799
        always @(pdata or paddress or pwe)
800
        begin :unregistered_inclock
801
                if (ValidAddress(paddress))
802
                begin
803
                        if ((lpm_indata === "UNREGISTERED" && lpm_address_control === "UNREGISTERED") || (lpm_address_control === "UNREGISTERED"))
804
                        begin
805
                                if (pwe)
806
                                        mem_data[paddress] <= pdata;
807
                        end
808
 
809
                end
810
                else
811
                begin
812
                        if (lpm_outdata === "UNREGISTERED")
813
                                tmp_q <= UNKNOWN;
814
                end
815
        end
816
 
817
        always @(posedge i_outclock)
818
        begin
819
                if (lpm_outdata === "REGISTERED")
820
                begin
821
                        if (ValidAddress(paddress))
822
                                tmp_q <= mem_data[paddress];
823
                        else
824
                                tmp_q <= UNKNOWN;
825
                end
826
        end
827
 
828
        always @(negedge i_inclock)
829
        begin
830
                if (lpm_address_control === "REGISTERED")
831
                begin
832
                        if (pwe)
833
                                mem_data[paddress] <= pdata;
834
                end
835
        end
836
 
837
        assign q = ( lpm_outdata === "UNREGISTERED" ) ? mem_data[paddress] : tmp_q;
838
 
839
// Check for previous Parameter declaration order
840
initial if ((lpm_width === "lpm_ram_dq") || (lpm_type !== "lpm_ram_dq"))
841
  begin
842
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
843
    $finish;
844
  end
845
endmodule // lpm_ram_dq
846
 
847
//------------------------------------------------------------------------
848
 
849
module lpm_ram_dp ( q, data, wraddress, rdaddress, rdclock, wrclock, rdclken, wrclken, rden, wren);
850
 
851
// NOTE: Parameters must be declared in the same order as the Properties
852
//       are specified in the Cell Specification document.
853
        parameter lpm_width = 1;
854
        parameter lpm_widthad = 1;
855
        parameter lpm_numwords = 1<< lpm_widthad;
856
        parameter lpm_indata = "REGISTERED";
857
        parameter lpm_outdata = "REGISTERED";
858
        parameter lpm_rdaddress_control  = "REGISTERED";
859
        parameter lpm_wraddress_control  = "REGISTERED";
860
        parameter lpm_file = "UNUSED";
861
        parameter lpm_type = "lpm_ram_dp";
862
        parameter lpm_hint = "UNUSED";
863
        parameter lpm_source_version = "lpm 220 version 1.6";
864
 
865
        input  [lpm_width-1:0] data;
866
        input  [lpm_widthad-1:0] rdaddress, wraddress;
867
        input  rdclock, wrclock, rdclken, wrclken, rden, wren;
868
        output [lpm_width-1:0] q;
869
 
870
 
871
        // internal reg 
872
        reg  [lpm_width-1:0] mem_data [lpm_numwords-1:0];
873
        reg  [lpm_width-1:0] tmp_q;
874
        reg  [lpm_width-1:0] prev_q;
875
        reg  [lpm_width-1:0] new_data;
876
        reg  [lpm_widthad-1:0] new_raddress;
877
        reg  [lpm_widthad-1:0] new_wraddress;
878
        reg  wren_event, rden_event;
879
        reg  [lpm_width-1:0]  ZEROS, UNKNOWN;
880
        reg  [8*256:1] ram_initf;
881
        integer i;
882
 
883
        tri0 rdclock;
884
        tri1 rdclken;
885
        tri1 rden;
886
        tri0 wrclock;
887
        tri1 wrclken;
888
 
889
        buf (i_rdclock, rdclock);
890
        buf (i_rdclken, rdclken);
891
        buf (i_rden, rden);
892
        buf (i_wrclock, wrclock);
893
        buf (i_wrclken, wrclken);
894
 
895
 
896
//---------------------------------------------------------------//
897
        function ValidAddress;
898
                input [lpm_widthad-1:0] paddress;
899
 
900
                begin
901
                        ValidAddress = 1'b0;
902
                        if (^paddress ==='bx)
903
                                $display("%d:Error! Invalid address.\n", $time);
904
                        else if (paddress >= lpm_numwords)
905
                                $display("%d:Error! Address out of bound on RAM.\n", $time);
906
                        else
907
                                ValidAddress = 1'b1;
908
                end
909
        endfunction
910
//---------------------------------------------------------------//
911
 
912
        initial
913
        begin
914
 
915
                // Initialize the internal data register.
916
                new_data = 0;
917
                new_raddress = 0;
918
                new_wraddress = 0;
919
                wren_event = 0;
920
                tmp_q = 0;
921
 
922
                if (lpm_width <= 0)
923
                        $display("Error! lpm_width parameter must be greater than 0.");
924
 
925
                if (lpm_widthad <= 0)
926
                        $display("Error! lpm_widthad parameter must be greater than 0.");
927
                // check for number of words out of bound
928
                if ((lpm_numwords > (1 << lpm_widthad))
929
                        ||(lpm_numwords <= (1 << (lpm_widthad-1))))
930
                begin
931
                        $display("Error! lpm_numwords must equal to the ceiling of log2(lpm_widthad).");
932
                end
933
 
934
                if ((lpm_indata !== "REGISTERED") && (lpm_indata !== "UNREGISTERED"))
935
                begin
936
                        $display("Error! lpm_indata must be REGISTERED (the default) or UNREGISTERED.");
937
                end
938
 
939
                if ((lpm_rdaddress_control !== "REGISTERED") && (lpm_rdaddress_control !== "UNREGISTERED"))
940
                begin
941
                        $display("Error! lpm_rdaddress_control must be REGISTERED (the default) or UNREGISTERED.");
942
                end
943
 
944
                if ((lpm_wraddress_control !== "REGISTERED") && (lpm_wraddress_control !== "UNREGISTERED"))
945
                begin
946
                        $display("Error! lpm_wraddress_control must be REGISTERED (the default) or UNREGISTERED.");
947
                end
948
 
949
                if ((lpm_outdata !== "REGISTERED") && (lpm_outdata !== "UNREGISTERED"))
950
                begin
951
                        $display("Error! lpm_outdata must be REGISTERED (the default) or UNREGISTERED.");
952
                end
953
 
954
                // check if lpm_indata or lpm_wraddress_control is set to registered
955
                // wrclock and wrclken must be used.
956
                if (((lpm_indata === "REGISTERED") || (lpm_wraddress_control === "REGISTERED")) && ((wrclock === 1'bz) || (wrclken == 1'bz)))
957
                begin
958
                        $display("Error! wrclock = 1'bz. wrclock and wrclken pins must be used.\n");
959
                end
960
 
961
                // check if lpm_rdaddress_control is set to registered
962
                // rdclock and rdclken must be used.
963
                if ((lpm_rdaddress_control === "REGISTERED") && ((rdclock === 1'bz) || (rdclken == 1'bz)))
964
                begin
965
                        $display("Error! rdclock = 1'bz. rdclock and rdclken pins must be used.\n");
966
                end
967
 
968
                // check if lpm_outdata, rdclock must be used
969
                if ((lpm_outdata === "REGISTERED") && (rdclock === 1'bz))
970
                begin
971
                        $display("Error! lpm_outdata = REGISTERED, rdclock = 1'bz . rdclock pnd rdclken pins must be used.\n");
972
                end
973
 
974
                for (i=0; i < lpm_width; i=i+1)
975
                begin
976
                        ZEROS[i] = 1'b0;
977
                        UNKNOWN[i] = 1'bX;
978
                end
979
 
980
                for (i = 0; i < lpm_numwords; i=i+1)
981
                        mem_data[i] = ZEROS;
982
 
983
                // load data to the RAM
984
                if (lpm_file != "UNUSED")
985
                begin
986
                        $convert_hex2ver(lpm_file, lpm_width, ram_initf);
987
                        $readmemh(ram_initf, mem_data);
988
                end
989
        end
990
 
991
 
992
        always @(posedge i_wrclock)
993
        begin
994
                if (i_wrclken)
995
                begin
996
                        if ((lpm_indata === "REGISTERED") && (lpm_wraddress_control === "REGISTERED"))
997
                        begin
998
                                new_wraddress <= wraddress;
999
                                new_data <= data;
1000
                                wren_event <= wren;
1001
                        end
1002
                        else
1003
                        begin
1004
                                if ((lpm_indata === "REGISTERED") && (lpm_wraddress_control === "UNREGISTERED"))
1005
                                        new_data <= data;
1006
 
1007
                                if ((lpm_indata === "UNREGISTERED") && (lpm_wraddress_control === "REGISTERED"))
1008
                                begin
1009
                                        new_wraddress <= wraddress;
1010
                                        wren_event <= wren;
1011
                                end
1012
                        end
1013
                end
1014
        end
1015
 
1016
 
1017
        always @(data)
1018
        begin
1019
                if (lpm_indata === "UNREGISTERED")
1020
                        new_data <= data;
1021
        end
1022
 
1023
        always @(wraddress)
1024
        begin
1025
                if (lpm_wraddress_control === "UNREGISTERED")
1026
                        new_wraddress <= wraddress;
1027
        end
1028
 
1029
        always @(rdaddress)
1030
        begin
1031
                if (lpm_rdaddress_control === "UNREGISTERED")
1032
                        new_raddress <= rdaddress;
1033
        end
1034
 
1035
        always @(wren)
1036
        begin
1037
                if (lpm_wraddress_control === "UNREGISTERED")
1038
                        wren_event <= wren;
1039
        end
1040
 
1041
        always @(i_rden)
1042
        begin
1043
                if (lpm_rdaddress_control === "UNREGISTERED")
1044
                        rden_event <= i_rden;
1045
        end
1046
 
1047
        always @(new_data or new_wraddress or wren_event)
1048
        begin
1049
                if (ValidAddress(new_wraddress))
1050
                begin
1051
                        if ((wren_event) && (i_wrclken))
1052
                                mem_data[new_wraddress] <= new_data;
1053
                end
1054
                else
1055
                begin
1056
                        if (lpm_outdata === "UNREGISTERED")
1057
                                tmp_q <= UNKNOWN;
1058
                end
1059
        end
1060
 
1061
        always @(posedge i_rdclock)
1062
        begin
1063
                if (lpm_rdaddress_control == "REGISTERED")
1064
                        if (i_rdclken)
1065
                        begin
1066
                                new_raddress <= rdaddress;
1067
                                rden_event <= i_rden;
1068
                        end
1069
                if (lpm_outdata === "REGISTERED")
1070
                begin
1071
                        if ((i_rdclken) && (rden_event))
1072
                        begin
1073
                                if (ValidAddress(new_raddress))
1074
                                begin
1075
                                        tmp_q <= mem_data[new_raddress];
1076
                                end
1077
                                else
1078
                                        tmp_q <= UNKNOWN;
1079
                        end
1080
                end
1081
        end
1082
 
1083
        //assign q = ( lpm_outdata === "UNREGISTERED" ) ? mem_data[new_raddress] : tmp_q;
1084
 
1085
        always @(mem_data[new_raddress] or tmp_q or i_rden)
1086
        begin
1087
                if (i_rden || lpm_outdata === "REGISTERED")
1088
                        prev_q <= ( lpm_outdata === "UNREGISTERED" ) ? mem_data[new_raddress] : tmp_q;
1089
        end
1090
 
1091
        assign q = prev_q;
1092
 
1093
// Check for previous Parameter declaration order
1094
initial if ((lpm_width === "lpm_ram_dp") || (lpm_type !== "lpm_ram_dp"))
1095
  begin
1096
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
1097
    $finish;
1098
  end
1099
endmodule // lpm_ram_dp
1100
 
1101
//------------------------------------------------------------------------
1102
 
1103
module lpm_ram_io ( dio, inclock, outclock, we, memenab, outenab, address );
1104
 
1105
// NOTE: Parameters must be declared in the same order as the Properties
1106
//       are specified in the Cell Specification document.
1107
        parameter lpm_width = 1;
1108
        parameter lpm_widthad = 1;
1109
        parameter lpm_numwords = 1<< lpm_widthad;
1110
        parameter lpm_indata = "REGISTERED";
1111
        parameter lpm_address_control = "REGISTERED";
1112
        parameter lpm_outdata = "REGISTERED";
1113
        parameter lpm_file = "UNUSED";
1114
        parameter lpm_type = "lpm_ram_io";
1115
        parameter lpm_hint = "UNUSED";
1116
        parameter lpm_source_version = "lpm 220 version 1.6";
1117
 
1118
        input  [lpm_widthad-1:0] address;
1119
        input  inclock, outclock, we;
1120
        input  memenab;
1121
        input  outenab;
1122
        inout  [lpm_width-1:0] dio;
1123
 
1124
 
1125
        // inernal reg 
1126
        reg  [lpm_width-1:0] mem_data [lpm_numwords-1:0];
1127
        reg  [lpm_width-1:0] tmp_io;
1128
        reg  [lpm_width-1:0] tmp_q;
1129
        reg  [lpm_width-1:0] pdio;
1130
        reg  [lpm_widthad-1:0] paddress;
1131
        reg  pwe;
1132
        reg  [lpm_width-1:0] ZEROS, UNKNOWN, HiZ;
1133
        reg  [8*256:1] ram_initf;
1134
        integer i;
1135
 
1136
        tri0 inclock;
1137
        tri0 outclock;
1138
 
1139
        buf (i_inclock, inclock);
1140
        buf (i_outclock, outclock);
1141
 
1142
 
1143
//---------------------------------------------------------------//
1144
        function ValidAddress;
1145
                input [lpm_widthad-1:0] paddress;
1146
 
1147
                begin
1148
                        ValidAddress = 1'b0;
1149
                        if (^paddress ==='bx)
1150
                                $display("%d:Error: Invalid address.", $time);
1151
                        else if (paddress >= lpm_numwords)
1152
                                $display("%d:Error: Address out of bound on RAM.", $time);
1153
                        else
1154
                                ValidAddress = 1'b1;
1155
                end
1156
        endfunction
1157
//---------------------------------------------------------------//
1158
 
1159
        initial
1160
        begin
1161
 
1162
                if (lpm_width <= 0)
1163
                        $display("Error! lpm_width parameter must be greater than 0.");
1164
 
1165
                if (lpm_widthad <= 0)
1166
                        $display("Error! lpm_widthad parameter must be greater than 0.");
1167
 
1168
                // check for number of words out of bound
1169
                if ((lpm_numwords > (1 << lpm_widthad))
1170
                        ||(lpm_numwords <= (1 << (lpm_widthad-1))))
1171
                begin
1172
                        $display("Error! lpm_numwords must equal to the ceiling of log2(lpm_widthad).");
1173
                end
1174
 
1175
                if ((lpm_indata !== "REGISTERED") && (lpm_indata !== "UNREGISTERED"))
1176
                begin
1177
                        $display("Error! lpm_indata must be REGISTERED (the default) or UNREGISTERED.");
1178
                end
1179
 
1180
                if ((lpm_address_control !== "REGISTERED") && (lpm_address_control !== "UNREGISTERED"))
1181
                begin
1182
                        $display("Error! lpm_address_control must be REGISTERED (the default) or UNREGISTERED.");
1183
                end
1184
 
1185
                if ((lpm_outdata !== "REGISTERED") && (lpm_outdata !== "UNREGISTERED"))
1186
                begin
1187
                        $display("Error! lpm_outdata must be REGISTERED (the default) or UNREGISTERED.");
1188
                end
1189
 
1190
 
1191
                // check if lpm_indata or lpm_address_control is set to registered
1192
                // inclock must be used.
1193
                if (((lpm_indata === "REGISTERED") || (lpm_address_control === "REGISTERED")) && (inclock === 1'bz))
1194
                begin
1195
                        $display("Error! inclock = 1'bz.  Inclock pin must be used.\n");
1196
                end
1197
 
1198
                // check if lpm_outdata, outclock must be used
1199
                if ((lpm_outdata === "REGISTERED") && (outclock === 1'bz))
1200
                begin
1201
                        $display("Error! lpm_outdata is REGISTERED, outclock = 1'bz.  Outclock pin must be used.\n");
1202
                end
1203
 
1204
                for (i=0; i < lpm_width; i=i+1)
1205
                begin
1206
                        ZEROS[i] = 1'b0;
1207
                        UNKNOWN[i] = 1'bX;
1208
                        HiZ[i] = 1'bZ;
1209
                end
1210
 
1211
                for (i = 0; i < lpm_numwords; i=i+1)
1212
                        mem_data[i] = ZEROS;
1213
 
1214
                // Initialize input/output 
1215
                pdio = 0;
1216
                paddress = 0;
1217
                tmp_io = 0;
1218
                tmp_q = 0;
1219
 
1220
                // load data to the RAM
1221
                if (lpm_file != "UNUSED")
1222
                begin
1223
                        $convert_hex2ver(lpm_file, lpm_width, ram_initf);
1224
                        $readmemh(ram_initf, mem_data);
1225
                end
1226
        end
1227
 
1228
 
1229
        always @(dio)
1230
        begin
1231
                if (lpm_indata === "UNREGISTERED")
1232
                        pdio <=  dio;
1233
        end
1234
 
1235
        always @(address)
1236
        begin
1237
                if (lpm_address_control === "UNREGISTERED")
1238
                        paddress <=  address;
1239
        end
1240
 
1241
 
1242
        always @(we)
1243
        begin
1244
                if (lpm_address_control === "UNREGISTERED")
1245
                        pwe <=  we;
1246
        end
1247
 
1248
        always @(posedge i_inclock)
1249
        begin
1250
                if (lpm_indata === "REGISTERED")
1251
                        pdio <=  dio;
1252
 
1253
                if (lpm_address_control === "REGISTERED")
1254
                begin
1255
                        paddress <=  address;
1256
                        pwe <=  we;
1257
                end
1258
        end
1259
 
1260
        always @(pdio or paddress or pwe or memenab)
1261
        begin :block_a
1262
                if (ValidAddress(paddress))
1263
                begin
1264
                        if ((lpm_indata === "UNREGISTERED" && lpm_address_control === "UNREGISTERED") || (lpm_address_control === "UNREGISTERED"))
1265
                        begin
1266
                                if (pwe && memenab)
1267
                                mem_data[paddress] <= pdio;
1268
                        end
1269
 
1270
                        if (lpm_outdata === "UNREGISTERED")
1271
                        begin
1272
                                tmp_q <= mem_data[paddress];
1273
                                tmp_q <= mem_data[paddress];
1274
                        end
1275
                end
1276
                else
1277
                begin
1278
                        if (lpm_outdata === "UNREGISTERED")
1279
                                tmp_q <= UNKNOWN;
1280
                end
1281
        end
1282
 
1283
        always @(negedge i_inclock)
1284
        begin
1285
                if (lpm_address_control === "REGISTERED")
1286
                begin
1287
                        if (pwe && memenab)
1288
                        mem_data[paddress] <= pdio;
1289
                end
1290
        end
1291
 
1292
        always @(posedge i_outclock)
1293
        begin
1294
                if (lpm_outdata === "REGISTERED")
1295
                begin
1296
                        tmp_q <= mem_data[paddress];
1297
                end
1298
        end
1299
 
1300
        always @(memenab or outenab or tmp_q)
1301
        begin
1302
                if (memenab && outenab)
1303
                        tmp_io <= tmp_q;
1304
                else if (!memenab || (memenab && !outenab))
1305
                        tmp_io <= HiZ;
1306
        end
1307
 
1308
        assign dio =  tmp_io;
1309
 
1310
// Check for previous Parameter declaration order
1311
initial if ((lpm_width === "lpm_ram_io") || (lpm_type !== "lpm_ram_io"))
1312
  begin
1313
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
1314
    $finish;
1315
  end
1316
endmodule // lpm_ram_io
1317
 
1318
//------------------------------------------------------------------------
1319
 
1320
module lpm_rom ( q, inclock, outclock, memenab, address );
1321
 
1322
// NOTE: Parameters must be declared in the same order as the Properties
1323
//       are specified in the Cell Specification document.
1324
        parameter lpm_width = 1;
1325
        parameter lpm_widthad = 1;
1326
        parameter lpm_numwords = 1<< lpm_widthad;
1327
        parameter lpm_address_control = "REGISTERED";
1328
        parameter lpm_outdata = "REGISTERED";
1329
        parameter lpm_file = "rom.hex";
1330
        parameter lpm_type = "lpm_rom";
1331
        parameter lpm_hint = "UNUSED";
1332
        parameter lpm_source_version = "lpm 220 version 1.6";
1333
 
1334
        input  [lpm_widthad-1:0] address;
1335
        input  inclock, outclock;
1336
        input  memenab;
1337
        output [lpm_width-1:0] q;
1338
 
1339
        // inernal reg 
1340
        reg  [lpm_width-1:0] mem_data [lpm_numwords-1:0];
1341
        reg  [lpm_widthad-1:0] paddress;
1342
        reg  [lpm_width-1:0] tmp_q;
1343
        reg  [lpm_width-1:0] tmp_q_reg;
1344
        reg  [lpm_width-1:0] ZEROS, UNKNOWN, HiZ;
1345
        reg  [8*256:1] rom_initf;
1346
        integer i;
1347
 
1348
        tri0 inclock;
1349
        tri0 outclock;
1350
        tri1 memenab;
1351
 
1352
        buf (i_inclock, inclock);
1353
        buf (i_outclock, outclock);
1354
        buf (i_memenab, memenab);
1355
 
1356
 
1357
//---------------------------------------------------------------//
1358
        function ValidAddress;
1359
                input [lpm_widthad-1:0] address;
1360
                begin
1361
                        ValidAddress = 1'b0;
1362
                        if (^address =='bx)
1363
                                $display("%d:Error: Invalid address.", $time);
1364
                        else if (address >= lpm_numwords)
1365
                                $display("%d:Error: Address out of bound on ROM.", $time);
1366
                        else
1367
                                ValidAddress = 1'b1;
1368
                end
1369
        endfunction
1370
//---------------------------------------------------------------//
1371
 
1372
        initial
1373
        begin
1374
                // Initialize output
1375
                tmp_q = 0;
1376
                tmp_q_reg = 0;
1377
                paddress = 0;
1378
 
1379
                if (lpm_file === "")
1380
                        $display("Error! rom module must have data file for initialization\n.");
1381
 
1382
                if (lpm_width <= 0)
1383
                        $display("Error! lpm_width parameter must be greater than 0.");
1384
 
1385
                if (lpm_widthad <= 0)
1386
                        $display("Error! lpm_widthad parameter must be greater than 0.");
1387
 
1388
 
1389
                // check for number of words out of bound
1390
                if ((lpm_numwords > (1 << lpm_widthad))
1391
                        ||(lpm_numwords <= (1 << (lpm_widthad-1))))
1392
                begin
1393
                        $display("Error! lpm_numwords must equal to the ceiling of log2(lpm_widthad).");
1394
                end
1395
 
1396
                if ((lpm_address_control !== "REGISTERED") && (lpm_address_control !== "UNREGISTERED"))
1397
                begin
1398
                        $display("Error! lpm_address_control must be REGISTERED (the default) or UNREGISTERED.");
1399
                end
1400
 
1401
                if ((lpm_outdata !== "REGISTERED") && (lpm_outdata !== "UNREGISTERED"))
1402
                begin
1403
                        $display("Error! lpm_outdata must be REGISTERED (the default) or UNREGISTERED.");
1404
                end
1405
 
1406
                // check if lpm_address_control is set to registered
1407
                // inclock must be used.
1408
                if ((lpm_address_control === "REGISTERED") && (inclock === 1'bz))
1409
                begin
1410
                        $display("Error! inclock = 1'bz.  Inclock pin must be used.\n");
1411
                end
1412
 
1413
                // check if lpm_outdata, outclock must be used
1414
                if ((lpm_outdata === "REGISTERED") && (outclock === 1'bz))
1415
                begin
1416
                        $display("Error! lpm_outdata is REGISTERED, outclock = 1'bz.  Outclock must be used.\n");
1417
                end
1418
 
1419
                for (i=0; i < lpm_width; i=i+1)
1420
                begin
1421
                        ZEROS[i] = 1'b0;
1422
                        UNKNOWN[i] = 1'bX;
1423
                        HiZ[i] = 1'bZ;
1424
                end
1425
 
1426
                for (i = 0; i < lpm_numwords; i=i+1)
1427
                        mem_data[i] = ZEROS;
1428
 
1429
                // load data to the ROM
1430
                if (lpm_file != "")
1431
                begin
1432
                        $convert_hex2ver(lpm_file, lpm_width, rom_initf);
1433
                        $readmemh(rom_initf, mem_data);
1434
                end
1435
        end
1436
 
1437
        always @(posedge i_inclock)
1438
        begin
1439
                if (lpm_address_control === "REGISTERED")
1440
                        paddress <=  address;
1441
        end
1442
 
1443
        always @(address)
1444
        begin
1445
                if (lpm_address_control === "UNREGISTERED")
1446
                                paddress <=  address;
1447
        end
1448
 
1449
 
1450
        always @(paddress)
1451
        begin
1452
                if (ValidAddress(paddress))
1453
                begin
1454
                        if (lpm_outdata === "UNREGISTERED")
1455
                                tmp_q_reg <=  mem_data[paddress];
1456
                end
1457
                else
1458
                begin
1459
                        if (lpm_outdata === "UNREGISTERED")
1460
                                tmp_q_reg <= UNKNOWN;
1461
                end
1462
        end
1463
 
1464
        always @(posedge i_outclock)
1465
        begin
1466
                if (lpm_outdata === "REGISTERED")
1467
                begin
1468
                        if (ValidAddress(paddress))
1469
                                tmp_q_reg <=  mem_data[paddress];
1470
                        else
1471
                                tmp_q_reg <= UNKNOWN;
1472
                end
1473
        end
1474
 
1475
 
1476
        always @(i_memenab or tmp_q_reg)
1477
        begin
1478
                if (i_memenab)
1479
                        tmp_q <= tmp_q_reg;
1480
                else if (!i_memenab)
1481
                        tmp_q <= HiZ;
1482
        end
1483
 
1484
        assign q = tmp_q;
1485
 
1486
// Check for previous Parameter declaration order
1487
initial if ((lpm_width === "lpm_rom") || (lpm_type !== "lpm_rom"))
1488
  begin
1489
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
1490
    $finish;
1491
  end
1492
endmodule // lpm_rom
1493
 
1494
//------------------------------------------------------------------------
1495
 
1496
module lpm_fifo (data, clock, wrreq, rdreq, aclr, sclr, q, usedw, full, empty);
1497
 
1498
// NOTE: Parameters must be declared in the same order as the Properties
1499
//       are specified in the Cell Specification document.
1500
        parameter lpm_width  = 1;
1501
        parameter lpm_widthu  = 1;
1502
        parameter lpm_numwords = 2;
1503
        parameter lpm_showahead = "OFF";
1504
        parameter lpm_type = "lpm_fifo";
1505
        parameter lpm_hint = "UNUSED";
1506
        parameter lpm_source_version = "lpm 220 version 1.6";
1507
 
1508
        input [lpm_width-1:0] data;
1509
        input clock;
1510
        input wrreq;
1511
        input rdreq;
1512
        input aclr;
1513
        input sclr;
1514
        output [lpm_width-1:0] q;
1515
        output [lpm_widthu-1:0] usedw;
1516
        output full;
1517
        output empty;
1518
 
1519
 
1520
        // internal reg
1521
        reg [lpm_width-1:0] mem_data [lpm_numwords-1:0];
1522
        reg [lpm_width-1:0] tmp_q;
1523
        reg [lpm_width-1:0] ZEROS;
1524
        reg [lpm_widthu+1:0] count_id;
1525
        reg [lpm_widthu-1:0] write_id;
1526
        reg [lpm_widthu-1:0] read_id;
1527
        reg empty_flag;
1528
        reg full_flag;
1529
        integer i;
1530
 
1531
        tri0 aclr;
1532
        tri0 sclr;
1533
 
1534
        buf (i_aclr, aclr);
1535
        buf (i_sclr, sclr);
1536
 
1537
        initial
1538
        begin
1539
 
1540
                if (lpm_width <= 0)
1541
                        $display("Error! lpm_width must be greater than 0.");
1542
 
1543
                if (lpm_numwords <= 1)
1544
                        $display("Error! lpm_numwords must be greater than or equal to 2.");
1545
 
1546
                // check for number of words out of bound
1547
                if ((lpm_widthu !=1) && (lpm_numwords > (1 << lpm_widthu)))
1548
                        $display("Error! lpm_numwords MUST equal to the ceiling of log2(lpm_widthu).");
1549
 
1550
                if (lpm_numwords <= (1 << (lpm_widthu-1)))
1551
                begin
1552
                        $display("Error! lpm_widthu is too big for the specified lpm_numwords.");
1553
                end
1554
 
1555
                for (i=0; i < lpm_width; i=i+1)
1556
                        ZEROS[i] = 1'b0;
1557
 
1558
                for (i = 0; i < lpm_numwords; i=i+1)
1559
                        mem_data[i] = ZEROS;
1560
 
1561
                full_flag = 0;
1562
                empty_flag = 1;
1563
                read_id = 0;
1564
                write_id = 0;
1565
                count_id = 0;
1566
                tmp_q = ZEROS;
1567
        end
1568
 
1569
        always @(posedge clock or i_aclr)
1570
        begin
1571
                if (i_aclr)
1572
                begin
1573
                        tmp_q = ZEROS;
1574
                        full_flag = 0;
1575
                        empty_flag = 1;
1576
                        read_id = 0;
1577
                        write_id = 0;
1578
                        count_id = 0;
1579
                        if (lpm_showahead == "ON")
1580
                                tmp_q = mem_data[0];
1581
                end
1582
                else if (clock)
1583
                begin
1584
                        if (i_sclr)
1585
                        begin
1586
                                tmp_q = mem_data[read_id];
1587
                                full_flag = 0;
1588
                                empty_flag = 1;
1589
                                read_id = 0;
1590
                                write_id = 0;
1591
                                count_id = 0;
1592
                                if (lpm_showahead == "ON")
1593
                                        tmp_q = mem_data[0];
1594
                        end
1595
                        else
1596
                        begin
1597
                                // both WRITE and READ
1598
                                if ((wrreq && !full_flag) && (rdreq && !empty_flag))
1599
                                begin
1600
                                        mem_data[write_id] = data;
1601
                                        if (write_id >= lpm_numwords-1)
1602
                                                write_id = 0;
1603
                                        else
1604
                                                write_id = write_id + 1;
1605
 
1606
                                        tmp_q = mem_data[read_id];
1607
                                        if (read_id >= lpm_numwords-1)
1608
                                                read_id = 0;
1609
                                        else
1610
                                                read_id = read_id + 1;
1611
                                        if (lpm_showahead == "ON")
1612
                                                tmp_q = mem_data[read_id];
1613
                                end
1614
 
1615
                                // WRITE
1616
                                else if (wrreq && !full_flag)
1617
                                begin
1618
                                        mem_data[write_id] = data;
1619
                                        if (lpm_showahead == "ON")
1620
                                                tmp_q = mem_data[read_id];
1621
                                        count_id = count_id + 1;
1622
                                        empty_flag = 0;
1623
                                        if (count_id >= lpm_numwords)
1624
                                        begin
1625
                                                full_flag = 1;
1626
                                                count_id = lpm_numwords;
1627
                                        end
1628
                                        if (write_id >= lpm_numwords-1)
1629
                                                write_id = 0;
1630
                                        else
1631
                                                write_id = write_id + 1;
1632
                                end
1633
 
1634
                                // READ
1635
                                else if (rdreq && !empty_flag)
1636
                                begin
1637
                                        tmp_q = mem_data[read_id];
1638
                                        count_id = count_id - 1;
1639
                                        full_flag = 0;
1640
                                        if (count_id <= 0)
1641
                                        begin
1642
                                                empty_flag = 1;
1643
                                                count_id = 0;
1644
                                        end
1645
                                        if (read_id >= lpm_numwords-1)
1646
                                                read_id = 0;
1647
                                        else
1648
                                                read_id = read_id + 1;
1649
                                        if (lpm_showahead == "ON")
1650
                                                tmp_q = mem_data[read_id];
1651
                                end
1652
                        end
1653
                end
1654
        end
1655
 
1656
        assign q = tmp_q;
1657
        assign full = full_flag;
1658
        assign empty = empty_flag;
1659
        assign usedw = count_id;
1660
 
1661
// Check for previous Parameter declaration order
1662
initial if ((lpm_width === "lpm_fifo") || (lpm_type !== "lpm_fifo"))
1663
  begin
1664
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
1665
    $finish;
1666
  end
1667
endmodule // lpm_fifo
1668
 
1669
//------------------------------------------------------------------------
1670
 
1671
module lpm_fifo_dc ( data, rdclock, wrclock, aclr, rdreq, wrreq, rdfull, wrfull, rdempty, wrempty, rdusedw, wrusedw, q );
1672
 
1673
// NOTE: Parameters must be declared in the same order as the Properties
1674
//       are specified in the Cell Specification document.
1675
        parameter lpm_width = 1;
1676
        parameter lpm_widthu = 1;
1677
        parameter lpm_numwords = 2;
1678
        parameter lpm_showahead = "OFF";
1679
        parameter lpm_type = "lpm_fifo_dc";
1680
        parameter lpm_hint = "UNUSED";
1681
        parameter lpm_source_version = "lpm 220 version 1.6";
1682
 
1683
        input [lpm_width-1:0] data;
1684
        input rdclock;
1685
        input wrclock;
1686
        input wrreq;
1687
        input rdreq;
1688
        input aclr;
1689
        output rdfull;
1690
        output wrfull;
1691
        output rdempty;
1692
        output wrempty;
1693
        output [lpm_width-1:0] q;
1694
        output [lpm_widthu-1:0] rdusedw;
1695
        output [lpm_widthu-1:0] wrusedw;
1696
 
1697
 
1698
        // internal reg
1699
        reg [lpm_width-1:0] mem_data [lpm_numwords-1:0];
1700
        integer pipe_wrptr [0:5];       // [0:RDPTR_DP];
1701
        integer pipe_rdptr [0:5];       // [0:WRPTR_DP];
1702
        integer pipe_rdusedw [0:1];     // [0:RDUSEDW_DP];
1703
        integer pipe_wrusedw [0:1];     // [0:WRUSEDW_DP];
1704
 
1705
        reg [lpm_width-1:0] i_q;
1706
        reg i_rdempty;
1707
        reg i_wrempty;
1708
        reg i_rdfull;
1709
        reg i_wrfull;
1710
        reg x_rdempty;
1711
        reg x_wrfull;
1712
        integer i_rdptr;
1713
        integer i_wrptr;
1714
        integer i_rdusedw;
1715
        integer i_wrusedw;
1716
        integer x_rdptr;
1717
        integer x_wrptr;
1718
 
1719
        reg [lpm_width-1:0] ZEROS;
1720
        integer RDPTR_DP;
1721
        integer WRPTR_DP;
1722
        integer RDUSEDW_DP;
1723
        integer WRUSEDW_DP;
1724
        integer FULL_RISEEARLY;
1725
        integer i;
1726
 
1727
        tri0 aclr;
1728
        buf (i_aclr, aclr);
1729
 
1730
 
1731
        initial
1732
        begin
1733
 
1734
                if (lpm_width <= 0)
1735
                        $display("Error! lpm_width must be greater than 0.");
1736
 
1737
                if (lpm_numwords <= 1)
1738
                        $display("Error! lpm_numwords must be greater than or equal to 2.");
1739
 
1740
                // check for number of words out of bound
1741
                if ((lpm_widthu !=1) && (lpm_numwords > (1 << lpm_widthu)))
1742
                        $display("Error! lpm_numwords MUST equal to the ceiling of log2(lpm_widthu).");
1743
 
1744
                if (lpm_numwords <= (1 << (lpm_widthu-1)))
1745
                        $display("Error! lpm_widthu is too big for the specified lpm_numwords.");
1746
 
1747
                for (i=0; i<lpm_width; i=i+1)
1748
                        ZEROS[i] = 1'b0;
1749
 
1750
                // MEMORY INITIALIZATION
1751
                for (i=0; i<lpm_numwords; i=i+1)
1752
                        mem_data[i] = ZEROS;
1753
 
1754
                // INITERNAL VARIABLES INIT
1755
                i_q = ZEROS;
1756
                i_rdptr = 0;
1757
                i_wrptr = 0;
1758
                i_rdempty = 1;
1759
                i_wrempty = 1;
1760
                i_rdfull = 0;
1761
                i_wrfull = 0;
1762
                i_rdusedw = 0;
1763
                i_wrusedw = 0;
1764
 
1765
                // CONSTANTS
1766
                RDPTR_DP = 5;
1767
                WRPTR_DP = 5;
1768
                RDUSEDW_DP = 1;
1769
                WRUSEDW_DP = 1;
1770
                FULL_RISEEARLY = 2;
1771
 
1772
                // CLEAR PIPELINES
1773
                for (i=0; i<RDPTR_DP; i=i+1)
1774
                        pipe_wrptr[i] = 0;
1775
                for (i=0; i<WRPTR_DP; i=i+1)
1776
                        pipe_rdptr[i] = 0;
1777
                for (i=0; i<RDUSEDW_DP; i=i+1)
1778
                        pipe_rdusedw[i] = 0;
1779
                for (i=0; i<WRUSEDW_DP; i=i+1)
1780
                        pipe_wrusedw[i] = 0;
1781
 
1782
        end
1783
 
1784
        always @(i_aclr)
1785
        begin
1786
                if (i_aclr)
1787
                begin
1788
                        i_q = ZEROS;
1789
                        i_rdptr = 0;
1790
                        i_wrptr = 0;
1791
                        i_rdempty = 1;
1792
                        i_wrempty = 1;
1793
                        i_rdfull = 0;
1794
                        i_wrfull = 0;
1795
                        if (lpm_showahead == "ON")
1796
                                i_q = mem_data[0];
1797
 
1798
                        // CLEAR PIPELINES
1799
                        for (i=0; i<RDPTR_DP; i=i+1)
1800
                                pipe_wrptr[i] = 0;
1801
                        for (i=0; i<WRPTR_DP; i=i+1)
1802
                                pipe_rdptr[i] = 0;
1803
                        for (i=0; i<RDUSEDW_DP; i=i+1)
1804
                                pipe_rdusedw[i] = 0;
1805
                        for (i=0; i<WRUSEDW_DP; i=i+1)
1806
                                pipe_wrusedw[i] = 0;
1807
                end
1808
        end
1809
 
1810
        always @(posedge wrclock)
1811
        begin
1812
                if (!i_aclr)
1813
                begin
1814
                        // SET FLAGS
1815
                        x_wrfull = i_wrfull;
1816
                        if (i_wrusedw >= lpm_numwords-1-FULL_RISEEARLY)
1817
                                i_wrfull = 1;
1818
                        else
1819
                                i_wrfull = 0;
1820
 
1821
                        if ((i_wrusedw <= 0) && (i_rdptr == i_wrptr))
1822
                                i_wrempty = 1;
1823
 
1824
                        x_wrptr = i_wrptr;
1825
                        if (wrreq && !x_wrfull)  // && ! wrreq'event
1826
                        begin
1827
                                // WRITE DATA
1828
                                mem_data[i_wrptr] = data;
1829
 
1830
                                // SET FLAGS
1831
                                i_wrempty = 0;
1832
 
1833
                                // INC WRPTR
1834
                                if (i_wrptr >= lpm_numwords-1)
1835
                                        i_wrptr = 0;
1836
                                else
1837
                                        i_wrptr = i_wrptr + 1;
1838
                        end
1839
 
1840
                        // DELAY RDPTR FOR WRUSEDW
1841
                        pipe_rdptr[WRPTR_DP] = i_rdptr;
1842
                        for (i=0; i<WRPTR_DP; i=i+1)
1843
                                pipe_rdptr[i] = pipe_rdptr[i+1];
1844
                        if (x_wrptr >= pipe_rdptr[0])
1845
                                pipe_wrusedw[WRUSEDW_DP] = x_wrptr - pipe_rdptr[0];
1846
                        else
1847
                                pipe_wrusedw[WRUSEDW_DP] = lpm_numwords + x_wrptr - pipe_rdptr[0];
1848
 
1849
                        // DELAY WRUSEDW
1850
                        for (i=0; i<WRUSEDW_DP; i=i+1)
1851
                                pipe_wrusedw[i] = pipe_wrusedw[i+1];
1852
                        i_wrusedw = pipe_wrusedw[0];
1853
                end
1854
        end
1855
 
1856
        always @(posedge rdclock)
1857
        begin
1858
                if (!i_aclr)
1859
                begin
1860
                        // SET FLAGS
1861
                        x_rdempty = i_rdempty;
1862
                        if (i_rdusedw >= lpm_numwords-1-FULL_RISEEARLY)
1863
                                i_rdfull = 1;
1864
                        else
1865
                                i_rdfull = 0;
1866
 
1867
                        if (i_rdptr == i_wrptr)
1868
                                i_rdempty = 1;
1869
                        else if (i_rdempty && (i_rdusedw > 0))
1870
                                i_rdempty = 0;
1871
 
1872
                        // Q SHOWAHEAD
1873
                        if (lpm_showahead == "ON" && i_rdptr != i_wrptr)
1874
                                i_q = mem_data[i_rdptr];
1875
 
1876
                        x_rdptr = i_rdptr;
1877
                        if (rdreq && !x_rdempty)  // && ! rdreq'event
1878
                        begin
1879
                                // READ DATA
1880
                                i_q = mem_data[i_rdptr];
1881
                                if (lpm_showahead == "ON")
1882
                                begin
1883
                                        if (i_rdptr == i_wrptr)
1884
                                                i_q = ZEROS;
1885
                                        else
1886
                                        begin
1887
                                                if (i_rdptr >= lpm_numwords-1)
1888
                                                        i_q = mem_data[0];
1889
                                                else
1890
                                                        i_q = mem_data[i_rdptr+1];
1891
                                        end
1892
                                end
1893
 
1894
                                // SET FLAGS
1895
                                if ((i_rdptr == lpm_numwords-1 && i_wrptr == 0) ||
1896
                                        (i_rdptr+1 == i_wrptr))
1897
                                        i_rdempty = 1;
1898
 
1899
                                // INC RDPTR
1900
                                if (i_rdptr >= lpm_numwords-1)
1901
                                        i_rdptr = 0;
1902
                                else
1903
                                        i_rdptr = i_rdptr + 1;
1904
 
1905
                        end
1906
                        // DELAY WRPTR FOR RDUSEDW
1907
                        pipe_wrptr[RDPTR_DP] = i_wrptr;
1908
                        for (i=0; i<RDPTR_DP; i=i+1)
1909
                                pipe_wrptr[i] = pipe_wrptr[i+1];
1910
                        if (pipe_wrptr[0] >= x_rdptr)
1911
                                pipe_rdusedw[RDUSEDW_DP] = pipe_wrptr[0] - x_rdptr;
1912
                        else
1913
                                pipe_rdusedw[RDUSEDW_DP] = lpm_numwords + pipe_wrptr[0] - x_rdptr;
1914
 
1915
                        // DELAY RDUSEDW
1916
                        for (i=0; i<RDUSEDW_DP; i=i+1)
1917
                                pipe_rdusedw[i] = pipe_rdusedw[i+1];
1918
                        i_rdusedw = pipe_rdusedw[0];
1919
                end
1920
        end
1921
 
1922
        assign q = i_q;
1923
        assign wrfull = i_wrfull;
1924
        assign wrempty = i_wrempty;
1925
        assign rdfull = i_rdfull;
1926
        assign rdempty = i_rdempty;
1927
        assign wrusedw = i_wrusedw;
1928
        assign rdusedw = i_rdusedw;
1929
 
1930
// Check for previous Parameter declaration order
1931
initial if ((lpm_width === "lpm_fifo_dc") || (lpm_type !== "lpm_fifo_dc"))
1932
  begin
1933
    $display ("LPM 220 Version 1.6 Parameter Order changed; update instantiation");
1934
    $finish;
1935
  end
1936
endmodule // lpm_fifo_dc

powered by: WebSVN 2.1.0

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