
COMPUTER SCIENCE AND ENGINEERING – Processors - Barry Wilkinson PROCESSORS Barry Wilkinson Department of Computer Science, University of North Carolina at Charlotte, Charlotte, North Carolina, USA Keywords: CPU, processor, microprocessor, pipeline, microprogramming, RISC, data dependencies, forwarding, superscalar, register renaming, interrupts Contents 1. Introduction 2. Elementary Processor 3. Pipelined Processor Design 3.1. Technique 3.2. Instruction Pipeline Hazards 3.3. Interrupt Handling 4. Superscalar Processors 4.1 General 4.2. Instruction Issue 4.3. Register Renaming Glossary Bibliography Summary The focus of this section is on the internal design of the processor (central processing unit, CPU). The processor performs the actions of specified by machine instructions in the program stored in memory. The topics covered include the basic operations of fetching and executing a machine instruction, its implementation, microprogrammed control unit design, and pipelined design. The topic of pipelined design is explored in some detail and includes pipeline hazards, methods to handle procedural dependencies, data dependencies and their control using pipelined interlocks, forwarding, and interrupt handling. Processor design is then continued with superscalar design. Topics here include dual pipelines (briefly), more complex arrangements with multiple functional units as found in more recent processors, out-of-order instruction issue, centralized and distributedUNESCO instruction windows, register –renaming EOLSS and reorder buffers. 1. Introduction SAMPLE CHAPTERS The processor is the heart of a computer system; it performs the actions specified by the program stored in the memory. This stored program consists of a list of binary encoded machine instructions. Each machine instruction specifies a simple operation which usually operate upon numbers stored in memory or in registers within the processor. The basic ways the machine instructions can be constructed and encoded (instruction formats) is treated elsewhere. Here, we concentrate upon the internal design of the processor to fetch and execute these instructions. There is a very close relationship between the design of the instruction set and the corresponding design of the processor. ©Encyclopedia of Life Support Systems (EOLSS) COMPUTER SCIENCE AND ENGINEERING – Processors - Barry Wilkinson Usually, the objective is to design a processor that can execute instructions at the highest possible rate within cost and technological constraints. During the 1970s, there was a trend to incorporate more complex instructions into the instruction set with the belief that this would lead the fastest execution rate. In the late 1970s and early 1980s, this trend was questioned which lead to turnaround towards simpler instruction sets, the so-called reduced instruction set computer (RISC), in the belief that simpler hardware and more powerful compilers would be a better approach to achieve higher performance. However, the legacy of existing processors and their software base continued to be influenced on processor design. Newer models of a processor family need to be compatible with earlier processors of the same family. That is, the newer processors should be able to execute code of older processors, thereby not making the software base obsolete. Ingenious ways were found to keep the complex instruction set while achieving higher performance. In the following, we will start with a very simple processor design which represents the design of early microprocessors (1970s). We will consider the design of its control unit and the technique of microprogramming. Then, we will progress towards a design used in early pipelined RISC processor design. (Pipelining is a design technique known much earlier and incorporated into supercomputers of the 1960s). We will describe the problems that must be addressed to achieve high performance in pipeline designs and how to improve performance, including executing more than one instruction simultaneously (superscalar designs). 2. Elementary Processor The internal design of a simple processor is shown in Figure 1, and used here to illustrate the basic operation of a processor. The processor connects to the memory through a set of wires called a bus which carry the data to or from the memory, the address of the memory location being accessed, and control signals that produce the required the actions. The processor contains an ALU (arithmetic and logic unit), a registers file, a control unit and a number of specialized registers. One such register is the instruction register (IR) which holds the instruction that has been fetched for memory to be executed. The ALU performs basic arithmetic and logical operations such as addition and subtraction as specified by the machine instructions. The program counter (PC), also called the instruction pointer (IP), is a register inside the processor holding the address of the next instruction to be executed. The name program counter is unfortunateUNESCO since it does not count programs; – EOLSS it identifies the next instruction in the program. The control unit orchestrates the actions within the processor by sending signals to the various components. SAMPLE CHAPTERS The operation of this simple processor can be divided into two distinct phases, a fetch cycle and execute cycle. In the fetch cycle, an instruction is obtained from the memory and loaded into the instruction register. Afterwards, the program counter is incremented to point to the next instruction. In the execute cycle, the operation specified by the fetched instruction is performed, including fetching any operands and storing the result. The operations required to fetch and to execute an instruction can be divided into a number of sequential steps. The signals for each step are generated by the control unit of the processor. ©Encyclopedia of Life Support Systems (EOLSS) COMPUTER SCIENCE AND ENGINEERING – Processors - Barry Wilkinson The simplest and most common action that the control unit must initiate is a data transfer from one internal register or unit to another internal register or unit. This can be described in a register transfer language (RTL) notation. For example, to transfer the contents of register B to register A in time period T1, we write: T1: A ← B Figure 1. Representative Early Microprocessor Design This action might be produced by having one signal to select the source (B in this case) and one signal to select the destination (A in this case). A sequence of such steps make up the UNESCOfetch and execute cycles. – EOLSS The fetch cycle might be the sequence: SAMPLE CHAPTERS MAR ← PC Select next instruction Memory read operation IR ← MDR Load instruction into instruction register PC ← PC + 4 Increment program counter in preparation for next fetch cycle where MAR is an internal register holding the address being sent to the memory, and MDR is an internal register holding the data to or from the memory. The PC is ©Encyclopedia of Life Support Systems (EOLSS) COMPUTER SCIENCE AND ENGINEERING – Processors - Barry Wilkinson incremented by four in this example because the instructions are assumed to be four bytes each (and the memory is organized so that each byte has a unique address). The execute cycle will depend upon the fetched instruction, but will also consist of a sequence of elementary steps, each step requiring particular signals to be generated by the control unit. For example, the RISC machine instruction of the form ADD Rd, Rs1, Rs2 (Rd = Rs1 + Rs2) might have the steps: A ← Rs1 Select first source operand B ← Rs2 Select second source operand C ← A + B Perform addition Rd ← C store result where A, B, and C are temporary registers within the processor. A and B hold the contents of registers selected as source registers from the register file and C holds the value to be placed in the register selected as the destination register. The selection of source and destination registers will be from the source and destination fields within the machine instruction. The control unit can be designed using the traditional logic design techniques.This approach leads to a specific logic design interconnected logic gates and flip-flops depending upon the internal arrangements of the processor and the instruction set (a so- called a random logic approach). To implement very complex instructions especially, an alternative more structured approach called microprogramming may be better. Here, each step is encoded into a binary pattern called a microinstruction. A sequence of these microinstructions is formed for each machine instruction. The sequence is stored in a high speed memory called a control memory which is within the control unit of the processor. The sequence of microinstructions is known as microprogram (or microcode) and one sequence must be performed to execute each machine instruction. The general arrangement of a microprogrammed control unit is shown in Figure 2. The next machine instruction to be executed is read from the memory into the instruction register by a instruction fetch microprogram (or by dedicated logic). The fetched machine instruction identifies the location in the control memory of the first microinstruction of the execute sequence for that machine instruction, and this sequence is then fetched from the control memory and performed. UNESCO – EOLSS Microprograms are very much like machine instruction programs and some of the same techniques can be applied to both. For example, a microinstruction program counter can be used
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages8 Page
-
File Size-