blob: 1d255c939732d7b17e7468e41e5b4ac7b585949d (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 04/30/2025 03:19:19 PM
-- Design Name:
-- Module Name: Add1BitB - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Add1BitB is
Port ( X : in STD_LOGIC;
Y : in STD_LOGIC;
Ci : in STD_LOGIC;
O : out STD_LOGIC;
Co : out STD_LOGIC);
end Add1BitB;
architecture Behavioral of Add1BitB is
begin
Adder: process(X, Y, Ci) is
variable buf: STD_LOGIC_VECTOR(2 downto 0);
begin
buf(0) := X;
buf(1) := Y;
buf(2) := Ci;
case (buf) is
when "000" =>
O <= '0';
Co <= '0';
when "001" =>
O <= '1';
Co <= '0';
when "010" =>
O <= '1';
Co <= '0';
when "011" =>
O <= '0';
Co <= '1';
when "100" =>
O <= '1';
Co <= '0';
when "101" =>
O <= '0';
Co <= '1';
when "110" =>
O <= '0';
Co <= '1';
when "111" =>
O <= '1';
Co <= '1';
when others =>
O <= '0';
Co <= '0';
end case;
end process Adder;
end Behavioral;
|