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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [src/] [CODING_BUFFER_64_32.vhd] - Blame information for rev 9

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

Line No. Rev Author Line
1 8 eejlny
--This library is free software; you can redistribute it and/or
2
--modify it under the terms of the GNU Lesser General Public
3
--License as published by the Free Software Foundation; either
4
--version 2.1 of the License, or (at your option) any later version.
5
 
6
--This library is distributed in the hope that it will be useful,
7
--but WITHOUT ANY WARRANTY; without even the implied warranty of
8
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9
--Lesser General Public License for more details.
10
 
11
--You should have received a copy of the GNU Lesser General Public
12
--License along with this library; if not, write to the Free Software
13
--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
14
 
15
-- e_mail : j.l.nunez-yanez@byacom.co.uk
16
 
17
---------------------------------------------
18
 
19
--  ENTITY       = CODING_BUFFER_64_32     --
20
 
21
--  version      = 1.0                     --
22
 
23
--  last update  = 30/05/00                --
24
 
25
--  author       = Jose Nunez              --
26
 
27
--  modified:      Vassilios A. Chouliaras
28
 
29
---------------------------------------------
30
 
31
 
32
 
33
 
34
 
35
-- FUNCTION
36
 
37
-- Apapter that changes the 64 bit parallel interface to a 32 bit parallel
38
 
39
-- 256x64 bit word to handle block sizes up to 64Kbytes without stopping the input due to overflow.
40
 
41
 
42
 
43
--  PIN LIST
44
 
45
 
46
 
47
--  START = activate the buffer
48
 
49
--  FINISHED = the block has been process. empty buffer
50
 
51
--  OVERFLOW = 64 bit of compressed data available.
52
 
53
--  DATA_IN_64  = input data from the 64 bit out register in X-MatchPRO
54
 
55
--  THRESHOLD_LEVEL = input treshold to start outputting data. Latency control.
56
 
57
--  BUS_ACKNOWLEDGE = The 32 bit wide output bus is available.
58
 
59
--  DATA_OUT_32  = output data to the 32 bit wide output bus
60
 
61
--  OVERFLOW_DETECTED = output to the control unit buffer overflow. Stop inputting data
62
 
63
--  UNDERFLOW_DETECTED = output to the control unit buffer overflow. Stop outputting data. The bus is free.
64
 
65
--  BUS_REQUEST = output requesting bus to output compressed data
66
 
67
--  CLEAR    = asynchronous clear
68
 
69
--  CLK      = master clock
70
 
71
 
72
 
73
 
74
 
75
library ieee,dzx;
76
 
77
use ieee.std_logic_1164.all;
78
 
79
use IEEE.std_logic_arith.all;
80
 
81
use dzx.bit_arith.all;
82
 
83
library xil_lib;
84
use xil_lib.xil_comp.all;
85
 
86
use work.tech_package.all;
87
 
88
 
89
 
90
 
91
 
92
entity CODING_BUFFER_64_32 is
93
 
94
port
95
 
96
(
97
 
98
  FORCE_STOP : in bit;
99
 
100
        START : in bit;
101
 
102
        FINISHED : in bit;
103
 
104
        OVERFLOW : in bit;
105
 
106
        SHORT : in bit;
107
 
108
   WAITN : in bit;
109
 
110
        DATA_IN_64 : in bit_vector(63 downto 0);
111
 
112
        THRESHOLD_LEVEL : in bit_vector(8 downto 0);
113
 
114
        BUS_ACKNOWLEDGE : in bit;
115
 
116
        CLEAR : in bit ;
117
 
118
        CLK : in bit ;
119
 
120
        DATA_OUT_32: out std_logic_vector(31 downto 0);
121
 
122
        ENABLE_READ : out bit;
123
 
124
        FLUSHING : out bit;
125
 
126
        OVERFLOW_DETECTED : out bit;
127
 
128
        UNDERFLOW_DETECTED : out bit;
129
 
130
        FINISH : out bit;
131
 
132
        DATA_VALID : out bit; -- data in the compressed bus is valid
133
 
134
        BUS_REQUEST : out bit
135
 
136
);
137
 
138
 
139
 
140
 
141
 
142
end CODING_BUFFER_64_32;
143
 
144
 
145
 
146
 
147
 
148
architecture STRUCTURAL of CODING_BUFFER_64_32 is
149
 
150
 
151
 
152
-- xilinx memory
153
 
154
 
155
 
156
component DP_RAM_XILINX_256
157
 
158
        port (
159
 
160
        addra: IN std_logic_VECTOR(7 downto 0);
161
 
162
        clka: IN std_logic;
163
 
164
        addrb: IN std_logic_VECTOR(7 downto 0);
165
 
166
        clkb: IN std_logic;
167
 
168
        dina: IN std_logic_VECTOR(31 downto 0);
169
 
170
        wea: IN std_logic;
171
 
172
        enb: IN std_logic;
173
 
174
        doutb: OUT std_logic_VECTOR(31 downto 0));
175
 
176
end component;
177
 
178
 
179
 
180
-- Synplicity black box declaration
181
 
182
--attribute black_box : boolean;
183
 
184
--attribute black_box of DP_RAM_XILINX: component is true;
185
 
186
 
187
 
188
-- Actel memory
189
 
190
 
191
 
192
-- component MY_MEMORY
193
 
194
 
195
 
196
--   port(DO : out std_logic_vector (31 downto 0);
197
 
198
--      RCLOCK : in std_logic;
199
 
200
--      WCLOCK : in std_logic;
201
 
202
--      DI : in std_logic_vector (31 downto 0);
203
 
204
--      WRB : in std_logic;
205
 
206
--      RDB : in std_logic;
207
 
208
--      WADDR : in std_logic_vector (7 downto 0);
209
 
210
--      RADDR : in std_logic_vector (7 downto 0));
211
 
212
 
213
 
214
--end component;
215
 
216
 
217
 
218
 
219
 
220
 
221
 
222
 
223
 
224
--component syn_dpram_256x32_rawr
225
 
226
--port (
227
 
228
--              Data : in std_logic_vector(31 downto 0);
229
 
230
--              RdAddress : in std_logic_vector(7 downto 0);
231
 
232
--              WrAddress : in std_logic_vector(7 downto 0);
233
 
234
--              RdEn : in std_logic;
235
 
236
--              WrEn : in std_logic;
237
 
238
--              Q : out std_logic_vector(31 downto 0);
239
 
240
--              RdClock : in std_logic;
241
 
242
--              RdClken : in std_logic;
243
 
244
--              WrClock : in std_logic;
245
 
246
--              WrClken : in std_logic
247
 
248
--           );
249
 
250
--end component;
251
 
252
 
253
 
254
--component LPM_RAM_DP
255
--
256
--      generic (LPM_WIDTH    : positive;
257
--
258
--               LPM_WIDTHAD  : positive;
259
--
260
--               LPM_NUMWORDS : positive;
261
--
262
--               LPM_INDATA   : string;
263
--
264
--               LPM_RDADDRESS_CONTROL : string;
265
--
266
--               LPM_WRADDRESS_CONTROL : string;
267
--
268
--               LPM_OUTDATA  : string;
269
--
270
--               LPM_TYPE     : string;
271
--
272
--               LPM_FILE     : string;
273
--
274
--             LPM_HINT     : string);
275
--
276
--      port (RDCLOCK : in std_logic;
277
--
278
--            RDCLKEN : in std_logic;
279
--
280
--            RDADDRESS : in std_logic_vector(7 downto 0);
281
--
282
--            RDEN : in std_logic;
283
--
284
--            DATA : in std_logic_vector(31 downto 0);
285
--
286
--            WRADDRESS : in std_logic_vector(7 downto 0);
287
--
288
--            WREN : in std_logic;
289
--
290
--            WRCLOCK : in std_logic;
291
--
292
--            WRCLKEN : in std_logic;
293
--
294
--            Q : out std_logic_vector(31 downto 0));
295
--
296
--end component;
297
 
298
 
299
 
300
--attribute noopt: boolean;
301
 
302
--attribute noopt of LPM_RAM_DP: component is true;
303
 
304
-- TSMC DPRAM
305
 
306
  component ra2sh_256W_32B_8MX_offWRMSK_8WRGRAN
307
 
308
 
309
 
310
  port (
311
 
312
        CLKA: in std_logic;
313
 
314
        CENA: in std_logic;
315
 
316
        WENA: in std_logic;
317
 
318
        AA: in std_logic_vector(7 downto 0);
319
 
320
        DA: in std_logic_vector(31 downto 0);
321
 
322
        QA: out std_logic_vector(31 downto 0);
323
 
324
        CLKB: in std_logic;
325
 
326
        CENB: in std_logic;
327
 
328
        WENB: in std_logic;
329
 
330
        AB: in std_logic_vector(7 downto 0);
331
 
332
        DB: in std_logic_vector(31 downto 0);
333
 
334
        QB: out std_logic_vector(31 downto 0)
335
 
336
    );
337
 
338
    end component;
339
 
340
 
341
 
342
component CODING_BUFFER_CU
343
 
344
 
345
 
346
port (
347
 
348
    WAITN   : in bit;
349
 
350
    FORCE_STOP: in bit;
351
 
352
          START : in bit;
353
 
354
          FINISHED : in bit;
355
 
356
          BUS_ACKNOWLEDGE : in bit;
357
 
358
          THRESHOLD_LEVEL : in bit_vector(8 downto 0);
359
 
360
          CODING_READ_ADDRESS : in bit_vector(8 downto 0);
361
 
362
          CODING_WRITE_ADDRESS : in bit_vector(8 downto 0);
363
 
364
          CLK : in bit;
365
 
366
          CLEAR : in bit;
367
 
368
          BUS_REQUEST : out bit;
369
 
370
          FLUSHING : out bit;
371
 
372
          FINISH : out bit;
373
 
374
        CLEAR_COUNTERS : out bit;
375
 
376
          CODING_OVERFLOW : out bit;
377
 
378
          CODING_UNDERFLOW : out bit;
379
 
380
          ENABLE_WRITE : out bit;
381
 
382
          ENABLE_READ : out bit
383
 
384
         );
385
 
386
end component;
387
 
388
 
389
 
390
 
391
 
392
component BUFFER_COUNTER_READ
393
 
394
 
395
 
396
port (
397
 
398
     ENABLE : in bit;
399
 
400
          CLEAR : in bit;
401
 
402
          CLEAR_COUNTERS : in bit;
403
 
404
          CLK : in bit;
405
 
406
          COUNT : out bit_vector(8 downto 0)
407
 
408
     );
409
 
410
 
411
 
412
end component;
413
 
414
 
415
 
416
component BUFFER_COUNTER_WRITE
417
 
418
 
419
 
420
port (ENABLE : in bit;
421
 
422
        SHORT : in bit; -- only write 32 bits
423
 
424
          CLEAR : in bit;
425
 
426
          CLEAR_COUNTERS : in bit;
427
 
428
          CLK : in bit;
429
 
430
          COUNT : out bit_vector(8 downto 0)
431
 
432
     );
433
 
434
 
435
 
436
end component;
437
 
438
 
439
 
440
 
441
 
442
-- 1 bit for the 64-to-32 multiplexor
443
 
444
 
445
 
446
signal CODING_READ_ADDRESS : bit_vector(8 downto 0);
447
 
448
signal CODING_WRITE_ADDRESS : bit_vector(8 downto 0);
449
 
450
signal CODING_OVERFLOW : bit;
451
 
452
signal CODING_UNDERFLOW : bit;
453
 
454
signal ENABLE_WRITE : bit;
455
 
456
signal DATA_OUT_AUX : std_logic_vector(63 downto 0);
457
 
458
signal READ_CLK : bit;
459
 
460
signal WRITE_CLK : bit;
461
 
462
signal WRITE_CLK_ENABLE : bit;
463
 
464
signal READ_CLK_ENABLE : bit;
465
 
466
signal ENABLE_READ_INT : bit;
467
 
468
signal ENABLE_WRITE_INT : bit;
469
 
470
signal BUS_REQUEST_INT : bit;
471
 
472
signal CLEAR_COUNTERS : bit;
473
 
474
 
475
 
476
signal DATA_MSB :std_logic_vector(31 downto 0);
477
 
478
signal RDADDRESS_MSB :std_logic_vector(7 downto 0);
479
 
480
signal WRADDRESS_MSB :std_logic_vector(7 downto 0);
481
 
482
signal RDEN_MSB :std_logic;
483
 
484
signal WREN_MSB :std_logic;
485
 
486
signal RDCLOCK_MSB :std_logic;
487
 
488
signal RDCLKEN_MSB :std_logic;
489
 
490
signal WRCLOCK_MSB :std_logic;
491
 
492
signal WRCLKEN_MSB :std_logic;
493
 
494
 
495
 
496
signal DATA_LSB :std_logic_vector(31 downto 0);
497
 
498
signal RDADDRESS_LSB :std_logic_vector(7 downto 0);
499
 
500
signal WRADDRESS_LSB :std_logic_vector(7 downto 0);
501
 
502
signal RDEN_LSB :std_logic;
503
 
504
signal WREN_LSB :std_logic;
505
 
506
signal RDCLOCK_LSB :std_logic;
507
 
508
signal RDCLKEN_LSB :std_logic;
509
 
510
signal WRCLOCK_LSB :std_logic;
511
 
512
signal WRCLKEN_LSB :std_logic;
513
 
514
 
515
 
516
signal tsmc_lsb_cena_n , tsmc_lsb_cenb_n : std_logic;
517
 
518
signal tsmc_lsb_wena_n , tsmc_lsb_wenb_n : std_logic;
519
 
520
signal tsmc_msb_cena_n , tsmc_msb_cenb_n : std_logic;
521
 
522
signal tsmc_msb_wena_n , tsmc_msb_wenb_n : std_logic;
523
 
524
 
525
 
526
 
527
 
528
begin
529
 
530
 
531
 
532
 
533
 
534
 
535
 
536
 
537
 
538
CONTROL_UNIT : CODING_BUFFER_CU
539
 
540
port map(
541
 
542
    WAITN => WAITN,
543
 
544
    FORCE_STOP => FORCE_STOP,
545
 
546
          START => START,
547
 
548
          FINISHED => FINISHED,
549
 
550
          BUS_ACKNOWLEDGE => BUS_ACKNOWLEDGE,
551
 
552
          THRESHOLD_LEVEL => THRESHOLD_LEVEL,
553
 
554
          CODING_READ_ADDRESS => CODING_READ_ADDRESS,
555
 
556
          CODING_WRITE_ADDRESS => CODING_WRITE_ADDRESS,
557
 
558
          CLK => CLK,
559
 
560
          CLEAR => CLEAR,
561
 
562
          CODING_OVERFLOW => CODING_OVERFLOW,
563
 
564
          CODING_UNDERFLOW=> CODING_UNDERFLOW,
565
 
566
          ENABLE_WRITE => ENABLE_WRITE_INT,
567
 
568
          ENABLE_READ => ENABLE_READ_INT,
569
 
570
          FLUSHING => FLUSHING,
571
 
572
          FINISH => FINISH,
573
 
574
        CLEAR_COUNTERS => CLEAR_COUNTERS,
575
 
576
          BUS_REQUEST => BUS_REQUEST_INT
577
 
578
         );
579
 
580
 
581
 
582
 
583
 
584
OVERFLOW_DETECTED <= CODING_OVERFLOW;
585
 
586
UNDERFLOW_DETECTED <= CODING_UNDERFLOW;
587
 
588
 
589
 
590
READ_COUNTER : BUFFER_COUNTER_READ
591
 
592
port map(
593
 
594
     ENABLE => READ_CLK_ENABLE,
595
 
596
          CLEAR => CLEAR,
597
 
598
          CLEAR_COUNTERS => CLEAR_COUNTERS,
599
 
600
          CLK => CLK,
601
 
602
          COUNT => CODING_READ_ADDRESS
603
 
604
     );
605
 
606
 
607
 
608
 
609
 
610
WRITE_COUNTER : BUFFER_COUNTER_WRITE
611
 
612
port map(ENABLE => ENABLE_WRITE,
613
 
614
                SHORT => SHORT,
615
 
616
          CLEAR =>CLEAR,
617
 
618
         CLEAR_COUNTERS => CLEAR_COUNTERS,
619
 
620
          CLK => CLK,
621
 
622
          COUNT => CODING_WRITE_ADDRESS
623
 
624
     );
625
 
626
 
627
 
628
 
629
 
630
RAM_MSB : DP_RAM_XILINX_256
631
 
632
                port map (
633
 
634
                        addra => WRADDRESS_MSB,
635
 
636
                        clka =>  WRCLOCK_MSB,
637
 
638
                        addrb => RDADDRESS_MSB,
639
 
640
                        clkb => RDCLOCK_MSB,
641
 
642
                        dina => DATA_MSB,
643
 
644
                        wea => WREN_MSB,
645
 
646
                        enb =>  RDEN_MSB,
647
 
648
                        doutb =>  DATA_OUT_AUX(63 downto 32));
649
 
650
 
651
 
652
-- Actel memory
653
 
654
 
655
 
656
-- RAM_MSB : MY_MEMORY
657
 
658
-- port map(DO => DATA_OUT_AUX(63 downto 32),
659
 
660
--      RCLOCK =>RDCLOCK_MSB,
661
 
662
--      WCLOCK =>WRCLOCK_MSB,
663
 
664
--      DI => DATA_MSB,
665
 
666
--      WRB => WREN_MSB,
667
 
668
--      RDB =>RDEN_MSB,
669
 
670
--      WADDR => WRADDRESS_MSB,
671
 
672
--     RADDR => RDADDRESS_MSB
673
 
674
--);
675
 
676
 
677
 
678
-- Altera memory
679
 
680
 
681
 
682
--ALT_RAM_MSB :
683
--
684
--if (not TSMC013) generate
685
--
686
--RAM_MSB : LPM_RAM_DP
687
--
688
--generic map(LPM_WIDTH => 32,
689
--
690
--         LPM_WIDTHAD  => 8,
691
--
692
--         LPM_NUMWORDS => 256,
693
--
694
--          LPM_INDATA => "REGISTERED",
695
--
696
--         LPM_OUTDATA  =>  "UNREGISTERED",
697
--
698
--          LPM_RDADDRESS_CONTROL => "REGISTERED",
699
--
700
--               LPM_WRADDRESS_CONTROL => "REGISTERED",
701
--
702
--               LPM_FILE  => "UNUSED",
703
--
704
--               LPM_TYPE  => "LPM_RAM_DP",
705
--
706
--               LPM_HINT => "UNUSED")         
707
--
708
--port map(
709
--
710
--              DATA=> DATA_MSB,
711
--
712
--              RDADDRESS=> RDADDRESS_MSB,
713
--
714
--              WRADDRESS=> WRADDRESS_MSB,
715
--
716
--              RDEN=> RDEN_MSB,
717
--
718
--              WREN=> WREN_MSB,
719
--
720
--              Q=> DATA_OUT_AUX(63 downto 32),
721
--
722
--              RDCLOCK=> RDCLOCK_MSB,
723
--
724
--              RDCLKEN=> RDCLKEN_MSB,
725
--
726
--              WRCLOCK=> WRCLOCK_MSB,
727
--
728
--              WRCLKEN=> WRCLKEN_MSB
729
--
730
--);
731
--
732
--end generate;
733
--
734
 
735
 
736
 
737
 
738
-- Port 1 = R
739
 
740
-- Port 2 = R/W
741
 
742
--TSMC013_RAM_MSB :
743
--
744
--  if (TSMC013) generate
745
--
746
--    TMSC_RAM : ra2sh_256W_32B_8MX_offWRMSK_8WRGRAN port map
747
--
748
--      (
749
--
750
--        clka        =>      RDCLOCK_MSB,
751
--
752
--        cena        =>      tsmc_msb_cena_n ,
753
--
754
--        wena        =>      tsmc_msb_wena_n,
755
--
756
--        aa          =>      RDADDRESS_MSB,
757
--
758
--        da          =>      DATA_MSB,
759
--
760
--        qa          =>      DATA_OUT_AUX(63 downto 32),
761
--
762
--        clkb        =>      WRCLOCK_MSB,
763
--
764
--        cenb        =>      tsmc_msb_cenb_n,
765
--
766
--        wenb        =>      tsmc_msb_wenb_n,
767
--
768
--        ab          =>      WRADDRESS_MSB,
769
--
770
--        db          =>      DATA_MSB,
771
--
772
--        qb          =>      OPEN
773
--
774
--      ) ;      
775
--
776
--end generate;
777
 
778
 
779
 
780
 
781
 
782
 
783
 
784
tsmc_msb_cenb_n <= not (WRCLKEN_MSB);
785
 
786
tsmc_msb_cena_n <= not (RDCLKEN_MSB);
787
 
788
tsmc_msb_wena_n <='1';
789
 
790
--    not (RDEN_SB); Always in read-mode; read-enable used to
791
 
792
--    power-up ram
793
 
794
tsmc_msb_wenb_n <= not (WRCLKEN_MSB);
795
 
796
 
797
 
798
 
799
 
800
DATA_MSB<=To_X01Z(DATA_IN_64(63 downto 32))  after 5 ns ;
801
 
802
RDADDRESS_MSB<= To_X01Z(CODING_READ_ADDRESS(8 downto 1))  after 5 ns ;
803
 
804
WRADDRESS_MSB<= To_X01Z(CODING_WRITE_ADDRESS(8 downto 1))  after 5 ns ;
805
 
806
RDEN_MSB<= To_X01Z(ENABLE_READ_INT)  after 5 ns ;
807
 
808
WREN_MSB<= To_X01Z(ENABLE_WRITE)  after 5 ns;
809
 
810
RDCLOCK_MSB<= To_X01Z(READ_CLK);
811
 
812
RDCLKEN_MSB<= To_X01Z(READ_CLK_ENABLE) after 5 ns ;
813
 
814
WRCLOCK_MSB<= To_X01Z(WRITE_CLK);
815
 
816
WRCLKEN_MSB<= To_X01Z(WRITE_CLK_ENABLE) after 5 ns ;
817
 
818
 
819
 
820
--RAM_MSB : syn_dpram_256x32_rawr
821
 
822
--port map(
823
 
824
--              DATA=>To_X01Z(DATA_IN_64(63 downto 32)),
825
 
826
--              RDADDRESS=> To_X01Z(CODING_READ_ADDRESS),
827
 
828
--              WRADDRESS=> To_X01Z(CODING_WRITE_ADDRESS),
829
 
830
--              RDEN=> To_X01Z(ENABLE_READ_INT),
831
 
832
--              WREN=> To_X01Z(ENABLE_WRITE),
833
 
834
--              Q=> DATA_OUT_AUX(63 downto 32),
835
 
836
--              RDCLOCK=> To_X01Z(READ_CLK),
837
 
838
--              RDCLKEN=> To_X01Z(READ_CLK_ENABLE),
839
 
840
--              WRCLOCK=> To_X01Z(WRITE_CLK),
841
 
842
--              WRCLKEN=> To_X01Z(WRITE_CLK_ENABLE)
843
 
844
--);
845
 
846
 
847
 
848
RAM_LSB : DP_RAM_XILINX_256
849
 
850
                port map (
851
 
852
                        addra => WRADDRESS_LSB,
853
 
854
                        clka =>  WRCLOCK_LSB,
855
 
856
                        addrb => RDADDRESS_LSB,
857
 
858
                        clkb => RDCLOCK_LSB,
859
 
860
                        dina => DATA_LSB,
861
 
862
                        wea => WREN_LSB,
863
 
864
                        enb =>  RDEN_LSB,
865
 
866
                        doutb =>  DATA_OUT_AUX(31 downto 0));
867
 
868
 
869
 
870
 
871
 
872
-- Actel memory
873
 
874
 
875
 
876
--RAM_LSB : MY_MEMORY
877
--
878
--port map(DO => DATA_OUT_AUX(31 downto 0),
879
--
880
--      RCLOCK =>RDCLOCK_LSB,
881
--
882
--      WCLOCK =>WRCLOCK_LSB,
883
--
884
--      DI => DATA_LSB,
885
--
886
--      WRB => WREN_LSB,
887
--
888
--      RDB =>RDEN_LSB,
889
--
890
--      WADDR => WRADDRESS_LSB,
891
--
892
--      RADDR => RDADDRESS_LSB
893
--
894
--);
895
 
896
 
897
 
898
-- Altera memory
899
 
900
--ALT_RAM_LSB :
901
--
902
--if (not TSMC013) generate
903
--
904
--RAM_LSB : LPM_RAM_DP
905
--
906
--generic map(LPM_WIDTH => 32,
907
--
908
--         LPM_WIDTHAD  => 8,
909
--
910
--         LPM_NUMWORDS => 256,
911
--
912
--         LPM_INDATA => "REGISTERED",
913
--
914
--         LPM_OUTDATA  =>  "UNREGISTERED",
915
--
916
--         LPM_RDADDRESS_CONTROL => "REGISTERED",
917
--
918
--         LPM_WRADDRESS_CONTROL => "REGISTERED",
919
--
920
--           LPM_FILE  => "UNUSED",
921
--
922
--               LPM_TYPE  => "LPM_RAM_DP",
923
--
924
--               LPM_HINT => "UNUSED")         
925
--
926
--port map(
927
--
928
--              DATA=> DATA_LSB,
929
--
930
--              RDADDRESS=> RDADDRESS_LSB,
931
--
932
--              WRADDRESS=> WRADDRESS_LSB,
933
--
934
--              RDEN=> RDEN_LSB,
935
--
936
--             WREN=> WREN_LSB,
937
--
938
--              Q=> DATA_OUT_AUX(31 downto 0),
939
--
940
--              RDCLOCK=> RDCLOCK_LSB,
941
--
942
--              RDCLKEN=> RDCLKEN_LSB,
943
--
944
--              WRCLOCK=> WRCLOCK_LSB,
945
--
946
--              WRCLKEN=> WRCLKEN_LSB
947
--
948
--);
949
--
950
--end generate;
951
 
952
 
953
 
954
 
955
 
956
-- Port 1 = R
957
 
958
-- Port 2 = R/W
959
 
960
--TSMC013_RAM_LSB :
961
--
962
--  if (TSMC013) generate
963
--
964
--    TMSC_RAM : ra2sh_256W_32B_8MX_offWRMSK_8WRGRAN port map
965
--
966
--      (
967
--
968
--        clka        =>      RDCLOCK_LSB,
969
--
970
--        cena        =>      tsmc_lsb_cena_n ,
971
--
972
--        wena        =>      tsmc_lsb_wena_n,
973
--
974
--        aa          =>      RDADDRESS_LSB,
975
--
976
--        da          =>      DATA_LSB,
977
--
978
--        qa          =>      DATA_OUT_AUX(31 downto 0),
979
--
980
--        clkb        =>      WRCLOCK_LSB,
981
--
982
--        cenb        =>      tsmc_lsb_cenb_n,
983
--
984
--        wenb        =>      tsmc_lsb_wenb_n,
985
--
986
--        ab          =>      WRADDRESS_LSB,
987
--
988
--        db          =>      DATA_LSB,
989
--
990
--        qb          =>      OPEN
991
--
992
--      ) ;      
993
--
994
--end generate;
995
 
996
 
997
 
998
 
999
 
1000
 
1001
 
1002
tsmc_lsb_cenb_n <= not (WRCLKEN_LSB);
1003
 
1004
tsmc_lsb_cena_n <= not (RDCLKEN_LSB);
1005
 
1006
tsmc_lsb_wena_n <='1';
1007
 
1008
--    not (RDEN_SB); Always in read-mode; read-enable used to
1009
 
1010
--    power-up ram
1011
 
1012
tsmc_lsb_wenb_n <= not (WRCLKEN_LSB);
1013
 
1014
 
1015
 
1016
 
1017
 
1018
 
1019
 
1020
 
1021
 
1022
DATA_LSB<=To_X01Z(DATA_IN_64(31 downto 0)) after 5 ns;
1023
 
1024
RDADDRESS_LSB<= To_X01Z(CODING_READ_ADDRESS(8 downto 1)) after 5 ns;
1025
 
1026
WRADDRESS_LSB<= To_X01Z(CODING_WRITE_ADDRESS(8 downto 1)) after 5 ns;
1027
 
1028
RDEN_LSB<= To_X01Z(ENABLE_READ_INT) after 5 ns;
1029
 
1030
WREN_LSB<= To_X01Z(ENABLE_WRITE) after 5 ns;
1031
 
1032
RDCLOCK_LSB<= To_X01Z(READ_CLK);
1033
 
1034
RDCLKEN_LSB<= To_X01Z(READ_CLK_ENABLE) after 5 ns;
1035
 
1036
WRCLOCK_LSB<= To_X01Z(WRITE_CLK);
1037
 
1038
WRCLKEN_LSB<= To_X01Z(WRITE_CLK_ENABLE) after 5 ns;
1039
 
1040
 
1041
 
1042
 
1043
 
1044
--RAM_LSB : syn_dpram_256x32_rawr
1045
 
1046
--port map(
1047
 
1048
--              DATA=>To_X01Z(DATA_IN_64(31 downto 0)),
1049
 
1050
--              RDADDRESS=> To_X01Z(CODING_READ_ADDRESS),
1051
 
1052
--              WRADDRESS=> To_X01Z(CODING_WRITE_ADDRESS),
1053
 
1054
--              RDEN=> To_X01Z(ENABLE_READ_INT),
1055
 
1056
--              WREN=> To_X01Z(ENABLE_WRITE),
1057
 
1058
--              Q=> DATA_OUT_AUX(31 downto 0),
1059
 
1060
--              RDCLOCK=> To_X01Z(READ_CLK),
1061
 
1062
--              RDCLKEN=> To_X01Z(READ_CLK_ENABLE),
1063
 
1064
--              WRCLOCK=> To_X01Z(WRITE_CLK),
1065
 
1066
--              WRCLKEN=> To_X01Z(WRITE_CLK_ENABLE)
1067
 
1068
--);
1069
 
1070
 
1071
 
1072
 
1073
 
1074
DATA_VALID_PROCESS : process (CLK,CLEAR,WAITN)
1075
 
1076
variable DATA_VALID_AUX : bit;
1077
 
1078
begin
1079
 
1080
 
1081
 
1082
     if (CLEAR = '0') then
1083
 
1084
            DATA_VALID_AUX := '1';
1085
 
1086
         elsif ((CLK'event) and (CLK = '1')) then
1087
 
1088
     if(WAITN = '0') then
1089
 
1090
        DATA_VALID_AUX := DATA_VALID_AUX; -- keep state
1091
 
1092
                elsif(CODING_UNDERFLOW = '1') then
1093
 
1094
        --      if(READ_ADDRESS + "00000001" = CODING_WRITE_ADDRESS) then
1095
 
1096
                        DATA_VALID_AUX := '1';
1097
 
1098
                elsif (READ_CLK_ENABLE = '1') then
1099
 
1100
                DATA_VALID_AUX := '0';
1101
 
1102
                else
1103
 
1104
                DATA_VALID_AUX := DATA_VALID_AUX;
1105
 
1106
                end if;
1107
 
1108
        end if;
1109
 
1110
DATA_VALID <= DATA_VALID_AUX or not(WAITN);
1111
 
1112
end process DATA_VALID_PROCESS;
1113
 
1114
 
1115
 
1116
 
1117
 
1118
DATA_OUT_32 <= DATA_OUT_AUX(63 downto 32) when CODING_READ_ADDRESS(0) = '1' else DATA_OUT_AUX(31 downto 0);
1119
 
1120
WRITE_CLK <= CLK;
1121
 
1122
READ_CLK <= CLK;
1123
 
1124
ENABLE_WRITE <= ENABLE_WRITE_INT and not(OVERFLOW);
1125
 
1126
ENABLE_READ <= ENABLE_READ_INT  and not(CODING_UNDERFLOW) and WAITN; -- do not increase read address when coding_underflow equals 1
1127
 
1128
-- or wait equals 0
1129
 
1130
WRITE_CLK_ENABLE <= ENABLE_WRITE;
1131
 
1132
READ_CLK_ENABLE <= ENABLE_READ_INT and not(CODING_UNDERFLOW) and WAITN; -- if wait zero do not read more
1133
 
1134
BUS_REQUEST <= BUS_REQUEST_INT;
1135
 
1136
 
1137
 
1138
 
1139
 
1140
end STRUCTURAL;
1141
 
1142
 
1143
 
1144
 
1145
 

powered by: WebSVN 2.1.0

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