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

Subversion Repositories xmatchpro

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

powered by: WebSVN 2.1.0

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