CMP 334 Fall 2020 Midterm
CMP 334 Fall 2020 Midterm
a. What is the smallest number that can be represented as a signed 5-bit integer?
h. Under what conditions does the n-bit sum s of two n-bit numbers x and y result in
overflow?
B = X *A
C = X *Y * Z
D = X * Y *Z
E = C+D
F = ~E
G = B *F
a. Draw the circuit corresponding to G .
0 0 0 1 1 1
0 0 1 1 1 0
0 1 0 1 0 1
0 1 1 1 0 0
1 0 0 0 1 1
1 0 1 0 1 0
1 1 0 0 0 1
1 1 1 0 0 0
b. Compute the 8-bit sum S of X and Y. (Show your work including column carries.)
Convert S to Hexadecimal.
c. What are the values of the condition flags after this operation?
h. What are the values of the condition flags after this operation?
Use the combinational circuit design process to develop a circuit that identifies signed
3-bit numbers that satisfy the following equation:
F(X): X3 + 2X2 – 5X – 6 = 0
a. Draw a “Blackbox” diagram that: identifies 1-bit input(s) to, and output(s) from,
the circuit; defines the relationship between the variable(s) in the problem
statement and the input(s); and specifies the circumstances under which the
output(s) will be 1.
d. Draw the combinational circuit to the truth table and to the Boolean expression.
Below are the subprogram interface and a register map for a Toy assembly language
subprogram to replace entries in an array that duplicate the prior entry by 0. Write a
subprogram implementing the interface and conforming to the register map. [If you are
unable to construct the subprogram in its entirety, supply any pieces of the subprogram
that you can, identifying the function of each.]
On entry:
A = A0
$A = @A, @|A| = @A – 1, and @A[j] = @A + j
$F (return address)
Subprogram invariant: $6, $7, $8, $9, $A, MEMORY - A
On exit:
A = A0 except that A[j] = 0 if A0[j] = A0[j-1]
$E = # { j : A[j] != A0[j] for 0 < j < |A| }