# Assignment 1 Solutions

1. What is your E-mail address?

No solution given

### Survey Questions

2. What programming languages have you used to write even small programs?
 C 19 C++ 15 Java 15 Assembly 12 Basic 9 Pascal 6 Fortran 6 VHDL 6 -- but is this a programming language? Perl 6 Visual Basic 5 Prolog 4 PHP 4 -- is this a programming language? Ada 3 Matlab 2 -- we could argue about this too!

3. What programming languages have you used to write programs that you considered large?
 C 14 Java 11 C++ 9 Assembly 4 VHDL 4 Ada 3 Perl 3 Pascal 2

4. What machine architectures have you studied -- at the level of the machine's assembly language or instruction set?
 Motorola 68000 Series 10 MIPS 5 Intel 5 VAX 1 PDP-11 1

Here, I am concerned that so few claim any exposure to more than one architecture!

5. What processor implementations have you studied -- at levels below the instruction set (for example, at the level of gates and flipflops, the level of microcode, or the level of register-transfer logic)?
 Motorola 68000 Series 7 MIPS 2

Here, I am concerned that this covers fewer students than are enrolled in the class. It would be nice if the students in this class all had some exposure to implementation issues.

### Questions covering Prerequisites for the Course

6. A, B and C are three one-bit binary numbers. S is the two-bit binary sum, where S1 is the most significant bit and S0 is the least significant bit. Give the truth table for an adder that computes S = A + B + C.
A B C S1 S0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1

7. The tripflop is a logic device with 3 outputs, Qa, Qb, and Qc and 3 inputs, Ta Tb, and Tc. There are three 3-input nand gates in a tripflop, one per output:
• Output Qa is computed from inputs Ta, Qb, and Qc.
• Output Qb is computed from inputs Tb, Qa, and Qc.
• Output Qc is computed from inputs Tc, Qa, and Qb.

There was an error in the definition of Qc given in the assignment! It is corrected above; in summary, this device was supposed to be symmetrical, with each output depending on the two other outputs plus one of the inputs. The answers below are for the corrected circuit.

a) With all inputs high, what are the stable states of a tripflop?

stable states
QaQbQc
011
101
110

b) What do you do to the inputs of a tripflop to flip it into one of its stable states?

Make one of the inputs high and the others low. The output will then be the negation of the input. If all of the outputs are then made high, the output will remain in that state until some other input is pulled low.

8. To what does the term fetch-execute cycle refer? Give a short answer.

Durring the fetch part of the instruction cycle, the opcode (and possibly other fields) of the next instruction is loaded into the IR and the address portion may be loaded into the MAR. Durring the execute part of the instruction cycle, control circuitry interprets the opcode and executes the instruction.

9. The steriotypical function call and return instructions save and restore the program counter on the stack. What additional work is done by the steriotypical interrupt and return from interrupt mechanism?

The state of the CPU must be saved. This might involve saving such things as condition codes, the interrupt enable bit or bits, processor privilege level, and other information.

10. The fictional TurboFlam computer has a 13-bit word. The parallel port option on this machine has 13 input pins and 13 output pins (separate from each other), along with strobe and acnkowledge pins for each transfer direction. Explain the likely contents of the 3 input-output device interface registers in the TurboFlam parallel port interface.

One register will hold the data sent to the output pins so that they remain constant between output operations. One register will hold data presented to the input pins, although this may be a pseudo-register that looks, to software like a register, but involves no flipflops. Finally, there will be a control and status register that allows the output strobe and input acknowledge bits to be set and allows the input strobe and output acknowledge bits to be set.