CS 231 - Micro Electronics

Chapter 4: Processor Technology and Architecture


This lesson discusses several processes that take place in the Central Processing Unit. Objectives important to this lesson:

  1. CPU instruction and execution cycles
  2. How primitive instructions are combined to make complex instructions
  3. Key CPU design features
  4. General purpose and special purpose registers
  5. Enhancing processor performance
  6. Principles of semiconductor based microprocessors

This chapter discusses many things that happen in the Central Processing Unit of a computer. First, we are reminded that a CPU will contain at least three components: the Arithmetic Logic Unit (which does the computation and comparisons), the Control Unit (which moves data and instructions to and from secondary storage, RAM, and registers), and registers (volatile memory in the CPU itself).

We are told that the CPU performs various actions that belong to one of two cycles: fetch and execution. The fetch cycle is also called the instruction cycle because its primary task is to load instructions. Consider the four tasks performed by the Control Unit in a fetch cycle:

  • fetch instructions from primary storage/RAM; programs are always copied to RAM before they can be processed by the Control Unit
  • increment a pointer that holds the RAM address of the next instruction
  • separate the instruction into its parts: instruction code and inputs
  • store each instruction component in registers

Page 107 also lists the tasks performed by the ALU in an execution cycle:

  • retrieve an instruction from a register
  • retrieve data needed by the instruction from registers
  • perform computation and comparison operations
  • store results in registers

The bullet points above are summarized in the diagram on page 108. As the text notes, the CPU alternates between fetch and execution cycles while any program is running.

As the text stated in chapter 2, an instruction is a command to the computer to do something. Chapter 4 explains that an instruction may contain more than the actual command. The part of the instruction that is the command is called the Op Code. The instruction may also contain values that are to be processed by the command. These portions of the instruction are called the Operands. That's the math word for the quantity that you do an operation on.

The kinds of instructions that can be processed by a CPU are determined by the type of CPU. The collection of instructions that any particular CPU can process is called its Instruction Set. As the text explains in a few pages, processors can be classed as using Complex Instruction Set Computing (CISC) or Reduced Instruction Set Computing (RISC). Before discussing this point, the text explains some basic instructions that would be found in either kind of set.

  • Data Movement Instructions
    • move - copies data bits between registers and primary storage; the text notes that this is a copy command, so the original bits remain in their original locations
    • load - an actual movement of bits from primary storage to a register
    • store - an actual movement of bits from a register to primary storage
  • Boolean Logic Instructions: we assume that True is represented by 1, and False is represented by 0
    • NOT - a string of bits are processed so that every 1 becomes a 0, and every 0 becomes a 1 (for example, NOT 11001001 would be 00110110); NOT can also be used to invert True to False or False to True for any particular test
    • AND - two inputs are evaluated, and a True value (1) is generated only if both inputs are True
      0 AND 0 = 0
      1 AND 0 = 0
      0 AND 1 = 0
      1 AND 1 = 1
    • OR - this is the inclusive OR instruction, which produces a True result if either or both of the two inputs evaluated are True
      0 OR 0 = 0
      1 OR 0 = 1
      0 OR 1 = 1
      1 OR 1 = 1
    • XOR - this is the exclusive OR instruction, which produces a True result if either but not both of the two inputs evaluated are True
      0 XOR 0 = 0
      1 XOR 0 = 1
      0 XOR 1 = 1
      1 XOR 1 = 0
      The text explains that if we XOR any string with a string of 1s of the same length, we get the same result as if we had performed a NOT against the first string. This leads to the statement that having an XOR command removes the need for a NOT command.
  • Other instructions
    • ADD - adds two strings of bits
      The text warns us that binary addition does not work for complex data types, so we need a separate ADD command for each data type supported by our processor.
    • SHIFT - the text describes two types of SHIFT
      • logical SHIFT - This command is used to move a series of bits to the right or left within a bit string (which may be a byte). When this is done, positions that were left vacant by the move are filled with 0s. By shifting one direction then the other, a particular bit can be left as the only one remaining in the string, allowing us to determine its value by reading whether it is a 1 or a 0. The utility of this is to avoid have to assign a value of True or False to every conceivable number.
      • arithmetic SHIFT - When we perform a shift on a byte that that holds an ordinary binary number, we are effectively multiplying that number (with a left shift) or dividing that number (with a right shift) by 2 to the power of the number of positions shifted. Note in the examples on page 114 that this only works cleanly when we are shifting significant digits into a range of 0s. If we shift into a range of positions that are already occupied by 1s, we will lose the value of those digits. The text does not mention this problem.

The text describes three sequence control operations on page 115 that support the idea of executing commands out of their linear sequence in a program.

  • unconditional BRANCH - This is what happens when a command is ggiven that causes the program to stop its current command sequence and continue with a different part of the program. The text gives us an example of a user clicking a Print command to branch to that code sequence in a word processing application
  • conditional BRANCH - This happens when conditions that are established in the program are met, which causes a branch from the currently executing code to another section of code. This method might be used to alert the user that the selected printer has run out of paper.
  • HALT - This command will stop current or all operations of the program, or it may send the program to a specific memory address holding a portion of the operating system of the device. As illustrated on page 117, this instruction can simply mark the end of the program and send the user back to a system prompt.

The text offers a few examples of combining simple instructions to create more complex instructions. The examples are not terribly clear, but the concept is.

On page 119, the text begins a discussion of instruction formats, which are patterned templates for the various parts of instructions. Note the two examples on page 120, in which some Op Code of a set length is followed by three operands. The size of the third operand varies between the two examples. This illustrates the idea that instructions may be fixed-length for a processor or they may be variable-length. Fixed length instructions make it easy to increment the pointer that points to the next instruction. It will always be incremented by the same amount. Variable-length instructions require that the current instruction be measured, and the pointer incremented by that instruction's length.

On page 124, the text brings up a new subject that affects system performance. The system clock is like a pacemaker for the heart of a computer, like a conductor for the orchestra that all the hardware of the computer makes up. It sends pulses that serve as time synchronization signals to the devices inside the computer. The system clock runs at a particular frequency (its clock rate) which is measured in hertz. One hertz is one cycle per second. A system clock's cycles are more likely to be measured in megahertz (millions of hertz) or gigahertz (billions of hertz). Instead of measuring the number of cycles per second, we can also express the frequency of the system clock by the length of time it takes to run one cycle. The math to calculate this value, the cycle time, is to take the multiplicative inverse of the clock rate (1 divided by the clock rate).

The text tells us that these basic measures of a system are important, but others are more important. A system might be measured by how many millions of instructions per second (MIPS) it can complete or how many millions of floating-point operations per second (MFLOPS or megaflops) it can perform. FLOPS can also be measured in billions (GFLOPS, gigaflops), trillions (TFLOPS, teraflops), or quadrillions (PFLOPS, petaflops), These measures are going to be different from the clock rate of a system because it may take multiple cycles for most operations. The more complex an operation is, the more clock cycles it is likely to take to complete. To make the concept more confusing, the text tells us that can take 2 to 10 cycles to access RAM, and thousands or millions of cycles to access secondary storage. Each of these factors slows down the throughput of the system. Each cycle the processor spends waiting for another component to complete a request is called a wait state.

The text has discussed registers in the CPU for many pages. We are reminded on page 128 that a CPU uses two types of registers. General-purpose registers are used by running programs as we have already discussed. Special-purpose registers are used for three other purposes, two of which have been discussed.

  • instruction register - holds the currently executing instruction
  • instruction pointer - holds the address of the next instruction
  • program status word - contains a series of one-bit flags about the status of the CPU, the executing program, and error conditions.

A concept that relates to other points in the chapter is word size. It relates to the system bus size because the bus size limits the number of bits that can be delivered to the CPU at once, and the word size is the number of bits the CPU can process at once. The word size of the CPU also determines the number of addresses the CPU can manage, and the number of bits that can be transferred to memory at once.

The text discusses some methods of enhancing the performance of a processor.

  • memory caching -  the text refers us to the next chapter for this discussion
  • pipelining - Note the six steps on page 131 that are typically followed in sequence by a CPU with each instruction. Pipelining allows a CPU to execute some of these steps at the same time, which speeds up processing.
  • branch prediction and speculative execution - The processor tracks the branches that have been used while executing a program and chooses to pipeline the next likely branch. When it is right, this speeds up processing as well.
  • multiprocessing - The most efficient thing a system can have to speed up processing is to have multiple processors. The key to using this feature is to have an operating system and to run programs that support multiprocessing.

The chapter spends the next several pages discussing electronic notation and physical factors that affect all electrical equipment, such as heat, electrical resistance, and circuit length. It also discusses some possible improvements in computing that have in fact been discussed for years but have yet to be realized.