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 = DECOMP_ASSEM_5 --
|
19 |
|
|
-- version = 1.0 --
|
20 |
|
|
-- last update = 7/01/00 --
|
21 |
|
|
-- author = Jose Nunez --
|
22 |
|
|
-----------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
-- FUNCTION
|
26 |
|
|
-- Assembles input data and remaining valid data into 33 bit elements
|
27 |
|
|
-- for application to the decoder.
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
-- PIN LIST
|
31 |
|
|
-- OLD_DATA = previous data available to the decoder.
|
32 |
|
|
-- OLD_LENGTH = length of previous data available to the decoder.
|
33 |
|
|
-- MATCH_LENGTH = length of data matched by the decoder.
|
34 |
|
|
-- DATA_IN = input data from external RAM.
|
35 |
|
|
-- NEW_DATA = next data to be made available to the decoder.
|
36 |
|
|
-- NEW_LENGTH = length of next data to be made available to the decoder.
|
37 |
|
|
-- UNDERFLOW = indicates that more data is required from the RAM,
|
38 |
|
|
-- i.e data presently on DATA_IN must be read.
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
library ieee,dzx;
|
42 |
|
|
use ieee.std_logic_1164.all;
|
43 |
|
|
use dzx.bit_arith.all;
|
44 |
|
|
use dzx.attributes.all;
|
45 |
|
|
|
46 |
|
|
entity DECOMP_ASSEM_9 is
|
47 |
|
|
port
|
48 |
|
|
(
|
49 |
|
|
OLD_DATA : in bit_vector(132 downto 0) ;
|
50 |
|
|
OLD_LENGTH : in bit_vector(6 downto 0) ;
|
51 |
|
|
DECODING_UNDERFLOW : in bit;
|
52 |
|
|
MATCH_LENGTH : in bit_vector(5 downto 0) ;
|
53 |
|
|
DATA_IN : in bit_vector(63 downto 0) ;
|
54 |
|
|
NEW_DATA : out bit_vector(132 downto 0) ;
|
55 |
|
|
NEW_LENGTH : out bit_vector(6 downto 0) ;
|
56 |
|
|
UNDERFLOW : out bit
|
57 |
|
|
);
|
58 |
|
|
|
59 |
|
|
end DECOMP_ASSEM_9;
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
architecture DEC_ASS of DECOMP_ASSEM_9 is
|
64 |
|
|
|
65 |
|
|
signal INT_UNDERFLOW : bit; -- temporary underflow signal
|
66 |
|
|
signal TEMP_NEW_DATA_OUT : bit_vector(132 downto 0);
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
begin
|
70 |
|
|
|
71 |
|
|
LENGTH_CALC : process(OLD_LENGTH, MATCH_LENGTH, DECODING_UNDERFLOW)
|
72 |
|
|
|
73 |
|
|
variable NEW_LENGTH_AUX : bit_vector(6 downto 0);
|
74 |
|
|
variable TEMP_LENGTH : bit_vector(6 downto 0);
|
75 |
|
|
begin
|
76 |
|
|
|
77 |
|
|
TEMP_LENGTH := OLD_LENGTH;
|
78 |
|
|
|
79 |
|
|
if (OLD_LENGTH < "0100011") then -- at least 35 bits. The other 35 are always present for a total of 70
|
80 |
|
|
if(DECODING_UNDERFLOW = '0') then -- data in buffer
|
81 |
|
|
TEMP_LENGTH(6) := '1';
|
82 |
|
|
NEW_LENGTH_AUX := TEMP_LENGTH - MATCH_LENGTH; -- current decoding operation takes place
|
83 |
|
|
else
|
84 |
|
|
NEW_LENGTH_AUX := TEMP_LENGTH; --current decoding operation not done
|
85 |
|
|
end if;
|
86 |
|
|
INT_UNDERFLOW <= '0';
|
87 |
|
|
else
|
88 |
|
|
NEW_LENGTH_AUX := TEMP_LENGTH - MATCH_LENGTH;
|
89 |
|
|
INT_UNDERFLOW <= '1';
|
90 |
|
|
end if;
|
91 |
|
|
|
92 |
|
|
NEW_LENGTH <= NEW_LENGTH_AUX;
|
93 |
|
|
|
94 |
|
|
end process LENGTH_CALC;
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
CODE_CALC : process(OLD_DATA , OLD_LENGTH , DATA_IN)
|
98 |
|
|
variable TEMP_NEW_DATA : bit_vector(132 downto 0);
|
99 |
|
|
|
100 |
|
|
begin
|
101 |
|
|
|
102 |
|
|
TEMP_NEW_DATA(132 downto 98) := OLD_DATA(132 downto 98);
|
103 |
|
|
|
104 |
|
|
case OLD_LENGTH is
|
105 |
|
|
when "0000000" => TEMP_NEW_DATA(97 downto 0) := DATA_IN & "0000000000000000000000000000000000";
|
106 |
|
|
when "0000001" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97) & DATA_IN & "000000000000000000000000000000000";
|
107 |
|
|
when "0000010" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 96) & DATA_IN & "00000000000000000000000000000000";
|
108 |
|
|
when "0000011" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 95) & DATA_IN & "0000000000000000000000000000000";
|
109 |
|
|
when "0000100" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 94) & DATA_IN & "000000000000000000000000000000";
|
110 |
|
|
when "0000101" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 93) & DATA_IN & "00000000000000000000000000000";
|
111 |
|
|
when "0000110" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 92) & DATA_IN & "0000000000000000000000000000";
|
112 |
|
|
when "0000111" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 91) & DATA_IN & "000000000000000000000000000";
|
113 |
|
|
when "0001000" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 90) & DATA_IN & "00000000000000000000000000";
|
114 |
|
|
when "0001001" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 89) & DATA_IN & "0000000000000000000000000";
|
115 |
|
|
when "0001010" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 88) & DATA_IN & "000000000000000000000000";
|
116 |
|
|
when "0001011" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 87) & DATA_IN & "00000000000000000000000";
|
117 |
|
|
when "0001100" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 86) & DATA_IN & "0000000000000000000000";
|
118 |
|
|
when "0001101" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 85) & DATA_IN & "000000000000000000000";
|
119 |
|
|
when "0001110" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 84) & DATA_IN & "00000000000000000000";
|
120 |
|
|
when "0001111" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 83) & DATA_IN & "0000000000000000000";
|
121 |
|
|
when "0010000" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 82) & DATA_IN & "000000000000000000";
|
122 |
|
|
when "0010001" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 81) & DATA_IN & "00000000000000000";
|
123 |
|
|
when "0010010" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 80) & DATA_IN & "0000000000000000";
|
124 |
|
|
when "0010011" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 79) & DATA_IN & "000000000000000";
|
125 |
|
|
when "0010100" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 78) & DATA_IN & "00000000000000";
|
126 |
|
|
when "0010101" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 77) & DATA_IN & "0000000000000";
|
127 |
|
|
when "0010110" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 76) & DATA_IN & "000000000000";
|
128 |
|
|
when "0010111" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 75) & DATA_IN & "00000000000";
|
129 |
|
|
when "0011000" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 74) & DATA_IN & "0000000000";
|
130 |
|
|
when "0011001" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 73) & DATA_IN & "000000000";
|
131 |
|
|
when "0011010" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 72) & DATA_IN & "00000000";
|
132 |
|
|
when "0011011" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 71) & DATA_IN & "0000000";
|
133 |
|
|
when "0011100" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 70) & DATA_IN & "000000";
|
134 |
|
|
when "0011101" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 69) & DATA_IN & "00000";
|
135 |
|
|
when "0011110" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 68) & DATA_IN & "0000";
|
136 |
|
|
when "0011111" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 67) & DATA_IN & "000";
|
137 |
|
|
when "0100000" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 66) & DATA_IN & "00";
|
138 |
|
|
when "0100001" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 65) & DATA_IN & "0";
|
139 |
|
|
when "0100010" => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 64) & DATA_IN;
|
140 |
|
|
when others => TEMP_NEW_DATA(97 downto 0) := OLD_DATA(97 downto 0);
|
141 |
|
|
end case;
|
142 |
|
|
|
143 |
|
|
TEMP_NEW_DATA_OUT <= TEMP_NEW_DATA;
|
144 |
|
|
|
145 |
|
|
end process CODE_CALC;
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
MOVE: process(TEMP_NEW_DATA_OUT , MATCH_LENGTH)
|
149 |
|
|
|
150 |
|
|
begin
|
151 |
|
|
|
152 |
|
|
case MATCH_LENGTH is
|
153 |
|
|
when "000000" => NEW_DATA <= TEMP_NEW_DATA_OUT(132 downto 0);
|
154 |
|
|
when "000001" => NEW_DATA <= TEMP_NEW_DATA_OUT(131 downto 0)&'0';
|
155 |
|
|
when "000010" => NEW_DATA <= TEMP_NEW_DATA_OUT(130 downto 0)&"00";
|
156 |
|
|
when "000011" => NEW_DATA <= TEMP_NEW_DATA_OUT(129 downto 0)&"000";
|
157 |
|
|
when "000100" => NEW_DATA <= TEMP_NEW_DATA_OUT(128 downto 0)&"0000";
|
158 |
|
|
when "000101" => NEW_DATA <= TEMP_NEW_DATA_OUT(127 downto 0)&"00000";
|
159 |
|
|
when "000110" => NEW_DATA <= TEMP_NEW_DATA_OUT(126 downto 0)&"000000";
|
160 |
|
|
when "000111" => NEW_DATA <= TEMP_NEW_DATA_OUT(125 downto 0)&"0000000";
|
161 |
|
|
when "001000" => NEW_DATA <= TEMP_NEW_DATA_OUT(124 downto 0)&"00000000";
|
162 |
|
|
when "001001" => NEW_DATA <= TEMP_NEW_DATA_OUT(123 downto 0)&"000000000";
|
163 |
|
|
when "001010" => NEW_DATA <= TEMP_NEW_DATA_OUT(122 downto 0)&"0000000000";
|
164 |
|
|
when "001011" => NEW_DATA <= TEMP_NEW_DATA_OUT(121 downto 0)&"00000000000";
|
165 |
|
|
when "001100" => NEW_DATA <= TEMP_NEW_DATA_OUT(120 downto 0)&"000000000000";
|
166 |
|
|
when "001101" => NEW_DATA <= TEMP_NEW_DATA_OUT(119 downto 0)&"0000000000000";
|
167 |
|
|
when "001110" => NEW_DATA <= TEMP_NEW_DATA_OUT(118 downto 0)&"00000000000000";
|
168 |
|
|
when "001111" => NEW_DATA <= TEMP_NEW_DATA_OUT(117 downto 0)&"000000000000000";
|
169 |
|
|
when "010000" => NEW_DATA <= TEMP_NEW_DATA_OUT(116 downto 0)&"0000000000000000";
|
170 |
|
|
when "010001" => NEW_DATA <= TEMP_NEW_DATA_OUT(115 downto 0)&"00000000000000000";
|
171 |
|
|
when "010010" => NEW_DATA <= TEMP_NEW_DATA_OUT(114 downto 0)&"000000000000000000";
|
172 |
|
|
when "010011" => NEW_DATA <= TEMP_NEW_DATA_OUT(113 downto 0)&"0000000000000000000";
|
173 |
|
|
when "010100" => NEW_DATA <= TEMP_NEW_DATA_OUT(112 downto 0)&"00000000000000000000";
|
174 |
|
|
when "010101" => NEW_DATA <= TEMP_NEW_DATA_OUT(111 downto 0)&"000000000000000000000";
|
175 |
|
|
when "010110" => NEW_DATA <= TEMP_NEW_DATA_OUT(110 downto 0)&"0000000000000000000000";
|
176 |
|
|
when "010111" => NEW_DATA <= TEMP_NEW_DATA_OUT(109 downto 0)&"00000000000000000000000";
|
177 |
|
|
when "011000" => NEW_DATA <= TEMP_NEW_DATA_OUT(108 downto 0)&"000000000000000000000000";
|
178 |
|
|
when "011001" => NEW_DATA <= TEMP_NEW_DATA_OUT(107 downto 0)&"0000000000000000000000000";
|
179 |
|
|
when "011010" => NEW_DATA <= TEMP_NEW_DATA_OUT(106 downto 0)&"00000000000000000000000000";
|
180 |
|
|
when "011011" => NEW_DATA <= TEMP_NEW_DATA_OUT(105 downto 0)&"000000000000000000000000000";
|
181 |
|
|
when "011100" => NEW_DATA <= TEMP_NEW_DATA_OUT(104 downto 0)&"0000000000000000000000000000";
|
182 |
|
|
when "011101" => NEW_DATA <= TEMP_NEW_DATA_OUT(103 downto 0)&"00000000000000000000000000000";
|
183 |
|
|
when "011110" => NEW_DATA <= TEMP_NEW_DATA_OUT(102 downto 0)&"000000000000000000000000000000";
|
184 |
|
|
when "011111" => NEW_DATA <= TEMP_NEW_DATA_OUT(101 downto 0)&"0000000000000000000000000000000";
|
185 |
|
|
when "100000" => NEW_DATA <= TEMP_NEW_DATA_OUT(100 downto 0)&"00000000000000000000000000000000";
|
186 |
|
|
when "100001" => NEW_DATA <= TEMP_NEW_DATA_OUT(99 downto 0) &"000000000000000000000000000000000";
|
187 |
|
|
when "100010" => NEW_DATA <= TEMP_NEW_DATA_OUT(98 downto 0) &"0000000000000000000000000000000000";
|
188 |
|
|
when "100011" => NEW_DATA <= TEMP_NEW_DATA_OUT(97 downto 0) &"00000000000000000000000000000000000";
|
189 |
|
|
when others => NEW_DATA <= TEMP_NEW_DATA_OUT;
|
190 |
|
|
end case;
|
191 |
|
|
|
192 |
|
|
end process MOVE;
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
UNDERFLOW <= INT_UNDERFLOW;
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
end DEC_ASS; -- end of architecture
|
200 |
|
|
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|