# Final Exam -- Open Book Section

10 May, 1994

The entire exam is to be turned in at 8:30 PM. Work the closed
book section first and turn it in before you consult your books and
notes to work on the open book section.

## Problem 1. (12 points)

The state table for a sequential circuit with one state
variable, `A`, two inputs *x* and *y*, and one
output *z*, is shown in the five leftmost columns of the
following table. Fill in the two righmost columns of the table with
the appropriate inputs for a JK flip-flop implementing these state
transitions

present inputs next output Flip-flop
state state inputs
A x y A z JA JB
0 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 1 1 1 0
1 0 0 0 1
1 0 1 0 0
1 1 0 0 0
1 1 1 1 0

Now, derive minimal sum-of-product implementation for the two
inputs, *J*`A` and *K*`A`, to the
`A` flip-flop and for the output *z*.

## Problem 2. (3 points)

Convert the hexadecimal number `A8BE42` to binary and
octal.

## Problem 3. (6 points)

Represent the decimal number 16.75 as a floating-point number
with 32 bits. The normalized mantissa has 23 bits, the exponenthas
8 bits, and there is a 1 bit sign. Be sure to show how you got your
answer!

## Problem 4. (9 points)

Show the hardware needed to implement the following RTL
statements for eight-bit registers `R1` and `R2` and
control inputs *p* and *q*.

*p* : `R1` <- `R2`
*p* *q* : `R2` <- `R1`
*p*' *q* : `R2` <- `R2`+1

You may use eight-bit registers, multiplexers, and adders in
your solution.

## Problem 5. (6 points)

Assuming the following values for eight bit registers
`R1` and `R2`

`R1` = 01001100
`R2` = 11100101

What are the values of the following expressions

*ashl* is arithmetic left shift.

## Problem 6. (3 points)

How would you set the control inputs of the bus system shown in
Figure 5-4 on page 130 of the textbook to execute the following RTL
statement?

## Problem 7. (6 points)

Here is a typical ``solution'' turned in last week for
implementing the `ADM` instruction described in problem 7-16
(p. 237):

ORG 24
ADM: NOP I CALL INDRCT
READ U JMP NEXT
ADD U JMP NEXT
ACTDR U JMP NEXT
WRITE U JMP FETCH

Although this micro-code routine sets `M[EA]` to
`M[EA]`+`AC`, it modifies the value of `AC`
when it shouldn't. Fix the routine so that the value of `AC`
is unchanged by the `ADM` instruction.

## Problem 8. (3 points)

Translate the following expression into reverse Polish notation
(RPN):

## Problem 9. (12 points)

Show how to compute the following Pascal statements

IF x = 7 THEN
x := 0
ELSE
x := x + 1 ;
y := 2 * x ;

using the assembly language of the textbook.