Fulladder1 Définition
fulladder2 Table de vérité
Fulladder3 Schéma électrique1
Fulladder4 Schéma électrique2
-- additionneur de 2 mots de 1 bit avec retenues
-- Full Adder 2x1 Flot de données --> équations
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY add2x1_equations IS
PORT(
A1,B1,Cin : IN STD_LOGIC;
S1,Cout : OUT STD_LOGIC);
END add2x1_equations;
ARCHITECTURE arch_add2x1_equations OF add2x1_equations IS
BEGIN
S1 <= A1 xor B1 xor Cin;
Cout <= (A1 and B1) or (Cin and (A1 or B1));
END arch_add2x1_equations;
Création d’une librairie (work par défaut), d’un Package, Notion de component, port map, …
library ieee;
Use ieee.std_logic_1164.all;
library work;
Use work.ADD2x1_biblio.all;
entity ADDER2x1Full_structurel is
port ( A1, B1, Cin : in std_logic;
S1, COUT : out std_logic);
end ADDER2x1Full_structurel;
architecture arch_ADDER2x1Full_structurel of ADDER2x1Full_structurel is
signal Sint,S3,S4,S5 : std_logic;
begin
U1: OUEX --U1 est une instance de OUEX
port map (A=>A1, B=>B1, S=>Sint);
U2: OUEX --U2 est une instance de OUEX
port map (A=>Sint, B=>Cin, S=>S1);
U3: OU --U3 est une instance de OU
port map (A=>A1, B=>B1, S=>S3);
U4: ET --U4 est une instance de ET
port map (A=>A1, B=>B1, S=>S4);
U5: ET --U4 est une instance de ET
port map (A=>S3, B=>Cin, S=>S5);
U6: OU --U6 est une instance de OU
port map (A=>S4, B=>S5, S=>Cout);
end arch_ADDER2x1Full_structurel;
library ieee;
Use ieee.std_logic_1164.all;
Package ADD2x1_biblio is
component OUEX
port ( A,B : in std_logic;
S : out std_logic);
end component;
component OU
port ( A,B : in std_logic;
S : out std_logic);
end component;
component ET
port ( A,B : in std_logic;
S : out std_logic);
end component;
end ADD2x1_biblio;
library ieee;
Use ieee.std_logic_1164.all;
--Opérateurs logiques de base
entity OUEX is
port ( A,B :in std_logic;
S : out std_logic);
end OUEX;
architecture DESCRIPTION of OUEX is
begin
--Y1 <= A and B;
--Y2 <= A or B;
S <= A xor B;
--Y4 <= not A;
--Y5 <= A nand B;
--Y6 <= A nor B;
--Y7 <= not(A xor B);
end DESCRIPTION;
library ieee;
Use ieee.std_logic_1164.all;
--Opérateurs logiques de base
entity OU is
port ( A,B :in std_logic;
S : out std_logic);
end OU;
architecture DESCRIPTION of OU is
begin
--Y1 <= A and B;
S <= A or B;
--Y3 <= A xor B;
--Y4 <= not A;
--Y5 <= A nand B;
--Y6 <= A nor B;
--Y7 <= not(A xor B);
end DESCRIPTION;
library ieee;
Use ieee.std_logic_1164.all;
--Opérateurs logiques de base
entity ET is
port ( A,B :in std_logic;
S : out std_logic);
end ET;
architecture DESCRIPTION of ET is
begin
S <= A and B;
--Y2 <= A or B;
--Y3 <= A xor B;
--Y4 <= not A;
--Y5 <= A nand B;
--Y6 <= A nor B;
--Y7 <= not(A xor B);
end DESCRIPTION;
-- additionneur de 2 mots de 1 bit avec retenues
-- Full Adder 2x1 Comportemental --> table de vérité
Library ieee;
use ieee.std_logic_1164.all;
--use ieee.std_logic_unsigned.all;
--use ieee.numeric_std.all;
entity add2x1_comportemental is
port ( A, B ,Ri : in bit;
S, Ro : out std_logic
);
end add2x1_comportemental;
architecture arch_add2x1_comportemental of add2x1_comportemental is
begin
with Ri&B&A select
Ro <= '0' when "000",
'0' when "001",
'0' when "010",
'1' when "011",
'0' when "100",
'1' when "101",
'1' when "110",
'1' when "111",
'0' when others;
with Ri&B&A select
S <= '0' when "000",
'1' when "001",
'1' when "010",
'0' when "011",
'1' when "100",
'0' when "101",
'0' when "110",
'1' when "111",
'0' when others;
end arch_add2x1_comportemental;
Fulladder5 Simulation du Full adder
Fulladder6 RTL Viewer
Deux multiplexeurs avec 3 entrées de sélection SEL[2..0] correspondant à Ri B A et 2 bus série en entrée h96 (soit b10010110) pour S et hE8 (soit b11101000) pour Ro.