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

Subversion Repositories xmatchpro

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 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
--  ENTITY       = LEVEL1      --
19
--  version      = 2.0         --
20
--  last update  = 1/05/00     --
21
--  author       = Jose Nunez  --
22
---------------------------------
23
 
24
 
25
-- FUNCTION
26
--  Top level of the hierarchy.
27
--  This unit does not include a memory interface
28
 
29
 
30
--  PIN LIST
31
--  START        = indicates start of a compress or decompress operation
32
--  STOP         = forces the end of the current operation
33
--  COMPRESS     = selects compression mode
34
--  DECOMPRESS   = selects decompression mode
35
--  U_BS_IN      = 15 bits maximum block size 32K. size of the block to be compressed
36
--  C_BS_INOUT   = 16 bits size of the compressed block. compression read the size of the compressed block. decompresssion input the size of the compressed block. buffers stop when is reached. optional system can non-grant the bus to indicate the same. 
37
--  CLK          = master clock
38
--  CLEAR_EXT    = asynchronous reset generated externally
39
--  CLEAR            = asynchronous reset generated by the csm
40
--  U_DATAIN     = data to be compressed
41
--  C_DATAIN     = data to be decompressed
42
--  U_DATAOUT    = decompressed data
43
--  C_DATAOUT    = compressed data
44
--  ADDR_EN      = enable address tri-states
45
--  CDATA_EN     = enable compressed data tri-state outputs
46
--  UDATA_EN     = enable uncompressed data tri-state outputs
47
--  FINISHED     = signal of finished operation
48
--  COMPRESSING  = compression mode active
49
--  FLUSHING     = flush active
50
--  DECOMPRESSING = decompression active
51
--  DISALIGNED   = bytes in block is not a multiple of 4 
52
 
53
 
54
library ieee,std;
55
use ieee.std_logic_1164.all;
56
-- use std.textio.all;
57
 
58
entity level1rd is
59
port
60
(
61
        CS : in bit ;
62
        RW : in bit;
63
        ADDRESS: in bit_vector(1 downto 0);
64
--===========================================================================================
65
--      CONTROL : inout std_logic_vector(31 downto 0);
66
        CONTROL_IN : in std_logic_vector (31 downto 0);
67
        CONTROL_OUT: out std_logic_vector (31 downto 0);
68
--===========================================================================================
69
        CLK : in bit ;
70
        CLEAR: in bit;
71
        BUS_ACKNOWLEDGE_C : in bit;
72
        BUS_ACKNOWLEDGE_U : in bit;
73
   WAIT_C : in bit;
74
  WAIT_U : in bit;
75
        C_DATA_VALID : in bit;
76
        START_C : in bit;
77
        TEST_MODE : in bit;
78
        FINISHED_C : in bit;
79
        C_DATAIN : in bit_vector(31 downto 0);
80
        U_DATAOUT : out std_logic_vector(31 downto 0);
81
        FINISHED : out bit;
82
        FLUSHING : out bit;
83
        DECOMPRESSING : out bit;
84
        U_DATA_VALID : out bit;
85
        DECODING_OVERFLOW : out bit;
86
        CRC_OUT : out bit_vector(31 downto 0);
87
        BUS_REQUEST_C : out bit;
88
  OVERFLOW_CONTROL_DECODING_BUFFER : out bit;
89
        BUS_REQUEST_U : out bit
90
);
91
end level1rd;
92
 
93
 
94
architecture level1_1 of level1rd is
95
 
96
-- these are  the components that form level1
97
 
98
component OUT_REGISTER
99
        port(
100
            DIN : in bit_vector(31 downto 0);
101
            CLEAR : in bit;
102
                        RESET : in bit;
103
                        U_DATA_VALID_IN : in bit;
104
                        FINISHED_IN : in bit;
105
                    CLK : in bit;
106
                    U_DATA_VALID_OUT : out bit;
107
                        FINISHED_OUT : out bit;
108
            QOUT : out  bit_vector(31 downto 0)
109
        );
110
 
111
end component;
112
 
113
component CRC_UNIT_D_32
114
        port(DIN : in bit_vector(31 downto 0);
115
                 ENABLE : in bit;
116
                 CLK : in bit;
117
                 RESET : in bit;
118
                 CLEAR : in bit;
119
                 CRC_OUT : out bit_vector(31 downto 0)
120
                );
121
end component;
122
 
123
 
124
component OUTPUT_BUFFER_32_32
125
port
126
(
127
        FORCE_STOP : in bit;
128
        START_D: in bit;
129
        START_C: in bit;
130
        WRITE : in bit;
131
        FINISHED : in bit;
132
  WAITN : in bit;
133
        DATA_IN_32 : in bit_vector(31 downto 0);
134
        THRESHOLD : in bit_vector(7 downto 0);
135
        BUS_ACKNOWLEDGE : in bit;
136
        CLEAR : in bit ;
137
        CLK : in bit ;
138
        FLUSHING : out bit;
139
        FINISHED_FLUSHING : out bit;
140
        OVERFLOW_DETECTED : out bit;
141
        DATA_OUT_32: out bit_vector(31 downto 0);
142
        READY : out bit;
143
  OVERFLOW_CONTROL : out bit;
144
        BUS_REQUEST : out bit
145
);
146
end component;
147
 
148
 
149
component ASSEMBLING_UNIT
150
port
151
(
152
        ENABLE: in bit;
153
        DATA_IN_32 : in bit_vector(31 downto 0);
154
        CLEAR : in bit ;
155
        RESET : in bit;
156
        CLK : in bit ;
157
        MASK : in bit_vector(3 downto 0);
158
        WRITE : out bit;
159
        DATA_OUT_32: out bit_vector(31 downto 0)
160
);
161
end  component;
162
 
163
component REG_FILE_D
164
port
165
(
166
        DIN : in bit_vector(31 downto 0);
167
                ADDRESS : in bit_vector(1 downto 0);
168
                CRC_IN : in bit_vector(31 downto 0);
169
                LOAD_CRC : in bit;
170
        CLEAR_CR : in bit;
171
            RW : in bit;
172
        ENABLE : in bit;
173
        CLEAR : in bit;
174
        CLK : in bit;
175
            DOUT : out std_logic_vector(31 downto 0);
176
            C_BS_OUT : out bit_vector(31 downto 0);
177
            U_BS_OUT : out bit_vector(31 downto 0);
178
                CRC_OUT : out bit_vector(31 downto 0);
179
            START_D : out bit;
180
            STOP :out bit;
181
            THRESHOLD_LEVEL : out bit_vector(7 downto 0)
182
 
183
);
184
end component;
185
 
186
 
187
 
188
component C_BS_COUNTER_D
189
port
190
(
191
        C_BS_IN : in bit_vector(31 downto 0);
192
        DECOMPRESS : in bit;
193
        CLEAR : in bit;
194
        CLEAR_COUNTER :  in bit;
195
        CLK : in bit;
196
        ENABLE_D : in bit;
197
        ALL_C_DATA : out bit;
198
        C_BS_OUT : out bit_vector(31 downto 0)
199
);
200
 
201
end component;
202
 
203
 
204
component DECODING_BUFFER_32_64_2
205
port
206
(
207
  FORCE_STOP : in bit;
208
        START_D : in bit;
209
        START_C : in bit;
210
        FINISHED_D : in bit;
211
        FINISHED_C : in bit;
212
        UNDERFLOW : in bit;
213
        DATA_IN_32 : in bit_vector(31 downto 0);
214
        THRESHOLD_LEVEL : in bit_vector(9 downto 0);
215
        BUS_ACKNOWLEDGE : in bit;
216
        C_DATA_VALID : in bit;
217
  WAITN : in bit;
218
        CLEAR : in bit ;
219
        CLK : in bit ;
220
        DATA_OUT_64: out bit_vector(63 downto 0);
221
        UNDERFLOW_DETECTED : out bit;
222
        FINISH : out bit;
223
        START_ENGINE : out bit;
224
  OVERFLOW_CONTROL : out bit;
225
        BUS_REQUEST : out bit
226
);
227
end component;
228
 
229
 
230
component csm_d
231
port
232
(
233
        START_C : in bit; -- for test mode
234
        START_D : in bit;
235
        START_D_ENGINE : in bit;
236
        STOP : in bit ;
237
        END_OF_BLOCK : in bit ;
238
        CLK : in bit;
239
        CLEAR: in bit;
240
        DECOMP : out bit ;
241
        FINISH : out bit ;
242
        MOVE_ENABLE : out bit ;
243
        RESET : out bit
244
);
245
end component;
246
 
247
 
248
component BSL_TC_2_D
249
port
250
(
251
      BLOCK_SIZE : in bit_vector(31 downto 0) ;
252
      INC : in bit ;
253
      CLEAR : in bit ;
254
          RESET : in bit;
255
      CLK : in bit ;
256
      EO_BLOCK : out bit ;
257
      FINISH_D_BUFFERS : out bit
258
 
259
);
260
 
261
end component;
262
 
263
 
264
component level2_4d_pbc
265
port(
266
        CLK : in bit;
267
        RESET : in bit;
268
        CLEAR : in bit;
269
        DECOMP : in bit;
270
        MOVE_ENABLE : in bit;
271
          DECODING_UNDERFLOW : in bit;
272
          FINISH : in bit;
273
      C_DATAIN : in bit_vector(63 downto 0);
274
    U_DATAOUT : out bit_vector(31 downto 0);
275
        MASK : out bit_vector(3 downto 0);
276
        U_DATA_VALID : out bit ;
277
   OVERFLOW_CONTROL : in bit;
278
        UNDERFLOW : out bit
279
    );
280
end component;
281
 
282
 
283
signal  FINISHED_INT : bit;
284
signal UNDERFLOW_INT : bit;
285
signal  MOVE_ENABLE: bit;
286
 
287
signal  DECOMP_INT: bit;
288
signal  LOAD_BS: bit;
289
signal  INC_TC: bit;
290
signal  RESET: bit;
291
signal  EO_BLOCK: bit;
292
signal  STOP_INT: bit;
293
 
294
 
295
 
296
signal  START_D_INT : bit;
297
signal START_D_INT_BUFFERS : bit; -- to start the decompression engine
298
 
299
signal  LATCHED_BS: bit_vector(31 downto 0);
300
 
301
signal C_DATAIN_INT : bit_vector(63 downto 0);
302
signal U_DATAOUT_INT : bit_vector(31 downto 0);
303
signal U_DATAOUT_BUFFER : bit_vector(31 downto 0);
304
signal U_DATAOUT_AUX : bit_vector(31 downto 0);
305
 
306
signal U_DATAOUT_REG: bit_vector(31 downto 0);
307
 
308
signal ENABLE_READ : bit;
309
 
310
 
311
signal BUS_REQUEST_DECODING : bit;
312
 
313
 
314
 
315
 
316
signal OVERFLOW_DETECTED_DECODING : bit;
317
signal UNDERFLOW_DETECTED_DECODING : bit;
318
 
319
signal THRESHOLD_LEVEL : bit_vector(7 downto 0);
320
signal THRESHOLD_LEVEL_FIXED : bit_vector(9 downto 0);
321
 
322
 
323
signal U_DATA_VALID_INT : bit;
324
signal U_DATA_VALID_REG : bit;
325
signal U_DATA_VALID_AUX:  bit;
326
 
327
signal MASK_INT : bit_vector(3 downto 0);
328
signal WRITE_INT : bit;
329
 
330
 
331
signal FINISH_D_BUFFERS : bit;
332
signal FINISHED_BUFFER_DECODING : bit;
333
 
334
signal FINISHED_AUX : bit;
335
 
336
signal ALL_C_DATA : bit;
337
signal BUS_ACKNOWLEDGE_AUX : bit;
338
 
339
signal C_BS_INT : bit_vector(31 downto 0);
340
 
341
signal C_BS_OUT : bit_vector(31 downto 0);
342
 
343
signal CONTROL_AUX : bit_vector(31 downto 0);
344
 
345
signal CLEAR_COMMAND : bit; -- to reset the command register
346
 
347
signal ENABLE_D_COUNT : bit;  -- count compressed data during decompression
348
 
349
signal CRC_CODE : bit_vector(31 downto 0);
350
signal ENABLE_CRC : bit;
351
signal DATA_CRC : bit_vector(31 downto 0);
352
signal ENABLE_ASSEMBLE : bit; -- stop assembling when block recovered
353
signal FINISHED_BUFFER : bit;
354
signal BUS_ACKNOWLEDGE_U_AUX : bit;
355
signal BUS_REQUEST_U_AUX : bit;
356
signal THRESHOLD_LEVEL_AUX : bit_vector(7 downto 0);
357
signal OVERFLOW_CONTROL : bit;
358
 
359
 
360
 
361
begin
362
 
363
 
364
OUT_REGISTER_1: OUT_REGISTER
365
        port map(
366
            DIN =>U_DATAOUT_REG,
367
            CLEAR =>CLEAR,
368
                        RESET =>RESET,
369
                        U_DATA_VALID_IN =>U_DATA_VALID_REG,
370
                        FINISHED_IN => FINISHED_BUFFER,
371
                    CLK =>CLK,
372
                    U_DATA_VALID_OUT =>U_DATA_VALID_AUX,
373
                        FINISHED_OUT => FINISHED,
374
            QOUT =>   U_DATAOUT_AUX
375
       );
376
 
377
 
378
CRC_UNIT_1: CRC_UNIT_D_32
379
        port map(DIN =>DATA_CRC,
380
                 ENABLE =>ENABLE_CRC,
381
                 CLK => CLK,
382
                 RESET => FINISHED_BUFFER,
383
                 CLEAR => CLEAR,
384
                 CRC_OUT => CRC_CODE
385
                );
386
 
387
DATA_CRC <= U_DATAOUT_REG;
388
ENABLE_CRC <= not(U_DATA_VALID_REG);
389
 
390
OUTPUT_BUFFER_32_32_1 : OUTPUT_BUFFER_32_32
391
port map
392
(
393
        FORCE_STOP => STOP_INT,
394
        START_D =>START_D_INT,
395
        START_C => START_C,
396
        WRITE =>WRITE_INT,
397
        FINISHED =>FINISHED_INT,
398
  WAITN => WAIT_U,
399
        DATA_IN_32 =>U_DATAOUT_BUFFER,
400
        THRESHOLD =>THRESHOLD_LEVEL_AUX,
401
        BUS_ACKNOWLEDGE =>BUS_ACKNOWLEDGE_U_AUX,
402
        CLEAR =>CLEAR,
403
        CLK =>CLK,
404
        FLUSHING =>FLUSHING,
405
        FINISHED_FLUSHING =>FINISHED_BUFFER,
406
        OVERFLOW_DETECTED => OVERFLOW_DETECTED_DECODING,
407
        DATA_OUT_32 =>U_DATAOUT_REG,
408
        READY => U_DATA_VALID_REG,
409
  OVERFLOW_CONTROL => OVERFLOW_CONTROL,
410
        BUS_REQUEST =>BUS_REQUEST_U_AUX
411
);
412
 
413
 
414
 
415
ASSEMBLING_UNIT_1: ASSEMBLING_UNIT
416
port map (
417
        ENABLE => ENABLE_ASSEMBLE,
418
        DATA_IN_32 => U_DATAOUT_INT,
419
        CLEAR =>CLEAR,
420
        RESET => RESET,
421
        CLK =>CLK,
422
        MASK =>MASK_INT,
423
        WRITE =>WRITE_INT,
424
        DATA_OUT_32 => U_DATAOUT_BUFFER
425
);
426
 
427
 
428
ENABLE_ASSEMBLE <= U_DATA_VALID_INT;
429
 
430
 
431
level2_4_1 : level2_4d_pbc port map (CLK => CLK,
432
                                RESET => RESET,
433
                                CLEAR => CLEAR,
434
                                DECOMP => DECOMP_INT,
435
                                MOVE_ENABLE => MOVE_ENABLE,
436
                                DECODING_UNDERFLOW => UNDERFLOW_DETECTED_DECODING, -- to stop the decompression engine
437
                                FINISH => FINISHED_INT,
438
                                C_DATAIN => C_DATAIN_INT,
439
                                U_DATAOUT => U_DATAOUT_INT,
440
                                MASK => MASK_INT,
441
                                U_DATA_VALID => U_DATA_VALID_INT,
442
          OVERFLOW_CONTROL => OVERFLOW_CONTROL,
443
                                UNDERFLOW => UNDERFLOW_INT
444
        );
445
 
446
 
447
 
448
 
449
 
450
csm_1 : csm_d port map (
451
    START_C => START_C,
452
        START_D => START_D_INT,
453
        START_D_ENGINE => START_D_INT_BUFFERS,
454
        STOP => STOP_INT,
455
        END_OF_BLOCK => EO_BLOCK,
456
        CLK => CLK,
457
        CLEAR => CLEAR,
458
        DECOMP => DECOMP_INT,
459
        FINISH => FINISHED_INT,
460
        MOVE_ENABLE => MOVE_ENABLE,
461
        RESET => RESET
462
);
463
 
464
 
465
 
466
-- if decoding underflow active do not increment the counter
467
 
468
 
469
BSL_TC_1: BSL_TC_2_D port map (
470
      BLOCK_SIZE => LATCHED_BS,
471
      INC => WRITE_INT,
472
          CLEAR => CLEAR,
473
      RESET => RESET,
474
      CLK => CLK,
475
      EO_BLOCK => EO_BLOCK,
476
          FINISH_D_BUFFERS => FINISH_D_BUFFERS
477
);
478
 
479
 
480
REG_FILE_1 : REG_FILE_D
481
port map
482
(
483
        DIN => CONTROL_AUX,
484
        ADDRESS => ADDRESS,
485
                CRC_IN => CRC_CODE,
486
                LOAD_CRC => FINISHED_BUFFER,
487
            CLEAR_CR => CLEAR_COMMAND,    -- reset the comand register to avoid restart.
488
            RW => RW,
489
            ENABLE =>CS,
490
        CLEAR =>CLEAR,
491
        CLK =>CLK,
492
            DOUT => CONTROL_OUT,
493
        C_BS_OUT => C_BS_INT,
494
            U_BS_OUT => LATCHED_BS,
495
                CRC_OUT => CRC_OUT,
496
            START_D => START_D_INT,
497
            STOP => STOP_INT,
498
            THRESHOLD_LEVEL => THRESHOLD_LEVEL
499
);
500
 
501
 
502
 
503
 
504
C_BS_COUNTER_1 : C_BS_COUNTER_D
505
port map
506
(
507
        C_BS_IN => C_BS_INT,
508
        DECOMPRESS => START_D_INT,
509
        CLEAR_COUNTER => FINISHED_AUX,
510
        CLEAR => CLEAR,
511
        CLK => CLK,
512
        ENABLE_D => ENABLE_D_COUNT,
513
        ALL_C_DATA => ALL_C_DATA,
514
        C_BS_OUT => C_BS_OUT
515
);
516
 
517
 
518
 
519
DECODING_BUFFER : DECODING_BUFFER_32_64_2
520
port map
521
(
522
  FORCE_STOP => STOP_INT,
523
        START_D => START_D_INT,
524
        START_C => START_C,
525
        FINISHED_D => FINISH_D_BUFFERS,
526
    FINISHED_C => FINISHED_C,
527
        UNDERFLOW  => UNDERFLOW_INT,
528
        DATA_IN_32 => C_DATAIN,
529
        THRESHOLD_LEVEL => THRESHOLD_LEVEL_FIXED,
530
        BUS_ACKNOWLEDGE => BUS_ACKNOWLEDGE_AUX,
531
        C_DATA_VALID => C_DATA_VALID,
532
  WAITN => WAIT_C,
533
        CLEAR => CLEAR,
534
        CLK => CLK,
535
        DATA_OUT_64 => C_DATAIN_INT,
536
        UNDERFLOW_DETECTED => UNDERFLOW_DETECTED_DECODING,
537
        FINISH => FINISHED_BUFFER_DECODING,
538
        START_ENGINE => START_D_INT_BUFFERS,
539
  OVERFLOW_CONTROL => OVERFLOW_CONTROL_DECODING_BUFFER,
540
        BUS_REQUEST => BUS_REQUEST_DECODING
541
);
542
 
543
THRESHOLD_LEVEL_FIXED <= "0000000001";  -- buffer present in the ouput. Activate the input buffer inmediatly
544
 
545
-- careful I change this for the PCI implementation
546
-- U_DATAOUT <= To_X01Z(U_DATAOUT_AUX) when BUS_ACKNOWLEDGE_U = '0' and TEST_MODE = '0' else "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
547
U_DATAOUT <= To_X01Z(U_DATAOUT_AUX);
548
DECOMPRESSING <= DECOMP_INT;
549
BUS_REQUEST_C <= BUS_REQUEST_DECODING;
550
FINISHED_AUX <= DECOMP_INT or FINISHED_INT;
551
 
552
CLEAR_COMMAND <= DECOMP_INT or FINISHED_INT; -- clear the command register
553
U_DATA_VALID <= U_DATA_VALID_AUX when TEST_MODE = '0' else '1'; -- valid at zero
554
 
555
 
556
DECODING_OVERFLOW <= OVERFLOW_DETECTED_DECODING;
557
BUS_ACKNOWLEDGE_AUX  <= BUS_ACKNOWLEDGE_C or ALL_C_DATA;
558
CONTROL_AUX <= To_bitvector(CONTROL_IN);
559
 
560
BUS_ACKNOWLEDGE_U_AUX <= BUS_ACKNOWLEDGE_U when TEST_MODE = '0' else '0'; -- always acknowledge in test mode 
561
 
562
 
563
ENABLE_D_COUNT <= BUS_ACKNOWLEDGE_C or BUS_REQUEST_DECODING; -- both at zero
564
 
565
BUS_REQUEST_U <= BUS_REQUEST_U_AUX when TEST_MODE = '0' else '1';   -- never request
566
THRESHOLD_LEVEL_AUX <= THRESHOLD_LEVEL when TEST_MODE = '0' else "00001000";
567
 
568
end level1_1;

powered by: WebSVN 2.1.0

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