Professional Documents
Culture Documents
Quiz 2
Name: …………………………………………………………………………………………………
Application ID: …………………………………………………………………….………………
Group: …………………………………………………………………………………………………
Grading scheme
Exercise 1 20 pts
Exercise 2 30 pts
Total 50 pts
Instructions:
This is a closed book examination.
Calculators are not allowed.
Duration: 30 min. Kindly stop writing when told so.
This booklet comprises XX pages including the cover page.
Good luck
Exercise 1- (20 pts)
A) Write the truth table of a 2-1 multiplexer (w0, w1 inputs and select line S, output f) and derive
its minimized SoP using a k-map or any other way you deem appropriate.
B) Complete the code in VHDL to implement this mux using the SoP found in part A.
Hints:
Use W0 and W1 as inputs, S as select line, F as output.
Call it mux2to1
Also create a package for it call it mux2to1_Package
ENTITY mux2to1 IS
PORT ( W0, W1, S: IN STD_LOGIC;
F: OUT STD_LOGIC);
END mux2to1;
END behav;
PACKAGE mux2to1_package IS
END mux2to1_package;
2
Solution:
A)
s W0 W1 f
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
B) 10 pts
ENTITY mux2to1 IS
PORT ( W0, W1, S: IN STD_LOGIC;
F: OUT STD_LOGIC);
END mux2to1;
PACKAGE mux2to1_package IS
COMPONENT mux2to1
PORT(W0,W1,S: IN STD_LOGIC;
F: OUT STD_LOGIC);
END COMPONENT
END mux2to1_package
3
Exercise 2 (30 pts)
You are going to build a 2-bit register shown below using two 1-bit D-Flip flops
and two 2-1 multiplexers.
4
Solution:
Entity Reg2 is
Port (D1,D0,load,clk: IN std_logic;
Q1,Q0: OUT std_logic);
End reg2;
Solution:
Q1 <= i1;
Q0 <= i0;
END reg2_arch