[an error occurred while processing this directive]
|
Генерится куча мультиплексоров. Но сдаётся что эту схему можно сделать проще, например дешифраторы в мультиплексорах одинаковые. Или может RTL вьювер выдаёт предварительную схему, а потом она оптимизируется?
library ieee,work;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.pack.all;
entity p_barrel_shifter is
generic
(
width_data : INTEGER := 32;
width_shift : INTEGER := 5;
max_shift_value : INTEGER := 16;
width_result : INTEGER := 16
);
port
(
data : in STD_LOGIC_VECTOR (width_data - 1 downto 0);
shift : in STD_LOGIC_VECTOR (width_shift - 1 downto 0);
result : out STD_LOGIC_VECTOR (width_result - 1 downto 0)
);
end p_barrel_shifter;
architecture first of p_barrel_shifter is
begin
process (data, shift)
type shift_array is array (max_shift_value downto 0) of STD_LOGIC_VECTOR (width_result - 1 downto 0);
variable shift_array_var : shift_array;
begin
loop0 : for i in 0 to max_shift_value loop
shift_array_var(i) := data(width_result - 1 + i downto i);
end loop loop0;
result <= shift_array_var(TO_INTEGER(UNSIGNED(shift)));
end process;
end first;
E-mail: info@telesys.ru