Can you write a full VHDL code Where a and b are 4 bit digit

Can you write a full VHDL code.
Where a and b are 4 bit digit .
b constant with 1011 .
a is any 4 bit insert by the user .

HA HA HA FA FA FA FA FA FA HA: Half Adder FA: Full Adder a b a b a b aybe bo a bo aobo a,b a b aob2

Solution

VHDL Code is shown below

LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
USE ieee.std_logic_arith.all ;

ENTITY Fulladder IS
PORT (        a : in std_logic_vector(3 downto 0);
   constant b : std_logic_vector(3 downto 0) := \"1011\";
       c : out std_logic_vector(3 downto 0) ) ;
END Fulladder ;


ARCHITECTURE Behavior OF Fulladder IS
BEGIN
c(0) <= a(0) and b(0);
c(1) <= (a(1) and b(0)) xor (a(0) and b(1));
c(2) <= c(1) xor ((a(2) and b(0)) xor (a(1) and b(1)) xor (a(0) and b(2)));
c(3) <= c(2) xor ((not(a(3) and b(0))) xor (a(2) and b(1)) xor (a(1) and b(2)) xor (not(a(0) and b(3))));
c(4) <= c(3) xor (\'1\' xor (not(a(3) and b(a))) xor (a(2) and b(2)) xor (not(a(1) and b(3))));
c(5) <= c(4) xor ((not(a(3) and b(2))) xor (not(a(2) and b(3))));
c(6) <= c(5) xor (a(3) and b(3));
c(7) <= c(6) xor (\'1\');
END Behavior ;

 Can you write a full VHDL code. Where a and b are 4 bit digit . b constant with 1011 . a is any 4 bit insert by the user . HA HA HA FA FA FA FA FA FA HA: Half

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site