0% found this document useful (0 votes)
34 views4 pages

CMP 334 Fall 2020 Midterm

The document contains a 6 part midterm exam testing various concepts in digital logic and computer architecture. It includes questions on: 1) basic concepts like two's complement and Boolean expressions, 2) designing combinational logic circuits, 3) Boolean arithmetic, 4) comparing values using condition flags, 5) designing a combinational circuit from a problem statement, and 6) writing a Toy assembly subprogram to modify array elements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

CMP 334 Fall 2020 Midterm

The document contains a 6 part midterm exam testing various concepts in digital logic and computer architecture. It includes questions on: 1) basic concepts like two's complement and Boolean expressions, 2) designing combinational logic circuits, 3) Boolean arithmetic, 4) comparing values using condition flags, 5) designing a combinational circuit from a problem statement, and 6) writing a Toy assembly subprogram to modify array elements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CMP 334 Fall 2020 midterm 11/18

1. Short answer (10 points)

a. What is the smallest number that can be represented as a signed 5-bit integer?

b. What is the primary difference between combinational and sequential circuits?

c. Give a formula for the two’s complement of an unsigned 7-bit integer N.

d. Convert 0b110110010111101001001111 to hexadecimal.

e. Give an example of De Morgan’s Law.

f. How many distinct values can be represented with 10 bits?

g. What does the acronym ISA stand for?

h. Under what conditions does the n-bit sum s of two n-bit numbers x and y result in
overflow?

i. Define the term Boolean clause.

j. What does a half-adder circuit do?

2. Boolean expressions (20 points)

Consider the Boolean expression: G = (( X * ( Y + Z )) + ~( X * Y * Z + X* Y *Z)


where
A = Y +Z

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 .

b. Complete the following truth table for G .


X Y Z X Y Z A B C D E F 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

3. Boolean arithmetic (20 points)

Consider the numbers X = 0xC9 and Y = 0x5F.

a. Convert X and Y to Binary.

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?

d. Is the unsigned interpretation of S accurate?

e. Is the signed interpretation of S accurate?

f. Compute the two’s complement C of Y. (Show your work.) Convert C to


Hexadecimal.

g. Compute the n-bit difference D of X and Y. (Use two’s complement subtraction.


Show your work including column carries.) Convert D to Hexadecimal.

h. What are the values of the condition flags after this operation?

i. Is the unsigned interpretation of D accurate?

j. Is the signed interpretation of D accurate?

4. Comparison (10 points)


In each of the following, assume that the condition flags of a Toy processor have been
set as indicated by a comparison of values A, in register $5, and B, in $6 with the
assembler instruction: cmp $5, $6. Answer each question with respect to
the provided interpretation (unsigned or signed).

a. [ z n c v ] — if A and B are unsigned, is A > B?


b. [ z n c v ] — if A and B are unsigned, is A < B?
c. [ z n c v ] — if A and B are unsigned, is A <= B?
d. [ z n c v ] — if A and B are unsigned, is A <= B?
e. [ z n c v ] — if A and B are unsigned, is A < B?
5. Combinational circuit design (20 points)

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.

b. Provide a truth table that formalizes the semantics of the circuit.

c. Give a Boolean expression for each output.

d. Draw the combinational circuit to the truth table and to the Boolean expression.

6. Toy subprogram (20 points)

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.]

Deduplicate subprogram interface

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| }

: Duplicate register map


: $1 = 1 (constant)
: $2 = j (loop index)
: $3 = @A[j] (address of jth element of A)
: $4 = A[j] (jth element of A)
: $A = @A (address of the array A)
: $B = |A| (address of the array A)
: $C = p (previous value of A[j-1])
: $E = n (number of replacements made so far)
: $F (return address)

You might also like