19 lines
402 B
VHDL
19 lines
402 B
VHDL
-- Code your design here
|
|
library IEEE;
|
|
use IEEE.std_logic_1164.all;
|
|
|
|
-- Entity HA
|
|
entity halfadder is
|
|
port (a_i : in std_logic;
|
|
b_i : in std_logic;
|
|
sum_o : out std_logic;
|
|
cy_o : out std_logic);
|
|
end halfadder;
|
|
|
|
-- Architecture HA
|
|
architecture behavior of halfadder is
|
|
begin
|
|
-- HA is made out of 2 gates:
|
|
sum_o <= a_i xor b_i;
|
|
cy_o <= a_i and b_i;
|
|
end behavior; |