Presentation is loading. Please wait.

Presentation is loading. Please wait.

2-to-1 Multiplexer: if Statement Discussion D2.1 Example 4.

Similar presentations


Presentation on theme: "2-to-1 Multiplexer: if Statement Discussion D2.1 Example 4."— Presentation transcript:

1 2-to-1 Multiplexer: if Statement Discussion D2.1 Example 4

2 2-to-1 Multiplexer Multiplexers The VHDL if statement

3 Multiplexers A multiplexer is a digital switch: If s = 0, y = a; if s = 1, y = b

4 Multiplexers A multiplexer is a digital switch: If s = 0, y = a; if s = 1, y = b

5 - Example 4a: 2-to-1 MUX using logic equations library IEEE; use IEEE.STD_LOGIC_1164.all; entity mux21a is port( a : in STD_LOGIC; b : in STD_LOGIC; s : in STD_LOGIC; y : out STD_LOGIC ); end mux21a; architecture mux21a of mux21a is begin y <= (not s and a) or (s and b); end mux21a;

6 Aldec Active-HDL Simulation

7 2-to-1 Multiplexer Multiplexers The VHDL if statement

8 Multiplexers A multiplexer is a digital switch: If s = 0, y = a; if s = 1, y = b if s = '0' then y <= a; else y <= b; end if; VHDL

9 - Example 4b: 2-to-1 MUX using if statement library IEEE; use IEEE.STD_LOGIC_1164.all; entity mux21b is port( a : in STD_LOGIC; b : in STD_LOGIC; s : in STD_LOGIC; y : out STD_LOGIC ); end mux21b; architecture mux21b of mux21b is begin mux2b_1: process(a, b, s) begin if s = '0' then y <= a; else y <= b; end if; end process mux2b_1; end mux21b;


Download ppt "2-to-1 Multiplexer: if Statement Discussion D2.1 Example 4."

Similar presentations


Ads by Google