Question

In: Electrical Engineering

Question 1: A Multiplexer (MUX) a) Write truth table and draw symbol for a 4-to-1 MUX....

Question 1: A Multiplexer (MUX)

a) Write truth table and draw symbol for a 4-to-1 MUX. (1 mark)

b) Write VHDL code for the above multiplexer. (1 mark)

c) Write VHDL code for a test bench and simulate the design. (1 mark)

d) Implement the design on FPGA, with inputs connected to switches and output to LED. (1 mark)

Solutions

Expert Solution

Truth Table:

Input Pin = A B C D

Output Pin = O

Select Pin = S0 S1

S0 S1 O

0 0 A

0 1 B

1 0 C

1 1 D

VHDL CODE:

library IEEE;

use IEEE.STD_LOGIC_1164.all;

entity mux_4to1 is

port(

     A,B,C,D : in STD_LOGIC;

     S0,S1: in STD_LOGIC;

     O: out STD_LOGIC

  );

end mux_4to1;

architecture bhv of mux_4to1 is

begin

process (A,B,C,D,S0,S1) is

begin

  if (S0 ='0' and S1 = '0') then

      O <= A;

  elsif (S0 ='0' and S1 = '1') then

      O <= B;

  elsif (S0 ='1' and S1 = '0') then

      O <= C;

  else

      O <= D;

  end if;

end process;

end bhv;

VHDL Testbench:

LIBRARY ieee;

USE ieee.std_logic_1164.ALL;

ENTITY tb_mux IS

END tb_mux;

ARCHITECTURE behavior OF tb_mux IS

    -- Component Declaration for the Unit Under Test (UUT)

    COMPONENT mux_4to1

    PORT(

         A : IN std_logic;

         B : IN std_logic;

         C : IN std_logic;

         D : IN std_logic;

         S0 : IN std_logic;

         S1 : IN std_logic;

         O : OUT std_logic

        );

    END COMPONENT;

   --Inputs

   signal A : std_logic := '0';

   signal B : std_logic := '0';

   signal C : std_logic := '0';

   signal D : std_logic := '0';

   signal S0 : std_logic := '0';

   signal S1 : std_logic := '0';

    --Outputs

   signal O : std_logic;

BEGIN

    -- Instantiate the Unit Under Test (UUT)

   uut: mux_4to1 PORT MAP (

          A => A,

          B => B,

          C => C,

          D => D,

          S0 => S0,

          S1 => S1,

          O => O

        );

   -- Stimulus process

   stim_proc: process

   begin

      -- hold reset state for 100 ns.

      wait for 100 ns;

    A <= '1';

    B <= '0';

    C <= '1';

    D <= '0';       

    S0 <= '0'; S1 <= '0';

      wait for 100 ns;

    S0 <= '1'; S1 <= '0';

      wait for 100 ns;

    S0 <= '0'; S1 <= '1';

        wait for 100 ns;   

    S0 <= '0'; S1 <= '1';  

        wait for 100 ns;   

    end process;

END;

The above code is trivial and I have taken it from allaboutfpga.

The code is self-explanatory and is in confirmation with the truth table I have drawn in the beginning.

PLEASE LEAVE A THUMBS UP


Related Solutions

1. write a truth table using this symbol: --> 2. write the inputs for the truth...
1. write a truth table using this symbol: --> 2. write the inputs for the truth table to the left of the --> and write the outputs for the truth table to the right of the --> 3. write the compliment, or NOT using ' As an example: The truth table for AND is written this way: A B --> A AND B 0 0 --> 0 0 1 --> 0 1 0 --> 0 1 1 --> 1 or...
1.Write verilog code for a 8:1 Mux using the blocks of 2:1 Mux; Draw the block...
1.Write verilog code for a 8:1 Mux using the blocks of 2:1 Mux; Draw the block diagram for this design and write the truth table to prove that the design works as intended. 2. Write verilog code for a 16:1 Mux using the blocks of 4:1 Mux; Draw the block diagram for this design and write the truth table to prove that the design works as intended.
1) Implement the given logic function using a 4:1 MUX. F(A,B,C) = Σm(0,1,3,7) Show the truth...
1) Implement the given logic function using a 4:1 MUX. F(A,B,C) = Σm(0,1,3,7) Show the truth table, the 4:1 MUX schematic with the inputs, select inputs and the output. 2) 2) For an 8:3 priority encoder: a) Draw the schematic. b) Write the truth table. c) Write the Boolean expressions for each of the outputs in terms of the inputs. d) Draw the logic circuit for the outputs in terms of the inputs.
design full adder using 4:1 mux
design full adder using 4:1 mux
First derive the truth table for the requested modulus sequence, draw the circuit, then implement it...
First derive the truth table for the requested modulus sequence, draw the circuit, then implement it using only the built-in AND, OR, and NOT gates. Exercise 18 [3.0] LOCK Consider a boolean function with inputs: d, e, f, g. The value of the inputs can be defined as V = 8*d + 4*e + 2*f + 1*g. The output of this function is true if V mod 3 is 1.
Question 1.​ Answer the following questions by making a truth table. Be sure to explain what...
Question 1.​ Answer the following questions by making a truth table. Be sure to explain what feature of the truth table you’ve drawn justifies your answer. (That is, indicate which part, or parts, of the table show what the answer to the question is and why) a) Is ¬P, P ↔ Q, P → Q a logically consistent set of sentences? b) Is A ∧ (B ∨ C), ¬((A ∨ B) ∧ C) a logically consistent set of sentences? c)...
Write down the truth table fora 4-to-2 priority encoderhaving input W[3:0]and with priority levels in the...
Write down the truth table fora 4-to-2 priority encoderhaving input W[3:0]and with priority levels in the decreasing order (i.e., W[0]-Highest, ....., W[3]-Least). Write down the Verilog code for implementing   the same. plz asap fast
Write a truth table for the proposition: ¬(q ∧ r) → (¬p ∨ ¬r). Consider a “1” to be true and a “0” to be false.
Write a truth table for the proposition: ¬(q ∧ r) → (¬p ∨ ¬r). Consider a “1” to be true and a “0” to be false.
Write a truth table for Moore finite state machine modeling a traffic light.
Write a truth table for Moore finite state machine modeling a traffic light.
Write a C++ program to construct the truth table of P ∨¬(Q ∧ R) If you...
Write a C++ program to construct the truth table of P ∨¬(Q ∧ R) If you could include comments to explain the code that would be much appreciated!!! :) Thank you so much!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT