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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [xmatch_sim7/] [src/] [level1r.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      = 5.0         --
20
--  last update  = 1/05/01     --
21
--  author       = Jose Nunez  --
22
---------------------------------
23
 
24
 
25
-- FUNCTION
26
--  Top level of the compression decompression hierarchy.
27
 
28
 
29
library ieee,std,dzx;
30
use ieee.std_logic_1164.all;
31
 
32
use dzx.bit_utils.all;
33
-- use std.textio.all;
34
 
35
entity level1r is
36
port
37
(
38
        CS : in bit ;
39
        RW : in bit;
40
        ADDRESS: in bit_vector(3 downto 0);
41
--====================================================================
42
--      CONTROL : inout std_logic_vector(31 downto 0);
43
        CONTROL_IN : in std_logic_vector (31 downto 0);
44
        CONTROL_OUT_C: out std_logic_vector (31 downto 0);
45
        CONTROL_OUT_D: out std_logic_vector (31 downto 0);
46
--====================================================================
47
        CLK : in bit ;
48
        CLEAR: in bit;
49
        BUS_ACKNOWLEDGE_CC : in bit;
50
        BUS_ACKNOWLEDGE_CU : in bit;
51
        BUS_ACKNOWLEDGE_DC : in bit;
52
        BUS_ACKNOWLEDGE_DU : in bit;
53
        WAIT_CU : in bit;
54
  WAIT_CC : in bit;
55
  WAIT_DC : in bit;
56
  WAIT_DU : in bit;
57
        U_DATAIN : in bit_vector(31 downto 0);
58
        C_DATAIN : in bit_vector(31 downto 0);
59
        U_DATAOUT : out std_logic_vector(31 downto 0);
60
        C_DATAOUT : out std_logic_vector(31 downto 0);
61
        FINISHED_C : out bit;
62
        FINISHED_D : out bit;
63
        COMPRESSING : out bit;
64
        FLUSHING_C : out bit;
65
        FLUSHING_D : out bit;
66
        DECOMPRESSING : out bit;
67
        U_DATA_VALID : out bit;
68
        C_DATA_VALID : out bit;
69
        DECODING_OVERFLOW : out bit;
70
        CODING_OVERFLOW : out bit; -- ilegal => error condition
71
        CRC_ERROR : out bit; -- error condition in the compression or decompression channels
72
        INTERRUPT_REQUEST : out bit;
73
   INTERRUPT_ACKNOWLEDGE : in bit;
74
        BUS_REQUEST_CC : out bit;
75
        BUS_REQUEST_CU : out bit;
76
        BUS_REQUEST_DC : out bit;
77
        BUS_REQUEST_DU : out bit
78
);
79
end level1r;
80
 
81
 
82
architecture level1_1 of level1r is
83
 
84
-- these are  the components that form level1
85
 
86
component level1rc
87
port
88
(
89
  OVERFLOW_CONTROL :  in bit;
90
        CS : in bit ;
91
        RW : in bit;
92
        ADDRESS: in bit_vector(1 downto 0);
93
--====================================================================
94
--      CONTROL : inout std_logic_vector(31 downto 0);
95
        CONTROL_IN : in std_logic_vector (31 downto 0);
96
        CONTROL_OUT: out std_logic_vector (31 downto 0);
97
--====================================================================
98
        CLK : in bit ;
99
        CLEAR: in bit;
100
        BUS_ACKNOWLEDGE_U : in bit;
101
        BUS_ACKNOWLEDGE_C : in bit;
102
        WAIT_U   : in bit;
103
        WAIT_C   : in bit;
104
        U_DATAIN : in bit_vector(31 downto 0);
105
        C_DATAOUT : out std_logic_vector(31 downto 0);
106
        C_DATAOUT_TO_DECOMP : out std_logic_vector(31 downto 0);
107
        FINISHED : out bit;
108
        COMPRESSING : out bit;
109
        MODE : out bit;
110
        FLUSHING : out bit;
111
        CODING_OVERFLOW : out bit;
112
        C_DATA_VALID : out bit;
113
        CRC_OUT : out bit_vector(31 downto 0);
114
        BUS_REQUEST_U : out bit;
115
        BUS_REQUEST_C : out bit
116
);
117
end component;
118
 
119
component level1rd
120
port
121
(
122
        CS : in bit ;
123
        RW : in bit;
124
        ADDRESS: in bit_vector(1 downto 0);
125
--====================================================================
126
--      CONTROL : inout std_logic_vector(31 downto 0);
127
        CONTROL_IN : in std_logic_vector (31 downto 0);
128
        CONTROL_OUT: out std_logic_vector (31 downto 0);
129
--====================================================================
130
        CLK : in bit ;
131
        CLEAR: in bit;
132
        BUS_ACKNOWLEDGE_C : in bit;
133
        BUS_ACKNOWLEDGE_U : in bit;
134
  WAIT_C : in bit;
135
   WAIT_U : in bit;
136
        C_DATA_VALID : in bit;
137
        START_C : in bit;
138
        TEST_MODE : in bit;
139
        FINISHED_C : in bit;
140
        C_DATAIN : in bit_vector(31 downto 0);
141
        U_DATAOUT : out std_logic_vector(31 downto 0);
142
        FINISHED : out bit;
143
        FLUSHING : out bit;
144
        DECOMPRESSING : out bit;
145
        U_DATA_VALID : out bit;
146
        DECODING_OVERFLOW : out bit;
147
        CRC_OUT : out bit_vector(31 downto 0);
148
        BUS_REQUEST_C : out bit;
149
  OVERFLOW_CONTROL_DECODING_BUFFER : out bit;
150
        BUS_REQUEST_U : out bit
151
);
152
end component;
153
 
154
 
155
signal CS_C : bit;
156
signal CS_D : bit;
157
signal RW_C : bit;
158
signal RW_D : bit;
159
signal ADDRESS_C : bit_vector(1 downto 0);
160
signal ADDRESS_D : bit_vector(1 downto 0);
161
signal C_DATA_VALID_AUX : bit; -- signals for test mode
162
signal FINISHED_C_AUX : bit;
163
signal COMPRESSING_AUX : bit;
164
signal C_DATAOUT_AUX : std_logic_vector(31 downto 0);
165
signal C_DATAOUT_INT : bit_vector(31 downto 0);
166
signal C_DATAIN_AUX : bit_vector(31 downto 0);
167
signal BUS_REQUEST_DC_AUX : bit;
168
signal CRC_OUT_C,CRC_OUT_D : bit_vector(31 downto 0);
169
signal DECOMPRESSING_AUX : bit;
170
signal CRC_CHECK : bit;
171
signal CRC_ACTIVE: bit;
172
signal MODE: bit;
173
signal WAIT_DC_AUX : bit;
174
signal WAIT_DU_AUX : bit;
175
 
176
signal TEST_MODE : bit;
177
 
178
signal  DECODING_OVERFLOW_AUX : bit; -- ilegal => error condition
179
signal  CODING_OVERFLOW_AUX : bit; -- ilegal => error condition
180
signal  CRC_ERROR_AUX : bit; -- error condition in the compression or decompression channels
181
signal  FINISHED_D_AUX : bit;
182
signal STATUS_C : bit_vector(31 downto 0);
183
signal STATUS_D : bit_vector(31 downto 0);
184
signal ENABLE_INTERRUPT_C : bit;
185
signal ENABLE_INTERRUPT_D : bit;
186
signal INTERRUPT_C : bit;
187
signal INTERRUPT_D : bit;
188
 
189
 
190
signal OVERFLOW_CONTROL_DECODING_BUFFER : bit;
191
 
192
begin
193
 
194
 
195
 
196
level1_c : level1rc  port map(
197
  OVERFLOW_CONTROL => OVERFLOW_CONTROL_DECODING_BUFFER,
198
        CS => CS_C,
199
        RW => RW_C,
200
        ADDRESS => ADDRESS_C,
201
--=============================================================
202
--      CONTROL => CONTROL,
203
        CONTROL_IN => CONTROL_IN,
204
        CONTROL_OUT=> CONTROL_OUT_C,
205
--=============================================================
206
        CLK     => CLK,
207
        CLEAR => CLEAR,
208
        BUS_ACKNOWLEDGE_C => BUS_ACKNOWLEDGE_CC,
209
        BUS_ACKNOWLEDGE_U => BUS_ACKNOWLEDGE_CU,
210
        WAIT_U => WAIT_CU,
211
   WAIT_C => WAIT_CC,
212
        U_DATAIN => U_DATAIN,
213
        C_DATAOUT => C_DATAOUT,
214
  C_DATAOUT_TO_DECOMP => C_DATAOUT_AUX,
215
        FINISHED => FINISHED_C_AUX,
216
        COMPRESSING => COMPRESSING_AUX,
217
        MODE => MODE,
218
        FLUSHING => FLUSHING_C,
219
        CODING_OVERFLOW => CODING_OVERFLOW_AUX,
220
        C_DATA_VALID => C_DATA_VALID_AUX,
221
        CRC_OUT => CRC_OUT_C,
222
        BUS_REQUEST_C => BUS_REQUEST_CC,
223
        BUS_REQUEST_U => BUS_REQUEST_CU
224
);
225
 
226
COMPRESSING <= COMPRESSING_AUX;
227
FINISHED_C <= FINISHED_C_AUX;
228
C_DATA_VALID <= C_DATA_VALID_AUX;
229
WAIT_DC_AUX <= WAIT_DC or TEST_MODE;
230
WAIT_DU_AUX <= WAIT_DU or TEST_MODE; -- never wait in the decompression channel under test mode
231
 
232
 
233
level1_d : level1rd  port map(
234
        CS => CS_D,
235
        RW => RW_D,
236
        ADDRESS => ADDRESS_D,
237
--=============================================================
238
--      CONTROL => CONTROL,
239
        CONTROL_IN => CONTROL_IN,
240
        CONTROL_OUT=> CONTROL_OUT_D,
241
--=============================================================
242
        CLK     => CLK,
243
        CLEAR => CLEAR,
244
        BUS_ACKNOWLEDGE_C => BUS_ACKNOWLEDGE_DC,
245
        BUS_ACKNOWLEDGE_U => BUS_ACKNOWLEDGE_DU,
246
   WAIT_C => WAIT_DC_AUX,
247
   WAIT_U => WAIT_DU_AUX,
248
        C_DATA_VALID =>C_DATA_VALID_AUX,
249
        START_C => MODE,
250
        TEST_MODE => TEST_MODE,
251
        FINISHED_C =>FINISHED_C_AUX,
252
        C_DATAIN => C_DATAIN_AUX,
253
        U_DATAOUT => U_DATAOUT,
254
        FINISHED => CRC_CHECK,
255
        FLUSHING => FLUSHING_D,
256
        DECOMPRESSING => DECOMPRESSING_AUX,
257
        U_DATA_VALID => U_DATA_VALID,
258
        DECODING_OVERFLOW => DECODING_OVERFLOW_AUX,
259
        CRC_OUT => CRC_OUT_D,
260
        BUS_REQUEST_C => BUS_REQUEST_DC_AUX,
261
  OVERFLOW_CONTROL_DECODING_BUFFER => OVERFLOW_CONTROL_DECODING_BUFFER,
262
        BUS_REQUEST_U => BUS_REQUEST_DU
263
);
264
 
265
DECOMPRESSING <= DECOMPRESSING_AUX;
266
FINISHED_D <= CRC_CHECK;
267
FINISHED_D_AUX <= CRC_CHECK;
268
 
269
DELAY_C_DATAIN : process(CLK, CLEAR)   -- test mode delay c data
270
begin
271
 
272
if (CLEAR = '0') then
273
        C_DATAOUT_INT <= x"00000000";
274
elsif ((CLK'event) and (CLK = '1')) then
275
        C_DATAOUT_INT <= To_bitvector(C_DATAOUT_AUX);
276
end if;
277
 
278
end process;
279
 
280
 
281
CRC_CONTROL : process(CLK, CLEAR)   -- test mode delay c data
282
begin
283
 
284
if (CLEAR = '0') then
285
        CRC_ACTIVE <= '0';
286
elsif ((CLK'event) and (CLK = '1')) then
287
    if (CS = '0' and RW = '0') then --delete
288
                        CRC_ACTIVE <='0';
289
        elsif (CRC_CHECK = '0' and TEST_MODE = '1') then -- no activity in the engines
290
                        CRC_ACTIVE <='1';   -- active
291
        else
292
                        CRC_ACTIVE <=CRC_ACTIVE;
293
        end if;
294
end if;
295
 
296
end process;
297
 
298
MODE_CONTROL : process(CLK, CLEAR)   -- test mode delay c data
299
begin
300
 
301
if (CLEAR = '0') then
302
        TEST_MODE <= '0';
303
elsif ((CLK'event) and (CLK = '1')) then
304
      if (CS = '0' and RW = '0') then --delete
305
                        TEST_MODE <='0';
306
        elsif (MODE = '0') then
307
                        TEST_MODE <= '1'; --test mode active
308
        else
309
                        TEST_MODE <= TEST_MODE;
310
        end if;
311
end if;
312
 
313
end process;
314
 
315
 
316
STATUS_REGISTER_COMPRESSION : process(CLK, CLEAR)
317
 
318
begin
319
 
320
if (CLEAR = '0' ) then
321
        STATUS_C <= x"FFFFFFFF";
322
elsif ((CLK'event) and (CLK = '1')) then
323
                        if ( CS_C = '0' and RW = '0' ) then
324
                                STATUS_C <= x"FFFFFFFF";
325
                        elsif (CRC_ERROR_AUX = '0' and TEST_MODE = '1') then
326
                                STATUS_C(15) <= '0';
327
                        elsif CODING_OVERFLOW_AUX = '0' then
328
                                STATUS_C(14) <= '0';
329
                        elsif (DECODING_OVERFLOW_AUX = '0'and TEST_MODE = '1') then
330
                                STATUS_C(13) <= '0';
331
                        elsif (FINISHED_D_AUX = '0' and TEST_MODE = '1') then -- the decompression channel only affects this register in test mode
332
                                STATUS_C(1) <= '0';
333
                        elsif FINISHED_C_AUX = '0' then
334
                                STATUS_C(0) <= '0';
335
                        end if;
336
end if;
337
 
338
end process;
339
 
340
 
341
 
342
 
343
 
344
STATUS_REGISTER_DECOMPRESSION : process(CLK, CLEAR)
345
 
346
begin
347
 
348
if (CLEAR = '0' ) then
349
        STATUS_D <= x"FFFFFFFF";
350
elsif ((CLK'event) and (CLK = '1')) then
351
                        if ( CS_D = '0' and RW = '0' ) then
352
                                STATUS_D <= x"FFFFFFFF";
353
                        elsif (DECODING_OVERFLOW_AUX = '0' and TEST_MODE = '0') then
354
                                STATUS_D(13) <= '0';
355
                        elsif (FINISHED_D_AUX = '0' and TEST_MODE = '0') then
356
                                STATUS_D(1) <= '0';
357
                        end if;
358
end if;
359
 
360
end process;
361
 
362
 
363
ENABLE_INTERRUPT_PROCESS : process(CLK, CLEAR)
364
 
365
begin
366
 
367
if (CLEAR = '0' ) then
368
        ENABLE_INTERRUPT_C <= '0';
369
        ENABLE_INTERRUPT_D <= '0';
370
elsif ((CLK'event) and (CLK = '1')) then
371
                        if (CS_C = '0' and RW = '0' ) then
372
                                ENABLE_INTERRUPT_C <= '1';
373
       elsif (CS_D = '0' and RW = '0') then
374
                          ENABLE_INTERRUPT_D <= '1';
375
                        elsif (INTERRUPT_ACKNOWLEDGE = '0' and INTERRUPT_C = '0') then
376
                                ENABLE_INTERRUPT_C <= '0';
377
                        elsif (INTERRUPT_ACKNOWLEDGE = '0' and INTERRUPT_D = '0') then
378
                                ENABLE_INTERRUPT_D <= '0';
379
                        else
380
                                ENABLE_INTERRUPT_C <= ENABLE_INTERRUPT_C;
381
                                ENABLE_INTERRUPT_D <= ENABLE_INTERRUPT_D;
382
                        end if;
383
end if;
384
 
385
end process;
386
 
387
INTERRUPT_C <= '0' when ((STATUS_C(15) = '0' or STATUS_C(14) = '0' or STATUS_C(13) = '0'  or STATUS_C(1) = '0'  or (STATUS_C(0) = '0' and TEST_MODE = '0')) and ENABLE_INTERRUPT_C = '1') else '1';
388
 
389
INTERRUPT_D <= '0' when ((STATUS_D(13)= '0' or STATUS_D(1) = '0') and ENABLE_INTERRUPT_D = '1') else '1';
390
 
391
INTERRUPT_REQUEST <= '0' when (INTERRUPT_C = '0' or INTERRUPT_D = '0')  else '1';
392
 
393
 
394
 
395
 
396
--=======================================================================================================================
397
--CONTROL_OUT <= To_X01Z(STATUS_C) when ADDRESS = "0000" and CS = '0' and RW = '1' else X"00000000"; 
398
 
399
--CONTROL_OUT <= To_X01Z(STATUS_D) when ADDRESS = "0001" and CS = '0' and RW = '1' else X"00000000"; 
400
--=======================================================================================================================
401
 
402
 
403
 
404
CRC_ERROR <= CRC_ERROR_AUX;
405
CODING_OVERFLOW <= CODING_OVERFLOW_AUX;
406
DECODING_OVERFLOW <= DECODING_OVERFLOW_AUX;
407
 
408
 
409
 
410
 
411
CRC_ERROR_AUX <= '0' when CRC_OUT_D /= CRC_OUT_C and CRC_ACTIVE = '1' else '1';  -- 0 active 
412
 
413
 
414
 
415
 
416
BUS_REQUEST_DC <= BUS_REQUEST_DC_AUX;
417
 
418
C_DATAIN_AUX <= C_DATAIN when BUS_REQUEST_DC_AUX = '0' else C_DATAOUT_INT;
419
ADDRESS_C <= ADDRESS(1 downto 0);
420
ADDRESS_D <= ADDRESS(1 downto 0);
421
RW_D <= RW;
422
RW_C <= RW;
423
CS_D <= '0' when (CS = '0') and (ADDRESS(3 downto 2) = "10" or (ADDRESS(3) = '1' and ADDRESS(1 downto 0) = "01")) else '1';
424
CS_C <= '0' when (CS = '0' and ADDRESS(3 downto 2) = "11") else '1';
425
 
426
 
427
end level1_1;

powered by: WebSVN 2.1.0

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