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

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [src/] [pc_generate.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       = PC_GENERATE   --
19
--  version      = 2.0           --
20
--  last update  = 3/8/99        --
21
--  author       = Jose Nunez    --
22
-----------------------------------
23
 
24
 
25
-- FUNCTION
26
-- generate the phased binary code for a given location ond table size (next free location)
27
 
28
 
29
-- PIN LIST
30
-- NFL_M_ONE  = next free location minus one in the dictionary
31
-- MATCH_LOC  = match location
32
-- MISS       = indicates that a miss occurred (active low), i.e MATCH_LOC is invalid
33
-- TABLE_FULL = signal to indicate that the table is full (active LOW)
34
-- CODE       = output phased binary code
35
-- LENGTH     = length of the output code
36
 
37
 
38
library ieee,dzx;
39
use ieee.std_logic_1164.all;
40
use dzx.bit_arith.all;
41
use dzx.bit_utils.all;
42
 
43
 
44
entity PC_GENERATE is
45
port
46
(
47
    NFL_M_ONE : in bit_vector(3 downto 0);
48
        MATCH_LOC : in bit_vector(3 downto 0);
49
        MISS : in bit;
50
        TABLE_FULL : in bit;
51
        CODE : out bit_vector(4 downto 0);
52
        LENGTH : out bit_vector(2 downto 0)
53
);
54
 
55
end PC_GENERATE;
56
 
57
 
58
architecture PHASED2 of PC_GENERATE is
59
 
60
 
61
 
62
signal K : bit_vector(3 downto 0);
63
 
64
signal K_MINUS_ONE : bit_vector(3 downto 0);
65
 
66
signal TWO_K_M_ROW : bit_vector(3 downto 0);
67
 
68
signal LESS_THAN : bit;
69
 
70
signal CODE_A : bit_vector(3 downto 0);
71
 
72
signal CODE_B : bit_vector(3 downto 0);
73
 
74
signal CODE_Y : bit_vector(3 downto 0);
75
 
76
signal CODE_SHIFTED : bit_vector(3 downto 0);
77
 
78
 
79
signal LENGTH_A : bit_vector(2 downto 0);
80
 
81
signal LENGTH_B : bit_vector(2 downto 0);
82
 
83
signal LENGTH_Y : bit_vector(2 downto 0);
84
 
85
 
86
signal SUM : bit_vector(3 downto 0);
87
 
88
 
89
begin
90
 
91
 
92
OR_TREE : process(NFL_M_ONE)
93
 
94
variable TEMP_K : bit_vector(3 downto 0);
95
 
96
begin
97
 
98
TEMP_K := "0000";
99
 
100
 
101
 
102
for I in 3 downto 0 loop
103
 
104
    for J in 3 downto I loop
105
 
106
        TEMP_K(I) := TEMP_K(I) or NFL_M_ONE(J);
107
 
108
    end loop;
109
 
110
end loop;
111
 
112
K <= TEMP_K;
113
 
114
K_MINUS_ONE <= '0' & TEMP_K(3 downto 1);
115
 
116
end process OR_TREE;
117
 
118
 
119
 
120
 
121
 
122
 
123
 
124
 
125
 
126
COMPARE : process (TWO_K_M_ROW , MATCH_LOC)
127
 
128
begin
129
 
130
if (MATCH_LOC < TWO_K_M_ROW) then
131
 
132
    LESS_THAN <= '0';
133
 
134
else
135
 
136
    LESS_THAN <= '1';
137
 
138
end if;
139
 
140
end process COMPARE;
141
 
142
 
143
 
144
 
145
 
146
CONVA : process(K_MINUS_ONE)
147
 
148
begin
149
 
150
case K_MINUS_ONE  is
151
 
152
    when "1111" => LENGTH_A <= "101";
153
 
154
    when "0111" => LENGTH_A <= "100";
155
 
156
    when "0011" => LENGTH_A <= "011";
157
 
158
    when "0001" => LENGTH_A <= "010";
159
 
160
    when "0000" => LENGTH_A <= "001";
161
 
162
    when others    => LENGTH_A <= "000";
163
 
164
end case;
165
 
166
end process CONVA;
167
 
168
 
169
 
170
 
171
 
172
CONVB : process(K)
173
 
174
begin
175
 
176
case K  is
177
 
178
    when "1111" => LENGTH_B <= "101";
179
 
180
        when "0111" => LENGTH_B <= "100";
181
 
182
        when "0011" => LENGTH_B <= "011";
183
 
184
    when "0001" => LENGTH_B <= "010";
185
 
186
    when "0000" => LENGTH_B <= "001";
187
 
188
    when others    => LENGTH_B <= "000";
189
 
190
end case;
191
 
192
end process CONVB;
193
 
194
 
195
MUXES_ONE : process ( LESS_THAN , TABLE_FULL , CODE_A , CODE_B , LENGTH_A , LENGTH_B, MATCH_LOC )
196
 
197
begin
198
 
199
if (TABLE_FULL = '0') then
200
 
201
        CODE_Y <= MATCH_LOC;
202
 
203
        LENGTH_Y <= "101";
204
 
205
else
206
 
207
        if (LESS_THAN = '0') then
208
 
209
                CODE_Y <= CODE_A;
210
 
211
                LENGTH_Y <= LENGTH_A;
212
 
213
        else
214
 
215
                CODE_Y <= CODE_B;
216
 
217
                LENGTH_Y <= LENGTH_B;
218
 
219
        end if;
220
 
221
end if;
222
 
223
end process MUXES_ONE;
224
 
225
 
226
MUXES_TWO : process ( MISS , CODE_SHIFTED , LENGTH_Y )
227
 
228
begin
229
 
230
if (MISS = '1') then
231
 
232
    CODE <= '1' & "0000";
233
 
234
    LENGTH <= "001";
235
 
236
else
237
 
238
    CODE <= '0' & CODE_SHIFTED;
239
 
240
    LENGTH <= LENGTH_Y;
241
 
242
end if;
243
 
244
end process MUXES_TWO;
245
 
246
 
247
SHIFT_CODE : process ( CODE_Y , LENGTH_Y)
248
 
249
begin
250
 
251
case LENGTH_Y is
252
 
253
    when "001" => CODE_SHIFTED <= "0000";
254
 
255
    when "010" => CODE_SHIFTED <= CODE_Y(0) & "000";
256
 
257
    when "011" => CODE_SHIFTED <= CODE_Y(1 downto 0) & "00";
258
 
259
    when "100" => CODE_SHIFTED <= CODE_Y(2 downto 0) & "0";
260
 
261
    when "101" => CODE_SHIFTED <= CODE_Y(3 downto 0);
262
 
263
    when others => CODE_SHIFTED <= "0000";
264
 
265
end case;
266
 
267
end process SHIFT_CODE;
268
 
269
 
270
TWO_K_M_ROW <= K and not(NFL_M_ONE);
271
 
272
 
273
 
274
SUM <= TWO_K_M_ROW + MATCH_LOC;
275
 
276
 
277
 
278
 
279
CODE_A <= MATCH_LOC and K_MINUS_ONE;
280
 
281
 
282
CODE_B <= SUM and K;
283
 
284
 
285
 
286
end PHASED2; -- end of architecture
287
 
288
 
289
 
290
 
291
 
292
 

powered by: WebSVN 2.1.0

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