1 |
2 |
riedelx |
library IEEE;
|
2 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
3 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
4 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
5 |
|
|
|
6 |
|
|
use work.CortexIinclude.ALL;
|
7 |
|
|
|
8 |
|
|
entity bshifter is Port(
|
9 |
|
|
din : in std_logic_vector(31 downto 0);
|
10 |
|
|
size : in std_logic_vector( 1 downto 0);
|
11 |
|
|
mode : in std_logic_vector( 2 downto 0);
|
12 |
|
|
count : in std_logic_vector( 4 downto 0);
|
13 |
|
|
cyOut : out std_logic;
|
14 |
|
|
dout : out std_logic_vector(31 downto 0)
|
15 |
|
|
);
|
16 |
|
|
end bshifter;
|
17 |
|
|
|
18 |
|
|
Library UNISIM;
|
19 |
|
|
use UNISIM.vcomponents.all;
|
20 |
|
|
|
21 |
|
|
architecture behavioral of bshifter is
|
22 |
|
|
|
23 |
|
|
signal shift : std_logic_vector(4 downto 0);
|
24 |
|
|
signal ENCODE : STD_LOGIC_VECTOR (17 downto 0);
|
25 |
|
|
signal WORDA : STD_LOGIC_VECTOR (17 downto 0);
|
26 |
|
|
signal WORDB : STD_LOGIC_VECTOR (17 downto 0);
|
27 |
|
|
signal WORDC : STD_LOGIC_VECTOR (17 downto 0);
|
28 |
|
|
signal WORDD : STD_LOGIC_VECTOR (17 downto 0);
|
29 |
|
|
|
30 |
|
|
signal OUTA : STD_LOGIC_VECTOR (35 downto 0);
|
31 |
|
|
signal OUTB : STD_LOGIC_VECTOR (35 downto 0);
|
32 |
|
|
signal OUTC : STD_LOGIC_VECTOR (35 downto 0);
|
33 |
|
|
signal OUTD : STD_LOGIC_VECTOR (35 downto 0);
|
34 |
|
|
|
35 |
|
|
signal temp : std_logic_vector(31 downto 0);
|
36 |
|
|
|
37 |
|
|
signal input : std_logic_vector(31 downto 0);
|
38 |
|
|
signal output : std_logic_vector(31 downto 0);
|
39 |
|
|
|
40 |
|
|
begin
|
41 |
|
|
|
42 |
|
|
process(din, size) -- data in multiplexor
|
43 |
|
|
begin
|
44 |
|
|
case size is
|
45 |
|
|
when SIZE_8BIT => -- 8bit
|
46 |
|
|
input <= din(7 downto 0) &
|
47 |
|
|
din(7 downto 0) &
|
48 |
|
|
din(7 downto 0) &
|
49 |
|
|
din(7 downto 0);
|
50 |
|
|
when SIZE_16BIT => -- 16bit
|
51 |
|
|
input <= din(15 downto 0) & din(15 downto 0);
|
52 |
|
|
when SIZE_32BIT | SIZE_32SBIT => -- 32bit
|
53 |
|
|
input <= din;
|
54 |
|
|
when others =>
|
55 |
|
|
null;
|
56 |
|
|
end case; -- size
|
57 |
|
|
end process;
|
58 |
|
|
|
59 |
|
|
process(output, size, mode) -- data output multiplexor
|
60 |
|
|
begin
|
61 |
|
|
case size is
|
62 |
|
|
when SIZE_8BIT => -- 8bit
|
63 |
|
|
case mode is
|
64 |
|
|
when "000" => -- ROL
|
65 |
|
|
dout <= output;
|
66 |
|
|
when "001" => -- LSL
|
67 |
|
|
dout <= output;
|
68 |
|
|
when "010" => -- ROR
|
69 |
|
|
dout <= output;
|
70 |
|
|
when "011" => -- LSR
|
71 |
|
|
dout <= x"000000" & output(31 downto 24);
|
72 |
|
|
when "100" => -- ASR
|
73 |
|
|
dout <= x"000000" & output(31 downto 24);
|
74 |
|
|
when others =>
|
75 |
|
|
dout <= output;
|
76 |
|
|
end case; -- mode
|
77 |
|
|
when SIZE_16BIT => -- 16bit
|
78 |
|
|
case mode is
|
79 |
|
|
when "000" => -- ROL
|
80 |
|
|
dout <= output;
|
81 |
|
|
when "001" => -- LSL
|
82 |
|
|
dout <= output;
|
83 |
|
|
when "010" => -- ROR
|
84 |
|
|
dout <= output;
|
85 |
|
|
when "011" => -- LSR
|
86 |
|
|
dout <= x"0000" & output(31 downto 16);
|
87 |
|
|
when "100" => -- ASR
|
88 |
|
|
dout <= x"0000" & output(31 downto 16);
|
89 |
|
|
when others =>
|
90 |
|
|
dout <= output;
|
91 |
|
|
end case; -- mode
|
92 |
|
|
when SIZE_32BIT | SIZE_32SBIT => -- 32bit
|
93 |
|
|
dout <= output;
|
94 |
|
|
when others =>
|
95 |
|
|
null;
|
96 |
|
|
end case; -- size
|
97 |
|
|
end process;
|
98 |
|
|
|
99 |
|
|
process(count, mode, temp, input)
|
100 |
|
|
begin
|
101 |
|
|
case mode is
|
102 |
|
|
when BS_ROL => -- ROL
|
103 |
|
|
shift <= count;
|
104 |
|
|
output <= temp;
|
105 |
|
|
cyOut <= input(conv_integer(32 - count));
|
106 |
|
|
when BS_LSL => -- LSL
|
107 |
|
|
shift <= count;
|
108 |
|
|
cyOut <= input(conv_integer(32 - count));
|
109 |
|
|
case count is
|
110 |
|
|
when "00000" =>
|
111 |
|
|
output <= temp;
|
112 |
|
|
when "00001" =>
|
113 |
|
|
output <= temp and "11111111111111111111111111111110";
|
114 |
|
|
when "00010" =>
|
115 |
|
|
output <= temp and "11111111111111111111111111111100";
|
116 |
|
|
when "00011" =>
|
117 |
|
|
output <= temp and "11111111111111111111111111111000";
|
118 |
|
|
when "00100" =>
|
119 |
|
|
output <= temp and "11111111111111111111111111110000";
|
120 |
|
|
when "00101" =>
|
121 |
|
|
output <= temp and "11111111111111111111111111100000";
|
122 |
|
|
when "00110" =>
|
123 |
|
|
output <= temp and "11111111111111111111111111000000";
|
124 |
|
|
when "00111" =>
|
125 |
|
|
output <= temp and "11111111111111111111111110000000";
|
126 |
|
|
when "01000" =>
|
127 |
|
|
output <= temp and "11111111111111111111111100000000";
|
128 |
|
|
when "01001" =>
|
129 |
|
|
output <= temp and "11111111111111111111111000000000";
|
130 |
|
|
when "01010" =>
|
131 |
|
|
output <= temp and "11111111111111111111110000000000";
|
132 |
|
|
when "01011" =>
|
133 |
|
|
output <= temp and "11111111111111111111100000000000";
|
134 |
|
|
when "01100" =>
|
135 |
|
|
output <= temp and "11111111111111111111000000000000";
|
136 |
|
|
when "01101" =>
|
137 |
|
|
output <= temp and "11111111111111111110000000000000";
|
138 |
|
|
when "01110" =>
|
139 |
|
|
output <= temp and "11111111111111111100000000000000";
|
140 |
|
|
when "01111" =>
|
141 |
|
|
output <= temp and "11111111111111111000000000000000";
|
142 |
|
|
when "10000" =>
|
143 |
|
|
output <= temp and "11111111111111110000000000000000";
|
144 |
|
|
when "10001" =>
|
145 |
|
|
output <= temp and "11111111111111100000000000000000";
|
146 |
|
|
when "10010" =>
|
147 |
|
|
output <= temp and "11111111111111000000000000000000";
|
148 |
|
|
when "10011" =>
|
149 |
|
|
output <= temp and "11111111111110000000000000000000";
|
150 |
|
|
when "10100" =>
|
151 |
|
|
output <= temp and "11111111111100000000000000000000";
|
152 |
|
|
when "10101" =>
|
153 |
|
|
output <= temp and "11111111111000000000000000000000";
|
154 |
|
|
when "10110" =>
|
155 |
|
|
output <= temp and "11111111110000000000000000000000";
|
156 |
|
|
when "10111" =>
|
157 |
|
|
output <= temp and "11111111100000000000000000000000";
|
158 |
|
|
when "11000" =>
|
159 |
|
|
output <= temp and "11111111000000000000000000000000";
|
160 |
|
|
when "11001" =>
|
161 |
|
|
output <= temp and "11111110000000000000000000000000";
|
162 |
|
|
when "11010" =>
|
163 |
|
|
output <= temp and "11111100000000000000000000000000";
|
164 |
|
|
when "11011" =>
|
165 |
|
|
output <= temp and "11111000000000000000000000000000";
|
166 |
|
|
when "11100" =>
|
167 |
|
|
output <= temp and "11110000000000000000000000000000";
|
168 |
|
|
when "11101" =>
|
169 |
|
|
output <= temp and "11100000000000000000000000000000";
|
170 |
|
|
when "11110" =>
|
171 |
|
|
output <= temp and "11000000000000000000000000000000";
|
172 |
|
|
when "11111" =>
|
173 |
|
|
output <= temp and "10000000000000000000000000000000";
|
174 |
|
|
when others =>
|
175 |
|
|
output <= temp;
|
176 |
|
|
end case; -- count
|
177 |
|
|
when BS_ROR => -- ROR
|
178 |
|
|
shift <= 32 - count;
|
179 |
|
|
output <= temp;
|
180 |
|
|
cyOut <= input(conv_integer(count - 1));
|
181 |
|
|
when BS_LSR => -- LSR
|
182 |
|
|
shift <= 32 - count;
|
183 |
|
|
cyOut <= input(conv_integer(count - 1));
|
184 |
|
|
case count is
|
185 |
|
|
when "00000" =>
|
186 |
|
|
output <= temp;
|
187 |
|
|
when "00001" =>
|
188 |
|
|
output <= temp and "01111111111111111111111111111111";
|
189 |
|
|
when "00010" =>
|
190 |
|
|
output <= temp and "00111111111111111111111111111111";
|
191 |
|
|
when "00011" =>
|
192 |
|
|
output <= temp and "00011111111111111111111111111111";
|
193 |
|
|
when "00100" =>
|
194 |
|
|
output <= temp and "00001111111111111111111111111111";
|
195 |
|
|
when "00101" =>
|
196 |
|
|
output <= temp and "00000111111111111111111111111111";
|
197 |
|
|
when "00110" =>
|
198 |
|
|
output <= temp and "00000011111111111111111111111111";
|
199 |
|
|
when "00111" =>
|
200 |
|
|
output <= temp and "00000001111111111111111111111111";
|
201 |
|
|
when "01000" =>
|
202 |
|
|
output <= temp and "00000000111111111111111111111111";
|
203 |
|
|
when "01001" =>
|
204 |
|
|
output <= temp and "00000000011111111111111111111111";
|
205 |
|
|
when "01010" =>
|
206 |
|
|
output <= temp and "00000000001111111111111111111111";
|
207 |
|
|
when "01011" =>
|
208 |
|
|
output <= temp and "00000000000111111111111111111111";
|
209 |
|
|
when "01100" =>
|
210 |
|
|
output <= temp and "00000000000011111111111111111111";
|
211 |
|
|
when "01101" =>
|
212 |
|
|
output <= temp and "00000000000001111111111111111111";
|
213 |
|
|
when "01110" =>
|
214 |
|
|
output <= temp and "00000000000000111111111111111111";
|
215 |
|
|
when "01111" =>
|
216 |
|
|
output <= temp and "00000000000000011111111111111111";
|
217 |
|
|
when "10000" =>
|
218 |
|
|
output <= temp and "00000000000000001111111111111111";
|
219 |
|
|
when "10001" =>
|
220 |
|
|
output <= temp and "00000000000000000111111111111111";
|
221 |
|
|
when "10010" =>
|
222 |
|
|
output <= temp and "00000000000000000011111111111111";
|
223 |
|
|
when "10011" =>
|
224 |
|
|
output <= temp and "00000000000000000001111111111111";
|
225 |
|
|
when "10100" =>
|
226 |
|
|
output <= temp and "00000000000000000000111111111111";
|
227 |
|
|
when "10101" =>
|
228 |
|
|
output <= temp and "00000000000000000000011111111111";
|
229 |
|
|
when "10110" =>
|
230 |
|
|
output <= temp and "00000000000000000000001111111111";
|
231 |
|
|
when "10111" =>
|
232 |
|
|
output <= temp and "00000000000000000000000111111111";
|
233 |
|
|
when "11000" =>
|
234 |
|
|
output <= temp and "00000000000000000000000011111111";
|
235 |
|
|
when "11001" =>
|
236 |
|
|
output <= temp and "00000000000000000000000001111111";
|
237 |
|
|
when "11010" =>
|
238 |
|
|
output <= temp and "00000000000000000000000000111111";
|
239 |
|
|
when "11011" =>
|
240 |
|
|
output <= temp and "00000000000000000000000000011111";
|
241 |
|
|
when "11100" =>
|
242 |
|
|
output <= temp and "00000000000000000000000000001111";
|
243 |
|
|
when "11101" =>
|
244 |
|
|
output <= temp and "00000000000000000000000000000111";
|
245 |
|
|
when "11110" =>
|
246 |
|
|
output <= temp and "00000000000000000000000000000011";
|
247 |
|
|
when "11111" =>
|
248 |
|
|
output <= temp and "00000000000000000000000000000001";
|
249 |
|
|
when others =>
|
250 |
|
|
output <= temp;
|
251 |
|
|
end case; -- count
|
252 |
|
|
when BS_ASR => -- ASR
|
253 |
|
|
shift <= 32 - count;
|
254 |
|
|
cyOut <= input(conv_integer(count - 1));
|
255 |
|
|
case count is
|
256 |
|
|
when "00000" =>
|
257 |
|
|
output <= (input(31) & input(31) & input(31) & input(31) &
|
258 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
259 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
260 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
261 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
262 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
263 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
264 |
|
|
input(31) & input(31) & input(31) & input(31));
|
265 |
|
|
when "00001" =>
|
266 |
|
|
output <= (temp and "01111111111111111111111111111111") or
|
267 |
|
|
(input(31) & "0000000000000000000000000000000");
|
268 |
|
|
when "00010" =>
|
269 |
|
|
output <= (temp and "00111111111111111111111111111111") or
|
270 |
|
|
(input(31) & input(31) &
|
271 |
|
|
"000000000000000000000000000000");
|
272 |
|
|
when "00011" =>
|
273 |
|
|
output <= (temp and "00011111111111111111111111111111") or
|
274 |
|
|
(input(31) & input(31) & input(31) &
|
275 |
|
|
"00000000000000000000000000000");
|
276 |
|
|
when "00100" =>
|
277 |
|
|
output <= (temp and "00001111111111111111111111111111") or
|
278 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
279 |
|
|
"0000000000000000000000000000");
|
280 |
|
|
when "00101" =>
|
281 |
|
|
output <= (temp and "00000111111111111111111111111111") or
|
282 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
283 |
|
|
input(31) & "000000000000000000000000000");
|
284 |
|
|
when "00110" =>
|
285 |
|
|
output <= (temp and "00000011111111111111111111111111") or
|
286 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
287 |
|
|
input(31) & input(31) &
|
288 |
|
|
"00000000000000000000000000");
|
289 |
|
|
when "00111" =>
|
290 |
|
|
output <= (temp and "00000001111111111111111111111111") or
|
291 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
292 |
|
|
input(31) & input(31) & input(31) &
|
293 |
|
|
"0000000000000000000000000");
|
294 |
|
|
when "01000" =>
|
295 |
|
|
output <= (temp and "00000000111111111111111111111111") or
|
296 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
297 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
298 |
|
|
"000000000000000000000000");
|
299 |
|
|
when "01001" =>
|
300 |
|
|
output <= (temp and "00000000011111111111111111111111") or
|
301 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
302 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
303 |
|
|
input(31) & "00000000000000000000000");
|
304 |
|
|
when "01010" =>
|
305 |
|
|
output <= (temp and "00000000001111111111111111111111") or
|
306 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
307 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
308 |
|
|
input(31) & input(31) & "0000000000000000000000");
|
309 |
|
|
when "01011" =>
|
310 |
|
|
output <= (temp and "00000000000111111111111111111111") or
|
311 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
312 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
313 |
|
|
input(31) & input(31) & input(31) &
|
314 |
|
|
"000000000000000000000");
|
315 |
|
|
when "01100" =>
|
316 |
|
|
output <= (temp and "00000000000011111111111111111111") or
|
317 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
318 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
319 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
320 |
|
|
"00000000000000000000");
|
321 |
|
|
when "01101" =>
|
322 |
|
|
output <= (temp and "00000000000001111111111111111111") or
|
323 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
324 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
325 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
326 |
|
|
input(31) & "0000000000000000000");
|
327 |
|
|
when "01110" =>
|
328 |
|
|
output <= (temp and "00000000000000111111111111111111") or
|
329 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
330 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
331 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
332 |
|
|
input(31) & input(31) & "000000000000000000");
|
333 |
|
|
when "01111" =>
|
334 |
|
|
output <= (temp and "00000000000000011111111111111111") or
|
335 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
336 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
337 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
338 |
|
|
input(31) & input(31) & input(31) &
|
339 |
|
|
"00000000000000000");
|
340 |
|
|
when "10000" =>
|
341 |
|
|
output <= (temp and "00000000000000001111111111111111") or
|
342 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
343 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
344 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
345 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
346 |
|
|
"0000000000000000");
|
347 |
|
|
when "10001" =>
|
348 |
|
|
output <= (temp and "00000000000000000111111111111111") or
|
349 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
350 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
351 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
352 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
353 |
|
|
input(31) & "000000000000000");
|
354 |
|
|
when "10010" =>
|
355 |
|
|
output <= (temp and "00000000000000000011111111111111") or
|
356 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
357 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
358 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
359 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
360 |
|
|
input(31) & input(31) & "00000000000000");
|
361 |
|
|
when "10011" =>
|
362 |
|
|
output <= (temp and "00000000000000000001111111111111") or
|
363 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
364 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
365 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
366 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
367 |
|
|
input(31) & input(31) & input(31) & "0000000000000");
|
368 |
|
|
when "10100" =>
|
369 |
|
|
output <= (temp and "00000000000000000000111111111111") or
|
370 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
371 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
372 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
373 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
374 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
375 |
|
|
"000000000000");
|
376 |
|
|
when "10101" =>
|
377 |
|
|
output <= (temp and "00000000000000000000011111111111") or
|
378 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
379 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
380 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
381 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
382 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
383 |
|
|
input(31) & "00000000000");
|
384 |
|
|
when "10110" =>
|
385 |
|
|
output <= (temp and "00000000000000000000001111111111") or
|
386 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
387 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
388 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
389 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
390 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
391 |
|
|
input(31) & input(31) & "0000000000");
|
392 |
|
|
when "10111" =>
|
393 |
|
|
output <= (temp and "00000000000000000000000111111111") or
|
394 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
395 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
396 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
397 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
398 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
399 |
|
|
input(31) & input(31) & input(31) & "000000000");
|
400 |
|
|
when "11000" =>
|
401 |
|
|
output <= (temp and "00000000000000000000000011111111") or
|
402 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
403 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
404 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
405 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
406 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
407 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
408 |
|
|
"00000000");
|
409 |
|
|
when "11001" =>
|
410 |
|
|
output <= (temp and "00000000000000000000000001111111") or
|
411 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
412 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
413 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
414 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
415 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
416 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
417 |
|
|
input(31) & "0000000");
|
418 |
|
|
when "11010" =>
|
419 |
|
|
output <= (temp and "00000000000000000000000000111111") or
|
420 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
421 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
422 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
423 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
424 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
425 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
426 |
|
|
input(31) & input(31) & "000000");
|
427 |
|
|
when "11011" =>
|
428 |
|
|
output <= (temp and "00000000000000000000000000011111") or
|
429 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
430 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
431 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
432 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
433 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
434 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
435 |
|
|
input(31) & input(31) & input(31) & "00000");
|
436 |
|
|
when "11100" =>
|
437 |
|
|
output <= (temp and "00000000000000000000000000001111") or
|
438 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
439 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
440 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
441 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
442 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
443 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
444 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
445 |
|
|
"0000");
|
446 |
|
|
when "11101" =>
|
447 |
|
|
output <= (temp and "00000000000000000000000000000111") or
|
448 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
449 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
450 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
451 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
452 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
453 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
454 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
455 |
|
|
input(31) & "000");
|
456 |
|
|
when "11110" =>
|
457 |
|
|
output <= (temp and "00000000000000000000000000000011") or
|
458 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
459 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
460 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
461 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
462 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
463 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
464 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
465 |
|
|
input(31) & input(31) & "00");
|
466 |
|
|
when "11111" =>
|
467 |
|
|
output <= (temp and "00000000000000000000000000000001") or
|
468 |
|
|
(input(31) & input(31) & input(31) & input(31) &
|
469 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
470 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
471 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
472 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
473 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
474 |
|
|
input(31) & input(31) & input(31) & input(31) &
|
475 |
|
|
input(31) & input(31) & input(31) & "0");
|
476 |
|
|
when others =>
|
477 |
|
|
output <= temp;
|
478 |
|
|
end case; -- count
|
479 |
|
|
when others =>
|
480 |
|
|
shift <= count;
|
481 |
|
|
output <= temp;
|
482 |
|
|
end case; -- mode
|
483 |
|
|
end process;
|
484 |
|
|
|
485 |
|
|
-------------- 32bit barrel shifter
|
486 |
|
|
ENCODE(17 downto 8) <= (others => '0');
|
487 |
|
|
|
488 |
|
|
WORDA(17 downto 16) <= (others => '0');
|
489 |
|
|
WORDB(17 downto 16) <= (others => '0');
|
490 |
|
|
WORDC(17 downto 16) <= (others => '0');
|
491 |
|
|
WORDD(17 downto 16) <= (others => '0');
|
492 |
|
|
|
493 |
|
|
WORDA(15 downto 8) <= input ( 7 downto 0);
|
494 |
|
|
WORDB(15 downto 8) <= input (15 downto 8);
|
495 |
|
|
WORDC(15 downto 8) <= input (23 downto 16);
|
496 |
|
|
WORDD(15 downto 8) <= input (31 downto 24);
|
497 |
|
|
|
498 |
|
|
WORDA(7 downto 0) <= input (31 downto 24);
|
499 |
|
|
WORDB(7 downto 0) <= input ( 7 downto 0);
|
500 |
|
|
WORDC(7 downto 0) <= input (15 downto 8);
|
501 |
|
|
WORDD(7 downto 0) <= input (23 downto 16);
|
502 |
|
|
|
503 |
|
|
ONE_HOT:
|
504 |
|
|
with SHIFT(2 downto 0) select
|
505 |
|
|
encode(7 downto 0) <=
|
506 |
|
|
"00000001" when "000", --0
|
507 |
|
|
"00000010" when "001", --1
|
508 |
|
|
"00000100" when "010", --2
|
509 |
|
|
"00001000" when "011", --3
|
510 |
|
|
"00010000" when "100", --4
|
511 |
|
|
"00100000" when "101", --5
|
512 |
|
|
"01000000" when "110", --6
|
513 |
|
|
"10000000" when others; --7
|
514 |
|
|
|
515 |
|
|
MULTA: MULT18X18 port map (A => WORDA, B => ENCODE, P => OUTA);
|
516 |
|
|
MULTB: MULT18X18 port map (A => WORDB, B => ENCODE, P => OUTB);
|
517 |
|
|
MULTC: MULT18X18 port map (A => WORDC, B => ENCODE, P => OUTC);
|
518 |
|
|
MULTD: MULT18X18 port map (A => WORDD, B => ENCODE, P => OUTD);
|
519 |
|
|
|
520 |
|
|
MUXA:
|
521 |
|
|
process(SHIFT, OUTA, OUTB, OUTC, OUTD)
|
522 |
|
|
begin
|
523 |
|
|
case SHIFT(4 downto 3) is
|
524 |
|
|
when "00" => temp(7 downto 0) <= OUTA(15 downto 8);
|
525 |
|
|
when "01" => temp(7 downto 0) <= OUTD(15 downto 8);
|
526 |
|
|
when "10" => temp(7 downto 0) <= OUTC(15 downto 8);
|
527 |
|
|
when others => temp(7 downto 0) <= OUTB(15 downto 8);
|
528 |
|
|
end case;
|
529 |
|
|
end process;
|
530 |
|
|
|
531 |
|
|
MUXB:
|
532 |
|
|
process(SHIFT, OUTA, OUTB, OUTC, OUTD)
|
533 |
|
|
begin
|
534 |
|
|
case SHIFT(4 downto 3) is
|
535 |
|
|
when "00" => temp(15 downto 8) <= OUTB(15 downto 8);
|
536 |
|
|
when "01" => temp(15 downto 8) <= OUTA(15 downto 8);
|
537 |
|
|
when "10" => temp(15 downto 8) <= OUTD(15 downto 8);
|
538 |
|
|
when others => temp(15 downto 8) <= OUTC(15 downto 8);
|
539 |
|
|
end case;
|
540 |
|
|
end process;
|
541 |
|
|
|
542 |
|
|
MUXC:
|
543 |
|
|
process(SHIFT, OUTA, OUTB, OUTC, OUTD)
|
544 |
|
|
begin
|
545 |
|
|
case SHIFT(4 downto 3) is
|
546 |
|
|
when "00" => temp(23 downto 16) <= OUTC(15 downto 8);
|
547 |
|
|
when "01" => temp(23 downto 16) <= OUTB(15 downto 8);
|
548 |
|
|
when "10" => temp(23 downto 16) <= OUTA(15 downto 8);
|
549 |
|
|
when others => temp(23 downto 16) <= OUTD(15 downto 8);
|
550 |
|
|
end case;
|
551 |
|
|
end process;
|
552 |
|
|
|
553 |
|
|
MUXD:
|
554 |
|
|
process(SHIFT, OUTA, OUTB, OUTC, OUTD)
|
555 |
|
|
begin
|
556 |
|
|
case SHIFT(4 downto 3) is
|
557 |
|
|
when "00" => temp(31 downto 24) <= OUTD(15 downto 8);
|
558 |
|
|
when "01" => temp(31 downto 24) <= OUTC(15 downto 8);
|
559 |
|
|
when "10" => temp(31 downto 24) <= OUTB(15 downto 8);
|
560 |
|
|
when others => temp(31 downto 24) <= OUTA(15 downto 8);
|
561 |
|
|
end case;
|
562 |
|
|
end process;
|
563 |
|
|
|
564 |
|
|
end behavioral;
|
565 |
|
|
|