VHDL code for full adder? plz help?

anyone can explain abouth this matter?

Answer:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

------------------------------...

entity ADDER is

generic(n: natural :=2);
port(A:in std_logic_vector(n-1 downto 0);
B:in std_logic_vector(n-1 downto 0);
carry:out std_logic;
sum:out std_logic_vector(n-1 downto 0)
);

end ADDER;

------------------------------...

architecture behv of ADDER is

-- define a temparary signal to store the result

signal result: std_logic_vector(n downto 0);

begin

-- the 3rd bit should be carry

result <= ('0' & A)+('0' & B);
sum <= result(n-1 downto 0);
carry <= result(n);

end behv;

The answers post by the user, for information only, FunQA.com does not guarantee the right.



More Questions and Answers:
  • Will the length of the wings of a paper glider affect the length of its flight?
  • Why Relaxation Oscillators DON'T satisfy BARKHAUSEN CRITERIA?
  • What makes the whistle when you blow?
  • Why is flyback converter(DC to DC converter) called so and what are its main advantages over other techniques?
  • What's six zigma quality control?
  • Where can i get a copy of a table of fits based on hole-basis system?
  • Why does manhattan require steam in the middle of the summer?
  • What is this clock part?
  • What is resonant vibration?