User talk:Iskrenpp

Here are some VHDL files for 8-function ALU (Arithmetic Logic Unit) with and without CIN( carry-in): 8-function ALU without CIN:

LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.std_logic_unsigned.ALL; ENTITY aluv2 IS PORT( AI,BI :IN std_logic_vector(3 DOWNTO 0); FI :IN std_logic_vector(2 DOWNTO 0); SOUT: OUT std_logic_vector(4 DOWNTO 0)); END aluv2; ARCHITECTURE arc OF aluv2 IS SIGNAL Sum,IAI,IBI :std_logic_vector(4 DOWNTO 0); BEGIN IAI<='0' & AI; IBI<='0' & BI; WITH FI SELECT Sum<=IAI WHEN "000", NOT IAI WHEN "001", IAI+IBI WHEN "010", IAI-IBI WHEN "011", IAI AND IBI WHEN "100", IAI OR IBI WHEN "101", IAI+1 WHEN "110", IAI-1 WHEN "111"; SOUT<=Sum(4 DOWNTO 0); END arc;

8-function ALU with CIN:

LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.std_logic_unsigned.ALL; ENTITY aluv2 IS PORT( AI,BI :IN std_logic_vector(3 DOWNTO 0); FI :IN std_logic_vector(2 DOWNTO 0); SOUT: OUT std_logic_vector(4 DOWNTO 0)); END aluv2; ARCHITECTURE arc OF aluv2 IS SIGNAL Sum,IAI,IBI :std_logic_vector(4 DOWNTO 0); BEGIN IAI<='0' & AI; IBI<='0' & BI; WITH FI SELECT Sum<=IAI WHEN "000", NOT IAI WHEN "001", IAI+IBI WHEN "010", IAI-IBI WHEN "011", IAI AND IBI WHEN "100", IAI OR IBI WHEN "101", IAI+1 WHEN "110", IAI-1 WHEN "111"; SOUT<=Sum(4 DOWNTO 0); END arc;