Files
IEEE754Adder/Swap.vhd

35 lines
559 B
VHDL
Raw Permalink Normal View History

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Swap is
2019-08-29 15:12:25 +02:00
generic(
BITCOUNT : integer := 8
);
port(
X_IN, Y_IN : in std_logic_vector((BITCOUNT-1) downto 0);
SW : in std_logic;
X_OUT, Y_OUT : out std_logic_vector((BITCOUNT-1) downto 0)
);
2019-08-29 15:12:25 +02:00
end Swap;
architecture SwapArch of Swap is
begin
2019-08-29 15:12:25 +02:00
2019-08-29 18:08:25 +02:00
SWAP_PROCESS : process (X_IN, Y_IN, SW)
2019-08-29 15:12:25 +02:00
begin
2019-08-29 15:12:25 +02:00
for i in (BITCOUNT-1) downto 0 loop
X_OUT(i) <= (not(SW) and X_IN(i)) or (SW and Y_IN(i));
Y_OUT(i) <= (not(SW) and Y_IN(i)) or (SW and X_IN(i));
end loop;
2019-08-29 15:12:25 +02:00
end process;
end SwapArch;