This is the third quiz from the course Computer Science 100: Principles of Computer Science, taught by David Eck. The answers that are included here are sample answers only. There might be many other answers to a given problem that would also receive full credit. See the home page for the text, The Most Complex Machine, for more information about the course.
Question 1: Define the term register.
Answer: A register is a memory circuit that is in the CPU (rather than in main memory). A register holds one binary number, containing some fixed number of bits.
Question 2: What is meant by a feedback loop in a logic circuit? Give an example.
Answer: A feedback loop occurs in a circuit when the output from some gate is used -- either directly or through one or more intermediate gates -- as input to the same gate. For example, if the output from a NOT gate is connected directly to the input to that gate, the result is a circuit that repeatedly turns itself on and off; such a circuit can be used a kind of "clock." Feedback loops are used mainly in memory circuits. See the illustrations in xLogicCircuits Lab 2 for examples.
Question 3: Explain what is meant by the fetch-and-execute cycle, and give some examples of the kind of small individual steps that can occur as part of a single fetch-and-execute cycle.
Answer: The fetch-and-execute cycle is the process by which the CPU executes machine language programs that are stored in main memory. The CPU reads, or "fetches," one instruction from memory and then carries out, or "executes," that instruction. It then repeats the process for the next instruction from memory, and it repeats the process over and over until it is halted in some way.
A single fetch-and-execute cycle is itself made up of a number of smaller, simpler steps. Each step of the fetch-and-execute cycle is a simple operation that can be accomplished by turning control wires on and off. Typical operations that can be performed in a single step include: Load the address register from the program counter; Add one to the program counter; and Set the COUNT register to zero.
Question 4: Suppose that a main memory has 65536 locations. How many address wires will that memory need? Explain carefully why your answer is true. (Note: 65536 is 216.)
Answer: The main memory circuit would need 16 address wires. The address wires are used to pick out one particular memory location. Every possible combination of values for the address wires can specify a different memory location. Since there are two possible values (ON and OFF) for each wire, then with 16 wires, there will be a total of 216 combinations. (The memory locations will be numbered from 0000000000000000 to 1111111111111111 in binary.)
Question 5: Suppose that I want to store the number 17 in memory location 42 in a main memory circuit. How would I do this? What wires would I use, and what would I do with them.
Answer: There are four sets of wires connected to the main memory: the address wires, the data-in wires, the data-out wires, and the load-data wire. To store the number 17 in location 42, it is necessary to:
Once the load-data wire has been turned on and off, the data from the data-in wires has been safely stored in the location specified by the address wires.