Arithmatic
Arithmatic
Arithmatic
-- Company:
-- Engineer:
--
-- Create Date: 14:59:25 11/19/2023
-- Design Name:
-- Module Name: arithmaticcircuit - 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;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity arithmaticcircuit is
PORT(A, B: in std_logic_vector(3 downto 0);
s: in std_logic_vector(1 downto 0);
cin: in std_logic;
F: out std_logic_vector(3 downto 0);
cout: out std_logic
);
end arithmaticcircuit;
component fa
PORT(x, y, c1: in std_logic;
f, cout: out std_logic
);
end component;
signal c2, c3, c4: std_logic;
signal b1, b2, b3, b4: std_logic;
begin
b1<=( B(0) and s(0)) or (not(B(0)) and s(1));
b2<=(B(1) and s(0)) or (not(B(1)) and s(1));
b3<=(B(2) and s(0)) or (not(B(2)) and s(1));
b4<=(B(3) and s(0)) or (not(B(3)) and s(1));
entity full_adder_process is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
sum : out STD_LOGIC;
cout : out STD_LOGIC);
end full_adder_process;
begin
full_process: process (a, b, c)
begin
sum <= a xor b xor c;
cout <= ((a and b) or (a and c) or (b and c));
end process;
end Behavioral;