Professional Documents
Culture Documents
Dashboard Courses Soen Digital Logic II (Beirut - Section B - 193068) Fall 2021 - 2022 General CENG335-Final-Exam-Fall-2021-2022
Dashboard Courses Soen Digital Logic II (Beirut - Section B - 193068) Fall 2021 - 2022 General CENG335-Final-Exam-Fall-2021-2022
Dashboard / Courses / SoEN / Digital Logic II( Beirut - Section B - 193068) Fall 2021 - 2022 / General / CENG335-Final-Exam-Fall-2021-2022
Question 1
Answer saved
Complete the behavioral VHDL code of a generic tristate buffer with a default size equals to 16.
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
ENTITY trin IS
GENERIC ( N : INTEGER := 16 ) ;
F <= E;
ELSE
F <= X;
END IF;
END PROCESS;
END Behavior ;
https://ems.liu.edu.lb/mod/quiz/attempt.php 1/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 2
Answer saved
Determine the storage element corresponding to each of the following diagrams. D and Q denote the input and the output of the storage element respectively.
Note that no answer should be repeated more than once. Note that the storage element (Gated Latch or Flip Flop) may have an asynchronous clear.
Gated D latch
https://ems.liu.edu.lb/mod/quiz/attempt.php 2/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 3
Consider the universal shift register with an Asynchronous parallel load shown in the following figure:
The register has 8-bit parallel inputs R0 to R7 and a serial input bit SI and 8-bit outputs Q0 to Q7.
When the Asychonous control signal L is 1 the register will load instantaneously the parallel inputs R0 to R7 into the register.
When L is 0 the register act as a synchronous shift register and it will load the serial input SI. The shift direction is controlled by the signal Left_right, where
it will shift to the left if Left_right is 1 and to the right otherwise.
The register has a Synchronous Reset signal that will clear the register at the rising edge of the next clock cycle when Reset is 0.
Complete the following VHDL code that provides the design of this register.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY shift IS
END shift;
BEGIN
PROCESS(Clock, L)
BEGIN
ELSIF ( ) THEN
ELSE
Q <= ;
END IF;
END IF;
END PROCESS;
END Behavior;
https://ems.liu.edu.lb/mod/quiz/attempt.php 3/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
IF L='1' THEN Q <= R; IF Reset = '0' THEN Q <= (OTHERS => '0')
Question 4
Not yet answered
We consider the comparison of the two unsigned numbers A and B each on 4 bits: A=(a3 a2 a1 a0) and B=(b3 b2 b1 b0).
Drag the equations from the list below into the correct spaces in order to complete the following algorithm that describes the execution of the 4-bit
comparison operation.
A > B IF:
a3 > b3 ,
Or
a3 = b3 and a2 > b2
, Or
Or
https://ems.liu.edu.lb/mod/quiz/attempt.php 4/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 5
Given below the table that shows the control signals asserted in each operation/time step.
Determine the expression of the signal "R3out" in terms of X, Y, I0, I1, I2, I3, T0, T1, T2 and T3.
Select one:
a. R3out = [(I1T1 + I2T2 + I3T2 ]Y3 + (I2+ I3)T1X3
Clear my choice
https://ems.liu.edu.lb/mod/quiz/attempt.php 5/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 6
This ALU can perform different operations based on the value of sel vector, as shown below:
sel out_alu
010 inp_a - 1
011 inp_a + 1
Others NULL
To complete the following VHDL of this ALU, match the numbers between brackets with the correct keywords selected from the list below:
library ____[1]_____;
use ___[2]___;
use IEEE.NUMERIC_STD.ALL;
entity ____[3]____ is
begin
process (inp_a, inp_b, ___[7]____)
begin
____[8]___ sel is
when "000" =>
https://ems.liu.edu.lb/mod/quiz/attempt.php 6/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
out_alu<= inp_a - 1; --sub 1
out_alu<= ___[11]___ ;
when "111" =>
end case;
end ___[14]___;
end ___[15]___;
[1] IEEE
[2] IEEE.STD_LOGIC_1164.ALL
[3] alu
[4] (3 downto 0)
[5] sel
[6] out_alu
[7] sel
[8] Choose...
[9] Choose...
[10] Choose...
[11] Choose...
[12] Choose...
[13] Choose...
[14] Process
[15] Behavioral
https://ems.liu.edu.lb/mod/quiz/attempt.php 7/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 7
Incomplete answer
Given below the implementation of 3-input function f using two two-input LUTs. By dragging and dropping the items below, show the truth table implemented
inside each LUT and indicate the input of each LUT.
Hint: Remember that the inputs of a LUT should respect their positions in the Truth Table as shown below:
f = w2' [w1' + w3] + w2 [w1w3'] (result of Shannon expansion with respect to w2)
w1w3'
w2
w2 w3 w1w3' w1
Your answer is not complete; please drag an item to each drop region.
https://ems.liu.edu.lb/mod/quiz/attempt.php 8/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 8
Answer saved
Consider the following circuit in which we would like to perform the below operations in sequence. Note that each operation in the following sequence takes
4. Copy R0 to R1
5. Copy R2 to R0
6. Copy R1 to R2
7. Copy R0 to R3
Fill the below truth table with the corresponding signals values (do not leave cells empty)
Clock Cycle 1 2 3 4 5 6 7 8
R0in 0 1 0 0 1 0 0 0
R1in 1 0 0 1 0 0 0 0
R2in 0 0 1 0 0 1 0 0
R3in 0 0 0 0 0 0 1 0
R0out 0 0 0 1 0 0 1 0
R1out 0 0 1 0 0 1 0 0
R2out 0 0 0 0 1 0 0 0
https://ems.liu.edu.lb/mod/quiz/attempt.php 9/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Clock Cycle 1 2 3 4 5 6 7 8
R3out 0 0 0 0 0 0 0 0
Extern1 1 0 0 0 0 0 0 0
Extern2 0 1 0 0 0 0 0 0
Question 9
Not yet answered
The control unit of the processor, explained in class, contains the following circuit that generates the required control signals in each step of the operations:
"Load", "Move", "Add" and "Sub".
If the processor is executing the operation "Sub" and while being in the second step of "Sub" we have:
Select one:
a. T0 = 1
b. T1 = 1
c. T2 = 1
d. T3 = 1
Clear my choice
https://ems.liu.edu.lb/mod/quiz/attempt.php 10/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 10
Consider the below circuit and timing diagram. Indicate the values of registers R0, R1, R2 and R3 at the end of the simulation knowing that all of these registers
contain the value 0 at the beginning of the simulation. Note that all the read/write operations occur at the rising edge of the clock.
Select one:
R0=8 ; R1=8; R2= 5; R3= 8;
https://ems.liu.edu.lb/mod/quiz/attempt.php 11/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
R0=8 ; R1=5; R2= 8; R3= 5;
Clear my choice
Question 11
Not yet answered
Complete the VHDL code of a rising-edge D flip-flop that has two inputs D and CLK and two outputs Q and Qprime. This flip flop has one additional input
named CLEAR. When CLEAR is equal to 0, the outputs Q and Qprime will be forced to the values 0 and 1 respectively. Otherwise, the flip flop behaves normally.
Note that the CLEAR input is asynchronous.
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
ENTITY dff IS
END dff;
BEGIN
BEGIN
Q <=D ;
END IF;
END PROCESS ;
END Behavior;
PROCESS (CLK, CLEAR) PROCESS (CLK) PROCESS (CLEAR) CLEAR = ‘0’ CLEAR = ‘1’ Q <=’0’ ; Qprime <=’1’;
https://ems.liu.edu.lb/mod/quiz/attempt.php 12/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 12
Consider the VHDL package containing the declaration of the decoders 2-to-4 and 3-to-8 as shown below.
https://ems.liu.edu.lb/mod/quiz/attempt.php 13/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Complete the below structural VHDL code of the decoder 5-to-32 shown below:
LIBRARY ieee ;
USE ieee.std_logic_1164.all;
USE work.decoders_package.all;
En : IN STD_LOGIC ;
END dec5to32 ;
SIGNAL m : STD_LOGIC_VECTOR(0 TO 3) ;
BEGIN
y(8*i TO 8*i+7) );
https://ems.liu.edu.lb/mod/quiz/attempt.php 14/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
END GENERATE ;
En , m );
END structure ;
En m structure
Dec_left: ARCHITECTURE
Question 13
Not yet answered
The figure below shows the time diagram of a Gated D latch. Choose the correct values of Q at the specified time instants (A, B, C, D, E, F and G).
Hint: plot the timing diagram on scratch and then answer the question by selecting the correct answer.
Select one:
a. Q(A) =1, Q(B) = 1, Q(C) = 0, Q(D) = 0, Q(E) = 0, Q(F) = 0, Q(G) = 1
Clear my choice
https://ems.liu.edu.lb/mod/quiz/attempt.php 15/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 14
The 4-bit comparator is shown in the figure below. It compares two unsigned 4-bit numbers A = (a3 a2 a1 a0)2 and B = (b3 b2 b1 b0)2, and generates three
signals AeqB, AgtB and AltB as follows:
AeqB=1 if A=B
AgtB=1 if A > B
AltB=1 if A<B. Note that the circuit should be completed to generate this signal.
By completing the circuit of AltB, determine the total delay of this comparator knowing that all gates have same delay Δ.
Select one:
a.
4Δ
b. 3Δ
c. 2Δ
d. 5Δ
Clear my choice
https://ems.liu.edu.lb/mod/quiz/attempt.php 16/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 15
Consider the following circuit in which registers can swap their values. The component connected to the output of each register is a NOT gate.
Select one:
True
False
https://ems.liu.edu.lb/mod/quiz/attempt.php 17/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 16
Consider the following circuit. Drag and drop the text into the corresponding gaps in the VHDL code that corresponds to the circuit shown in the Figure.
ENTITY mux4to1 IS
f : OUT STD_LOGIC );
END mux4to1 ;
END Behavior ;
https://ems.liu.edu.lb/mod/quiz/attempt.php 18/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 17
https://ems.liu.edu.lb/mod/quiz/attempt.php 19/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 18
Complete the below VHDL code of a N-bit (generic) parallel load up/down counter with Asynchronous reset.
The counter has the following inputs:
1. W has a size of N bits. Default of N is 16
2. direction, clock, Load each has a size of 1 bit
- When Load is zero, the counter will load the value of its input W on its output "OUT"
- Reset is active-High and is responsible of resetting the counter. Resetting will force the output "OUT" to:
zeros if the direction is '1'
ones if the direction is '0'
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
Entity Counter IS
COUNT_OUT<= W ;
ELSIF direction='0'THEN
COUNT_OUT<= COUNT_OUT+1 ;
ELSE
https://ems.liu.edu.lb/mod/quiz/attempt.php 20/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
8 6 32 N
N+1 Counter
UPTO 1 "1"
Question 19
Not yet answered
In a given combinational circuit, the concurrent statements are used with selected assignments using WHEN and ELSE keyword. What is the other alternative to
implement the same?
Select one:
a. WITH-SELECT
b. WITH-SELECT-WHEN
c. IF-ELSE
d. CASE
Clear my choice
https://ems.liu.edu.lb/mod/quiz/attempt.php 21/22
1/19/22, 3:29 PM CENG335-Final-Exam-Fall-2021-2022
Question 20
Select one:
a. 2 to 4 decoder
b. 4 to 2 encoder
c. 4 to 1 MUX
Clear my choice
https://ems.liu.edu.lb/mod/quiz/attempt.php 22/22