Professional Documents
Culture Documents
TD3 Solutions
TD3 Solutions
Exercice 1:
Sel O
0 I0
1 I1
entity Mux_2_1 is
Port ( I0 : in STD_LOGIC ;
I1 : in STD_LOGIC ;
Sel : in STD_LOGIC ;
O : out STD_LOGIC );
end Mux_2_1 ;
begin
O <=(( not Sel ) and I0 ) or ( Sel and I1 );
end Behavioral ;
entity Mux_2_1 is
Port ( I0 : in STD_LOGIC ;
I1 : in STD_LOGIC ;
Sel : in STD_LOGIC ;
O : out STD_LOGIC );
end Mux_2_1 ;
1 F.CHABNI
Centre Universitaire de Tipaza Abdallah Morsli
Institut des sciences
Département D’Electronique
1ère année Master, Option: Instrumentation
Module: Électronique numérique avancée : VHDL – FPGA
architecture Behavioral of Mux_2_1 is
begin
O <= I0 when Sel = ’0 ’ else I1 ;
end Behavioral ;
entity Mux_2_1_select is
Port ( I0 : in STD_LOGIC ;
I1 : in STD_LOGIC ;
Sel : in STD_LOGIC ;
O : out STD_LOGIC );
end Mux_2_1_select ;
2 F.CHABNI
Centre Universitaire de Tipaza Abdallah Morsli
Institut des sciences
Département D’Electronique
1ère année Master, Option: Instrumentation
Module: Électronique numérique avancée : VHDL – FPGA
Exercice 2:
Sel(1) Sel(0) O
0 0 I0
0 1 I1
1 0 I2
1 1 I3
entity Mux_4_1 is
Port ( I0 : in STD_LOGIC ;
I1 : in STD_LOGIC ;
I2 : in STD_LOGIC ;
I3 : in STD_LOGIC ;
Sel : in STD_LOGIC_VECTOR (1 downto 0);
O : out STD_LOGIC );
end Mux_4_1 ;
library IEEE ;
use IEEE . STD_LOGIC_1164 . ALL ;
entity Mux_4_1 is
Port ( I0 : in STD_LOGIC ;
I1 : in STD_LOGIC ;
I2 : in STD_LOGIC ;
I3 : in STD_LOGIC ;
Sel : in STD_LOGIC_VECTOR (1 downto 0);
O : out STD_LOGIC );
end Mux_4_1 ;
3 F.CHABNI
Centre Universitaire de Tipaza Abdallah Morsli
Institut des sciences
Département D’Electronique
1ère année Master, Option: Instrumentation
Module: Électronique numérique avancée : VHDL – FPGA
architecture Behavioral of Mux_4_1 is
begin
library IEEE ;
use IEEE . STD_LOGIC_1164 . ALL ;
entity Mux_4_1 is
Port ( I0 : in STD_LOGIC ;
I1 : in STD_LOGIC ;
I2 : in STD_LOGIC ;
I3 : in STD_LOGIC ;
Sel : in STD_LOGIC_VECTOR (1 downto 0);
O : out STD_LOGIC );
end Mux_4_1 ;
begin
end Behavioral ;
4 F.CHABNI
Centre Universitaire de Tipaza Abdallah Morsli
Institut des sciences
Département D’Electronique
1ère année Master, Option: Instrumentation
Module: Électronique numérique avancée : VHDL – FPGA
Exercice 3:
library IEEE ;
use IEEE . STD_LOGIC_1164 . ALL ;
entity Mux_4_1 is
Port ( I0 : in STD_LOGIC_VECTOR (3 downto 0);
I1 : in STD_LOGIC_VECTOR (3 downto 0);
I2 : in STD_LOGIC_VECTOR (3 downto 0);
I3 : in STD_LOGIC_VECTOR (3 downto 0);
Sel : in STD_LOGIC_VECTOR (1 downto 0);
O : out STD_LOGIC_VECTOR (3 downto 0));
end Mux_4_1 ;
O0 (0) <= not Sel (0) and not Sel (1) and I0 (0);
O1 (0) <= Sel (0) and not Sel (1) and I1 (0);
O2 (0) <= not Sel (0) and Sel (1) and I2 (0);
O3 (0) <= Sel (0) and Sel (1) and I3 (0);
O (0) <= O0 (0) or O1 (0) or O2 (0) or O3 (0);
O0 (1) <= not Sel (0) and not Sel (1) and I0 (1);
O1 (1) <= Sel (0) and not Sel (1) and I1 (1);
O2 (1) <= not Sel (0) and Sel (1) and I2 (1);
O3 (1) <= Sel (0) and Sel (1) and I3 (1);
O (1) <= O0 (1) or O1 (1) or O2 (1) or O3 (1);
O0 (2) <= not Sel (0) and not Sel (1) and I0 (2);
O1 (2) <= Sel (0) and not Sel (1) and I1 (2);
O2 (2) <= not Sel (0) and Sel (1) and I2 (2);
O3 (2) <= Sel (0) and Sel (1) and I3 (2);
O (2) <= O0 (2) or O1 (2) or O2 (2) or O3 (2);
O0 (3) <= not Sel (0) and not Sel (1) and I0 (3);
O1 (3) <= Sel (0) and not Sel (1) and I1 (3);
5 F.CHABNI
Centre Universitaire de Tipaza Abdallah Morsli
Institut des sciences
Département D’Electronique
1ère année Master, Option: Instrumentation
Module: Électronique numérique avancée : VHDL – FPGA
O2 (3) <= not Sel (0) and Sel (1) and I2 (3);
O3 (3) <= Sel (0) and Sel (1) and I3 (3);
O (3) <= O0 (3) or O1 (3) or O2 (3) or O3 (3);
end Behavioral ;
library IEEE ;
use IEEE . STD_LOGIC_1164 . ALL ;
entity Mux_4_1 is
Port ( I0 : in STD_LOGIC_VECTOR (3 downto 0);
I1 : in STD_LOGIC_VECTOR (3 downto 0);
I2 : in STD_LOGIC_VECTOR (3 downto 0);
I3 : in STD_LOGIC_VECTOR (3 downto 0);
Sel : in STD_LOGIC_VECTOR (1 downto 0);
O : out STD_LOGIC_VECTOR (3 downto 0));
end Mux_4_1 ;
library IEEE ;
use IEEE . STD_LOGIC_1164 . ALL ;
library IEEE ;
use IEEE . STD_LOGIC_1164 . ALL ;
entity Mux_4_1 is
Port ( I0 : in STD_LOGIC_VECTOR (3 downto 0);
I1 : in STD_LOGIC_VECTOR (3 downto 0);
I2 : in STD_LOGIC_VECTOR (3 downto 0);
I3 : in STD_LOGIC_VECTOR (3 downto 0);
Sel : in STD_LOGIC_VECTOR (1 downto 0);
O : out STD_LOGIC_VECTOR (3 downto 0));
end Mux_4_1 ;
6 F.CHABNI
Centre Universitaire de Tipaza Abdallah Morsli
Institut des sciences
Département D’Electronique
1ère année Master, Option: Instrumentation
Module: Électronique numérique avancée : VHDL – FPGA
begin
end Behavioral ;
7 F.CHABNI