aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue1817/full_adder.vhdl
blob: ca24cf5d7a4d52a5c2cf063e341e3bca5fc09f54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-------------------------------------------------------------------------------
-- Title      : Full-Adder
-- Project    :
-------------------------------------------------------------------------------
--! \file     full_adder.vhd
--! \author   Jose Correcher <jose.correcher@gmail.com>
--! \date     Created    : 2021-07-02
--            Last update: 2021-07-02
-- Platform   :
-- Standard   : VHDL'08
-------------------------------------------------------------------------------
-- Description:
--! \class    full_adder
--! \details
--!            This core contains a full-adder design.
-------------------------------------------------------------------------------
-- Copyright (c) 2021
-------------------------------------------------------------------------------
-- Revisions  :
-- Date        Version  Author  Description
-- 2021-07-02  1.0      jcorrecher	Created
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
-- * libraries
-------------------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

-------------------------------------------------------------------------------
-- * entity
-------------------------------------------------------------------------------

entity full_adder is

  port (
    a    : in  std_logic;
    b    : in  std_logic;
    cin  : in  std_logic;
    s    : out std_logic;
    cout : out std_logic);

end entity full_adder;

-------------------------------------------------------------------------------
-- * architecture body
-------------------------------------------------------------------------------

architecture rtl of full_adder is

begin

-------------------------------------------------------------------------------
-- * result
-------------------------------------------------------------------------------

  res_assign: s <= (a xor b) xor cin;

-------------------------------------------------------------------------------
-- * carry out
-------------------------------------------------------------------------------

  cout_assign: cout <= ((a xor b) and cin) or (a and b);

end architecture rtl;