Aggiunti moduli Swap, TwoComplement, OperationCheck

This commit is contained in:
2019-08-27 17:16:04 +02:00
parent 019e9a5cd8
commit 8b08af2782
68 changed files with 1885 additions and 103 deletions

27
Swap.vhd Normal file
View File

@@ -0,0 +1,27 @@
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Swap is
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)
);
end Swap;
architecture SwapArch of Swap is
begin
SWAP_PRO: process(X_IN, Y_IN, SW)
begin
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;
end process;
end SwapArch;