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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [src/] [level1rc.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
--  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            = asynchronous reset generated by the csm
39
--  U_DATAIN     = data to be compressed
40
--  C_DATAIN     = data to be decompressed
41
--  U_DATAOUT    = decompressed data
42
--  C_DATAOUT    = compressed data
43
--  ADDR_EN      = enable address tri-states
44
--  CDATA_EN     = enable compressed data tri-state outputs
45
--  UDATA_EN     = enable uncompressed data tri-state outputs
46
--  FINISHED     = signal of finished operation
47
--  COMPRESSING  = compression mode active
48
--  FLUSHING     = flush active
49
--  DECOMPRESSING = decompression active
50
 
51
 
52
 
53
library ieee,std;
54
use ieee.std_logic_1164.all;
55
-- use std.textio.all;
56
 
57
entity level1rc is
58
port
59
(
60
  OVERFLOW_CONTROL : in bit;
61
        CS : in bit ;
62
        RW : in bit;
63
        ADDRESS: in bit_vector(1 downto 0);
64
        CONTROL : inout std_logic_vector(31 downto 0);
65
        CLK : in bit ;
66
        CLEAR: in bit;
67
        BUS_ACKNOWLEDGE_U : in bit;
68
        BUS_ACKNOWLEDGE_C : in bit;
69
        WAIT_U : in bit;
70
        WAIT_C  : in bit;
71
        U_DATAIN : in bit_vector(31 downto 0);
72
        C_DATAOUT : out std_logic_vector(31 downto 0);
73
  C_DATAOUT_TO_DECOMP : out std_logic_vector(31 downto 0); -- to feedback the data to the decompressor
74
        FINISHED : out bit;
75
        COMPRESSING : out bit;
76
        MODE : out bit; -- to active decompression channel in test mode
77
        FLUSHING : out bit;
78
        CODING_OVERFLOW : out bit;
79
        C_DATA_VALID : out bit;
80
        CRC_OUT : out bit_vector(31 downto 0);
81
        BUS_REQUEST_U : out bit;
82
        BUS_REQUEST_C : out bit
83
);
84
end level1rc;
85
 
86
 
87
architecture level1_1 of level1rc is
88
 
89
-- these are  the components that form level1
90
 
91
 
92
 
93
component REG_FILE_C
94
port
95
(
96
      DIN : in bit_vector(31 downto 0);
97
          ADDRESS : in bit_vector(1 downto 0);
98
      C_BS_IN : in bit_vector(31 downto 0);
99
          CRC_IN : in bit_vector(31 downto 0);
100
      CLEAR_CR : in bit;
101
          FINISH : in bit;
102
          RW : in bit;
103
        ENABLE : in bit;
104
        CLEAR : in bit;
105
        CLK : in bit;
106
          DOUT : out std_logic_vector(31 downto 0);
107
          U_BS_OUT : out bit_vector(31 downto 0);
108
          CRC_OUT : out bit_vector(31 downto 0);
109
          START_C : out bit;
110
          STOP :out bit;
111
          MODE : out bit;
112
          THRESHOLD_LEVEL : out bit_vector(8 downto 0)
113
 
114
);
115
end component;
116
 
117
 
118
 
119
component C_BS_COUNTER_C
120
port
121
(
122
        COMPRESS : in bit;
123
        CLEAR : in bit;
124
        CLEAR_COUNTER :  in bit;
125
        CLK : in bit;
126
        ENABLE_C : in bit;
127
        C_BS_OUT : out bit_vector(31 downto 0)
128
);
129
 
130
end component;
131
 
132
component INPUT_BUFFER_32_32
133
port
134
(
135
  OVERFLOW_CONTROL : in bit;
136
  FORCE_STOP : in bit;
137
        START : in bit;
138
        COMP : in bit;
139
        STOP : in bit;
140
        READ: in bit;
141
        WAITN : in bit;
142
        DATA_IN_32 : in bit_vector(31 downto 0);
143
        BUS_ACKNOWLEDGE : in bit;
144
        CLEAR : in bit ;
145
        CLK : in bit ;
146
        DATA_OUT_32: out bit_vector(31 downto 0);
147
        READY : out bit;
148
        INC_TC : out bit;
149
        RESET_TOTAL_COUNTER : out bit;
150
        BUS_REQUEST : out bit
151
);
152
end component;
153
 
154
component CRC_UNIT_C_32
155
        port(DIN : in bit_vector(31 downto 0);
156
                 ENABLE : in bit;
157
                 CLK : in bit;
158
                 RESET : in bit;
159
                 CLEAR : in bit;
160
                 CRC_OUT : out bit_vector(31 downto 0)
161
                );
162
end component;
163
 
164
 
165
component PARSING_UNIT
166
port
167
(
168
        ENABLE: in bit;   -- buffer is ready
169
        FINISH : in bit; -- all the data has been processed
170
        DATA_IN_32 : in bit_vector(31 downto 0);
171
        CLEAR : in bit ;
172
        CLK : in bit ;
173
        READ : out bit;
174
        FINISH_PARSING : out bit;
175
        START_ENGINE : out bit;
176
        MASK : out bit_vector(4 downto 0);
177
        DATA_OUT_32: out bit_vector(31 downto 0)
178
);
179
end component;
180
 
181
component CODING_BUFFER_64_32
182
port
183
(
184
  FORCE_STOP : in bit;
185
        START : in bit;
186
        FINISHED : in bit;
187
        OVERFLOW : in bit;
188
        SHORT : in bit;
189
        WAITN : in bit;
190
        DATA_IN_64 : in bit_vector(63 downto 0);
191
        THRESHOLD_LEVEL : in bit_vector(8 downto 0);
192
        BUS_ACKNOWLEDGE : in bit;
193
        CLEAR : in bit ;
194
        CLK : in bit ;
195
        DATA_OUT_32: out std_logic_vector(31 downto 0);
196
        ENABLE_READ : out bit;
197
        OVERFLOW_DETECTED : out bit;
198
        UNDERFLOW_DETECTED : out bit;
199
        FLUSHING : out bit;
200
   DATA_VALID : out bit;
201
     FINISH : out bit; -- the buffer process
202
        BUS_REQUEST : out bit
203
);
204
end component;
205
 
206
 
207
 
208
 
209
component csm_c_2
210
port
211
(
212
        START_C : in bit ;
213
        STOP_C : in bit;
214
        FINISH_BUFFER : in bit;
215
        STOP : in bit ;
216
        FLUSH_END : in bit ;
217
        CLK : in bit;
218
        CLEAR: in bit;
219
        COMP : out bit ;
220
        FLUSH : out bit ;
221
        MOVE_ENABLE : out bit ;
222
        RESET : out bit
223
);
224
end component;
225
 
226
 
227
component BSL_TC_2_C
228
port
229
(
230
      BLOCK_SIZE : in bit_vector(31 downto 0);
231
      INC : in bit ;
232
      CLEAR : in bit ;
233
      RESET : in bit;
234
      CLK : in bit ;
235
      EO_BLOCK : out bit
236
 
237
);
238
 
239
end component;
240
 
241
 
242
component level2_4ca
243
 
244
port
245
(
246
        CLK : in bit ;
247
        CLEAR : in bit ;
248
        RESET : in bit;
249
        COMP : in bit ;
250
        MOVE_ENABLE : in bit ;
251
        FLUSH : in bit;
252
        U_DATAIN : in bit_vector(31 downto 0);
253
        MASK : in bit_vector(4 downto 0);
254
        FLUSH_END : out bit;
255
        C_DATAOUT : out bit_vector(63 downto 0);
256
        SHORT : out bit;
257
        OVERFLOW : out bit
258
);
259
end component;
260
 
261
 
262
 
263
signal READ_INPUT_BUFFER: bit;
264
signal OVERFLOW_INT : bit;
265
signal  MOVE_ENABLE: bit;
266
signal  FLUSH_INT: bit;
267
signal  COMP_INT: bit;
268
signal  LOAD_BS: bit;
269
signal  INC_TC: bit;
270
signal  RESET: bit;
271
signal  EO_BLOCK: bit;
272
signal  STOP_INT: bit;
273
 
274
 
275
 
276
 
277
signal  START_C_INT : bit;
278
signal  LATCHED_BS: bit_vector(31 downto 0);
279
signal  FLUSH_END: bit;
280
signal C_DATAOUT_INT : bit_vector(63 downto 0);
281
signal C_DATAOUT_32_INT : std_logic_vector(31 downto 0);
282
signal OVERFLOW_DETECTED_CODING: bit;
283
signal UNDERFLOW_DETECTED_CODING: bit;
284
signal ENABLE_READ : bit;
285
 
286
signal INC_TC_CSM : bit;
287
 
288
signal BUS_REQUEST_CODING : bit;
289
signal THRESHOLD_LEVEL : bit_vector(8 downto 0);
290
signal FLUSHING_INT : bit;
291
 
292
 
293
signal C_DATA_VALID_INT : bit;
294
signal FINISHED_BUFFER_CODING : bit;
295
signal FINISHED_AUX : bit;
296
signal C_BS_OUT : bit_vector(31 downto 0);
297
signal CONTROL_AUX : bit_vector(31 downto 0);
298
 
299
signal PARSER_DATA_IN : bit_vector(31 downto 0);
300
 
301
signal PARSER_DATA_OUT : bit_vector(31 downto 0);
302
 
303
 
304
signal MASK : bit_vector(4 downto 0);
305
 
306
signal I_BUFFER_READY : bit;
307
signal RESET_TOTAL_COUNTER : bit; -- the whole block is reset only once
308
 
309
signal FINISH_PARSING : bit; -- the parser has parsed all the data
310
 
311
signal CRC_CODE : bit_vector(31 downto 0); -- test mode
312
 
313
signal START_ENGINE : bit; -- the parser unit starts the engine
314
 
315
signal SHORT : bit;  -- the last output from the compression engine is less or equal to 32 bits
316
 
317
 
318
 
319
 
320
begin
321
 
322
 
323
P_U: PARSING_UNIT
324
port map
325
(
326
        ENABLE => I_BUFFER_READY,
327
        FINISH => RESET_TOTAL_COUNTER, -- all the data has been read from the buffer
328
        DATA_IN_32 => PARSER_DATA_IN,
329
        CLEAR => CLEAR,
330
        CLK => CLK,
331
        READ =>  READ_INPUT_BUFFER,
332
        FINISH_PARSING => FINISH_PARSING,
333
        START_ENGINE => START_ENGINE,
334
        MASK => MASK,
335
        DATA_OUT_32 =>  PARSER_DATA_OUT
336
);
337
 
338
 
339
I_B: INPUT_BUFFER_32_32
340
port map
341
(
342
  OVERFLOW_CONTROL => OVERFLOW_CONTROL,
343
  FORCE_STOP => STOP_INT,
344
        START => START_C_INT,
345
        COMP => COMP_INT,
346
        STOP => EO_BLOCK,
347
        READ => READ_INPUT_BUFFER,
348
        WAITN => WAIT_U,
349
        DATA_IN_32 => U_DATAIN,
350
        BUS_ACKNOWLEDGE => BUS_ACKNOWLEDGE_U,
351
        CLEAR => CLEAR,
352
        CLK => CLK,
353
        DATA_OUT_32 => PARSER_DATA_IN,
354
        READY => I_BUFFER_READY,
355
        INC_TC => INC_TC,
356
        RESET_TOTAL_COUNTER => RESET_TOTAL_COUNTER,
357
        BUS_REQUEST =>  BUS_REQUEST_U
358
);
359
 
360
CRC_UNIT_1: CRC_UNIT_C_32
361
        port map(DIN => U_DATAIN,
362
                 ENABLE => INC_TC,
363
                 CLK => CLK,
364
                 RESET => FINISHED_AUX,
365
                 CLEAR => CLEAR,
366
                 CRC_OUT => CRC_CODE
367
);
368
 
369
level2_4_1 : level2_4ca  port map (     CLK => CLK,
370
                                RESET => RESET,
371
                                CLEAR => CLEAR,
372
                                COMP => COMP_INT,
373
                                MOVE_ENABLE => MOVE_ENABLE,
374
                                FLUSH => FLUSH_INT,
375
                                FLUSH_END => FLUSH_END,
376
                          MASK => MASK,
377
                                C_DATAOUT => C_DATAOUT_INT,
378
                                U_DATAIN  => PARSER_DATA_OUT,
379
                                SHORT => SHORT,
380
                                OVERFLOW => OVERFLOW_INT
381
        );
382
 
383
 
384
csm_1 : csm_c_2 port map (
385
        START_C => START_ENGINE,
386
        STOP_C => FINISH_PARSING,
387
        FINISH_BUFFER => RESET_TOTAL_COUNTER,
388
        STOP => STOP_INT,
389
        FLUSH_END => FLUSH_END,
390
        CLK => CLK,
391
        CLEAR => CLEAR,
392
        COMP =>COMP_INT,
393
        FLUSH => FLUSH_INT,
394
        MOVE_ENABLE => MOVE_ENABLE,
395
        RESET => RESET
396
);
397
 
398
 
399
 
400
 
401
-- if decoding underflow active do not increment the counter
402
 
403
 
404
BSL_TC_1: BSL_TC_2_C port map (
405
      BLOCK_SIZE => LATCHED_BS,
406
      INC => INC_TC,
407
          CLEAR => CLEAR,
408
      RESET => RESET_TOTAL_COUNTER,
409
      CLK => CLK,
410
      EO_BLOCK => EO_BLOCK
411
);
412
 
413
 
414
 
415
 
416
REG_FILE_1 : REG_FILE_C
417
port map
418
(
419
        DIN => CONTROL_AUX,
420
        ADDRESS => ADDRESS,
421
            CLEAR_CR => EO_BLOCK,    -- reset the comand register to avoid restart.
422
            RW => RW,
423
        C_BS_IN => C_BS_OUT,
424
                CRC_IN => CRC_CODE,
425
            FINISH => FINISHED_BUFFER_CODING,
426
            ENABLE =>CS,
427
        CLEAR =>CLEAR,
428
        CLK =>CLK,
429
            DOUT => CONTROL,
430
            U_BS_OUT => LATCHED_BS,
431
                CRC_OUT => CRC_OUT,
432
        START_C => START_C_INT,
433
            STOP => STOP_INT,
434
                MODE => MODE,
435
            THRESHOLD_LEVEL => THRESHOLD_LEVEL
436
);
437
 
438
 
439
C_BS_COUNTER_1 : C_BS_COUNTER_C
440
port map
441
(
442
        COMPRESS => START_C_INT,
443
        CLEAR_COUNTER => FINISHED_AUX,
444
        CLEAR => CLEAR,
445
        CLK => CLK,
446
        ENABLE_C => C_DATA_VALID_INT,
447
        C_BS_OUT => C_BS_OUT
448
);
449
 
450
CODING_BUFFER : CODING_BUFFER_64_32
451
port map
452
(
453
  FORCE_STOP => STOP_INT,
454
        START => COMP_INT,
455
        FINISHED => FLUSH_END,
456
        OVERFLOW => OVERFLOW_INT,
457
  SHORT => SHORT,
458
   WAITN => WAIT_C,
459
        DATA_IN_64 => C_DATAOUT_INT,
460
        THRESHOLD_LEVEL => THRESHOLD_LEVEL,
461
        BUS_ACKNOWLEDGE => BUS_ACKNOWLEDGE_C,
462
        CLEAR => CLEAR,
463
        CLK => CLK,
464
        DATA_OUT_32 => C_DATAOUT_32_INT,
465
        ENABLE_READ => ENABLE_READ,
466
        OVERFLOW_DETECTED => OVERFLOW_DETECTED_CODING,
467
        UNDERFLOW_DETECTED => UNDERFLOW_DETECTED_CODING,
468
        FLUSHING => FLUSHING_INT,
469
      FINISH => FINISHED_BUFFER_CODING,
470
        DATA_VALID => C_DATA_VALID_INT,
471
        BUS_REQUEST => BUS_REQUEST_CODING
472
);
473
 
474
 
475
 
476
 
477
-- Careful I change this for the PCI implementation
478
-- C_DATAOUT <= C_DATAOUT_32_INT when BUS_ACKNOWLEDGE_C = '0' else "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
479
C_DATAOUT <= C_DATAOUT_32_INT;
480
C_DATAOUT_TO_DECOMP <= C_DATAOUT_32_INT;
481
COMPRESSING <= COMP_INT;
482
FLUSHING <= FLUSHING_INT;
483
BUS_REQUEST_C <= BUS_REQUEST_CODING;
484
FINISHED_AUX <= FINISHED_BUFFER_CODING;
485
 
486
C_DATA_VALID <= C_DATA_VALID_INT;
487
 
488
CODING_OVERFLOW <= OVERFLOW_DETECTED_CODING;
489
 
490
 
491
 
492
CONTROL_AUX <= To_bitvector(CONTROL);
493
FINISHED <= FINISHED_AUX;
494
 
495
 
496
 
497
 
498
end level1_1;

powered by: WebSVN 2.1.0

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