# Quiz #3

12 April, 1994

This is an open books, open notes exam to be turned in by 8:30 PM. When possible write your answers on the exam. You will need your own paper for some answers.

## Problem 1. (10 points)

Represent the following Pascal statement in register transfer language:

• IF (P AND NOT Q) THEN R5 := R4 ELSE R3 := R3+R4

## Problem 2. (10 points)

If registers R1, R2, and R3 have the following values:

• R1 = 0100110110
• R2 = 1001110111
• R3 = 0000110100

what are their values after each of the following RTL statements are performed

• R1 <- cir R2, R3 <- R2 + R2

cir is circular shift right

• R3 <- R2 XOR R1

XOR is exclusive-OR

• R1 <- R1 AND R2, R2 <- R2 OR R3

## Problem 3. (15 points)

Show the hardware needed to implement the following RTL statements for eight-bit registers R1 and R2:

• x y': R1 <- shl R1
• x : R2 <- R1 + R2

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

## Problem 4. (5 points)

Look at Figure 5-4 on page 130 of the textbook. If

• S2 S1 S0 = 100
• COM of AC is set (see Figure 5-21 on page 166 for more detail)
• LD of PC is set

what happens in the next bus transaction?

## Problem 5. (15 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 each of the following three RTL statements?

• PC <- PC+1, AR <- PC
• IR <- M[AR]
• AC <- AC + DR, TR <- PC

## Problem 6. (10 points)

The following values are instructions stored in the memory of the "basic computer" described in Table 5-2 on page 133 of the textbook:

• 589A
• A100

What is the action of each of the above instructions?

## Problem 7. (15 points)

According to Table 5-6 (page 159) of the text book, what is the sequence of microoperations performed in executing each of the two instructions shown in the previous problem.

## Problem 8. (20 points)

Suppose you wanted to add to the textbook's basic computer a special Load Byte Immediate operation. In the format of Table 5-2 (page 133), this instruction is:

```     LBI  7Fxx        Load AC with xx
```

for example, the instruction

LBI 40

would load the accumulator with the hexadecimal value 40 or decimal value 64.

Describe how you would have to modify the RTL shown in Table 5-6 (page 159) to add this new instruction?

Is it really worth the trouble, that is, do you think the cost in extra hardware for this instruction will be worth the improvement in program execution time?