Mid Term
Mid Term
7. (6 marks) Consider the following multiplexer where the four data lines (10, 11,
12, 13) are selected by two select lines (A1A0). Note: 10, 11, 12, 13, A1, and A0
are the names of pins in the circuit. Specifically, the combinations A1A0 =
00,01,10,11 will select the data line 10, 11, 12, 13, respectively. x,y,z are the
inputs of this circuit and f is the output. EN is the Enable input such that when
EN = 0, f= 0 regardless of the inputs. (a) (1 marks) What’s the value of f when z =
1 ? (b) (2 marks) What’s the value of f when x = 1, y = 1, z = 0 ? (c) (3 marks)
f(x,y,z) =_____
8. (4 marks) Assume x and y are negative integers stored in 2’s complement form in
registers $s1 and $s2, respectively. Complete the following MIPS assembly
instructions that will store x +y in a register $s3 and if there is an overflow,
branch to a symbolic address overflow. add _, $s1, $s2 slt $t0, _, _ bne $t0, _,
overflow
9. Analyze the sequential circuit consisting of two D Flip-Flops shown in the
following figure. Use A and B to denote the current state.Use AN and BN to
denote the next state. Complete the following steps: • (6 marks) Observe the
circuit, derive DA, DB and Z as the functions of current state and external input.
• (4 marks) Derive the next state AN , BN as the functions of current state and
external input. • (5 marks) We use the following encoding of the states: AB = 00,
01, 10, 11 represents state S0, S1, S2, S3 respectively. Derive the state table
shown below.
10. Use a sequential circuit to implement an up-down counter. This counter will
count through 0, 1, 2, 3 and an external input X will control the counting
direction. Specifically, when X = 0, the counter will count up: 0,1,2,3,0,1,2,3, etc;
when X = 1, the counter will count down: 0,3,2,1,0,3,2,1, etc. Complete the
following design steps: (a) (5 marks) Draw a state diagram of this counter. Using
’0’, ’1’, ’2’, ’3’ to denote the state. (b) (4 marks) We use two bits Q1Q0 to encode
the states as follows: Q1Q0 = 00, 01, 10, 11 represent 0, 1, 2, 3, respectively.
Derive the state table. (c) (5 marks) Suppose we use two J-K flip-flops (JKFF0 and
JKFF1) to implement this counter. Q0 and Q1 are the outputs of JKFF0 and JKFF1,
respectively. (J0, K0) and (J1, K1) are the inputs of JKFF0 and JKFF1, respectively.
Derive the excitation table for the circuit. (d) (6 marks) Derive J0, K0, J1, and K1
as functions of Q1,Q0,X, respectively.