S
Sam Aborhey
Guest
can you tell me whats wrong with this? and please help me fix it - it doesnt
compile and i need it urgently
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
ENTITY adder4 IS
PORT ( Cin :IN STD_LOGIC;
X,Y :IN STD_LOGIC_VECTOR(3 DOWNTO 0);
S :OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
Cout, Overflow :OUT STD_LOGIC;
A,B,C,D :OUT STD_LOGIC);
END adder4;
ARCHITECTURE Behavior OF adder4 is
SIGNAL Sum: STD_LOGIC_VECTOR(4 DOWNTO 0);
BEGIN
SUM <= ('0' & X) OR (Y XOR Cin) OR Cin;
S <= Sum(3 DOWNTO 0);
Cout <= Sum(4);
A <= NOT Sum(2) AND (Sum(0) OR Sum(1));
B <= Sum(0)AND NOT Sum(2);
C <= (Sum(0)AND NOT Sum(2))OR (Sum(0)AND SUM(1))OR (Sum(2)AND NOT Sum(1)AND
NOT Sum(0));
D <= (Sum(2));
Overflow <=Sum(4) XOR X(3) XOR Y(3) XOR Sum(3);
END Behavior;
compile and i need it urgently
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
ENTITY adder4 IS
PORT ( Cin :IN STD_LOGIC;
X,Y :IN STD_LOGIC_VECTOR(3 DOWNTO 0);
S :OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
Cout, Overflow :OUT STD_LOGIC;
A,B,C,D :OUT STD_LOGIC);
END adder4;
ARCHITECTURE Behavior OF adder4 is
SIGNAL Sum: STD_LOGIC_VECTOR(4 DOWNTO 0);
BEGIN
SUM <= ('0' & X) OR (Y XOR Cin) OR Cin;
S <= Sum(3 DOWNTO 0);
Cout <= Sum(4);
A <= NOT Sum(2) AND (Sum(0) OR Sum(1));
B <= Sum(0)AND NOT Sum(2);
C <= (Sum(0)AND NOT Sum(2))OR (Sum(0)AND SUM(1))OR (Sum(2)AND NOT Sum(1)AND
NOT Sum(0));
D <= (Sum(2));
Overflow <=Sum(4) XOR X(3) XOR Y(3) XOR Sum(3);
END Behavior;