31
CIT 420 LECTURE SERIES Topic: Introduction to Microprogramming By Dr. A.O. Akinwunmi Computer Science programme College of Computing and Communication Studies

CIT 420 LECTURE SERIES - Bowen Login

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CIT 420 LECTURE SERIES - Bowen Login

CIT 420 LECTURE SERIES

Topic: Introduction to MicroprogrammingBy

Dr. A.O. AkinwunmiComputer Science programme

College of Computing and Communication Studies

Page 2: CIT 420 LECTURE SERIES - Bowen Login

Content

• Background

• Basic Concepts

• Control unit design approaches

• Microprogrammed Control Unit

• Classification of Micro-instructions

• Advantages and Disadvantages of Microprogramming

• Microprogrammed Processor

Page 3: CIT 420 LECTURE SERIES - Bowen Login

Background• The control parts of computers prior to the mid-60s were constructed,

essentially, of electronic components structured into logic gates. • It was quickly discovered that building computers, especially the control

logic, was complex and error-prone — hence techniques were developed to further structure systems and reduce errors.

• In 1957 Maurice Wilkes proposed an alternative called `microprogramming’.

• Microprogramming is a technique to implement the control logic necessary to execute instructions within a processor.

• It is based on the general idea of fetching low-level microinstructions from a control store and deriving the appropriate control signals to be active for a single clock cycle, as well as microprogram sequencing information, from each microinstruction.

Page 4: CIT 420 LECTURE SERIES - Bowen Login

Background Cont’d• Wilkes' idea was that each machine instruction was divided into a

number of sub-instructions, or microinstructions.

• The real instruction (we might say macroinstruction) might be something like `add the contents of registers A and B', a microinstruction might be something like `write out register A to bus Z', or `read data bus into register X' — very basic actions that could be assembled to implement the actual instruction set of the machine.

• The set of microinstructions that made up a full instruction set was called the microprogram, or microcode.

Page 5: CIT 420 LECTURE SERIES - Bowen Login

Basis Concepts• Micro-operations: programs are executed as a sequence of instructions, each instruction consists

of a series of steps that make up the instruction cycle fetch, decode, etc. Each of these steps are, in turn, made up of a smaller series of steps called micro-operations.

• Micro-operation execution: Each step of the instruction cycle can be decomposed into micro-operation primitives that are performed in a precise time sequence. Each micro-operation is initiated and controlled based on the use of control signals / lines coming from the control unit. E.g. the data to move from one register to another and the activation of the specific ALU functions

• Micro-instruction: Each instruction of the processor is translated into a sequence of lower-level micro-instructions. The process of translation and execution are referred to as microprogramming

• Microprogrammed Control Unit is a relatively logic circuit that is capable of sequencing through micro-instructions and generating control signal to execute each micro-instruction.

• Control Unit: The control Unit is an important portion of the processor. The control unit issues control signals external to the processor to cause data exchange with memory and I/O unit. The control Unit issues also control signals internal to the processor to move data between registers, to perform the ALU and other internal operations in processor.

Page 6: CIT 420 LECTURE SERIES - Bowen Login

Control unit design approaches

• There are two approaches of Control Unit Design and implementation:• - Microprogrammed implementation

• - Hardwired logic implementation

Page 7: CIT 420 LECTURE SERIES - Bowen Login

Control unit inputs and Output

Page 8: CIT 420 LECTURE SERIES - Bowen Login

Approach of microprogrammed control unit

• The control signal values for each microoperation are stored in a memory.

• - Reading the contents of the control store in a prescribed order is equivalent to sequencing through the microoperations

• - Since the “microprogram” of microoperations and their control signal values are stored in memory, this is a microprogrammed unit.

• The microprogrammed approach:• are more systematic with a well-defined format.• can be easily modified during the design process.• require more components to implement• tend to be slower than hardwired units (due to having to perform memory read

operations)

Page 9: CIT 420 LECTURE SERIES - Bowen Login

Approach of hardwired logic• - The Control Unit is viewed and designed as a combinatorial and

sequential logic circuit.

• - The Control Unit is implemented by using any of a variety of “standard” digital logic techniques. The logic circuit generate the fixed sequences of control signals

• - This approach is used to generate fixed sequences of control signals with the higher speed.

• In hardwired approach:• the principal advantages are a higher speed operation and the smaller

implementations (component counts)• the modifications to the design can be hard to do.• this approach is favoured in RISC style designs.

Page 10: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Control Unit• The idea of microprogrammed control units was introduced by M. V. Wilkes in the

early 1950s was motivated by the desire to reduce the complexities involved with hardwired control.

• A typical instruction is implemented using a set of micro-operations. Within each micro-operation is a set of control lines that must be activated to carry out the corresponding microoperation.

• The idea of microprogrammed control is to store the control signals associated with the implementation of a certain instruction as a microprogram in a special memory called a control memory (CM).

• A microprogram consists of a sequence of microinstructions. A microinstruction is a vector of bits, where each bit is a control signal, condition code, or the address of the next microinstruction.

• Microinstructions are fetched from CM the same way program instructions are fetched from main memory.

Page 11: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Control Unit Cont’d

Fetching micro-instructions (Control word)

Page 12: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Control Unit Cont’d• When an instruction is fetched from memory, the op-code field of the

instruction will determine which microprogram is to be executed. In other words, the op-code is mapped to a microinstruction address in the control memory.

• The microinstruction processor uses that address to fetch the first microinstruction in the microprogram. After fetching each microinstruction, the appropriate control lines will be enabled. Every control line that corresponds to a “1” bit should be turned on. Every control line that corresponds to a “0” bit should be left off.

• After completing the execution of one microinstruction, a new microinstruction will be fetched and executed. If the condition code bits indicate that a branch must be taken, the next microinstruction is specified in the address bits of the current microinstruction. Otherwise, the next microinstruction in the sequence will be fetched and executed.

Page 13: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Control Unit Cont’d• The length of a microinstruction is determined based on the number of

microoperations specified in the microinstructions, the way the control bits will be interpreted, and the way the address of the next microinstruction is obtained.

• A microinstruction may specify one or more micro-operations that will be activated simultaneously. The length of the microinstruction will increase as the number of parallel micro-operations per microinstruction increases.

• Furthermore, when each control bit in the microinstruction corresponds to exactly one control line, the length of microinstruction could get bigger. The length of a microinstruction could be reduced if control lines are coded in specific fields in the microinstruction.

• Decoders will be needed to map each field into the individual control lines. Clearly, using the decoders will reduce the number of control lines that can be activated simultaneously.

Page 14: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Control Unit Cont’d• The idea of microprogrammed Control Unit is that the Control Unit

design must include the logics for sequencing through micro-operations, for executing micro-operation, for executing micro-instructions, for interpreting opcodes and for making decision based on ALU flags. So the design is relatively inflexible. It is difficult to change the design if one wishes to add a new machine instruction.

• The principal disadvantage of a microprogrammed control unit is that it will be slower than hardwired unit of comparable technology. Despite this, microprogramming is the dominant technique for implementing control unit in the contemporary CISC processor, due to its ease of implementation.

Page 15: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Control Unit Cont’d

• The two basic tasks performed by a microprogrammed control unit are as follows:• - Micro-instruction sequencing: the microprogrammed control unit get the

next mico-instruction from the control memory

• - Micro-instruction execution: the microprogrammed control unit generate the control signals needed to execute the micro-instruction.

• The control unit design must consider both because they affect the format of the micro-instruction and the timing of the control unit.

Page 16: CIT 420 LECTURE SERIES - Bowen Login

Micro-instruction sequencing• Two problems are involved in the design of a micro-instruction sequencing

technique which are the size of micro-instruction and the address-generation time. The first concern is obvious minimizing the size of the control memory. The second concern is simply a desire to execute microinstruction as fast as possible.

• In executing a microprogram, the address of the next microinstruction to be executed is one of these categories:• - Determined by instruction register• - Next sequential address• - Branch.

• It is important to design compact time-efficient techniques for micro-instruction branching.

Page 17: CIT 420 LECTURE SERIES - Bowen Login

Micro-instruction sequencing Cont’d

• Sequencing technique

• Three general categories for a control memory address are as follows:

• - Two address fields

• - Single address field

• - Variable format

Page 18: CIT 420 LECTURE SERIES - Bowen Login

Micro-instruction sequencing Cont’d

The branch control logic with a single address field is illustrated.

Branch Control unit of Microprogrammed Control Unit with a single address field

Page 19: CIT 420 LECTURE SERIES - Bowen Login

Micro-instruction sequencing Cont’d

• Address generation

• The problem is to consider the various ways in which the next address can be derived or computed. The various techniques of the address generation are given in the following table.

Explicit Implicit

Two-field Mapping

Unconditional branch Addition

Conditional branch Residual control

Page 20: CIT 420 LECTURE SERIES - Bowen Login

Micro-instruction execution

• The microinstruction cycle is the basic event on a microprogrammed processor.

• Each cycle is made up the two parts: fetch and execute.

• The effect of the execution of a microinstruction is to generate control signals for both the internal control to processor and the external control to processor.

Page 21: CIT 420 LECTURE SERIES - Bowen Login

Micro-instruction execution Cont’d

Microprogrammed Control Unit Organization

Page 22: CIT 420 LECTURE SERIES - Bowen Login

Classification of Micro-instructions

• Microinstruction can be classified in variety of ways in which the designer must choose the parallel “power” of each instruction. There are the following.

• – Vertical microprogramming: Each microinstruction specifies a single (or few) microoperations to be performed

• – Horizontal microprogramming: Each microinstruction specifies many different microoperations to be performed in parallel.

Page 23: CIT 420 LECTURE SERIES - Bowen Login

Vertical microprogramming

• Width is narrow: n control signals can be encoded into log2 n control bits

• Limited ability to express parallelism

• Considerable encoding of control information requires external memory word decoder to identify the exact control line being manipulated

Page 24: CIT 420 LECTURE SERIES - Bowen Login

Horizontal microprogramming

• Wide memory word

• High degree of parallel operations are possible

• Little to no encoding of control information

Page 25: CIT 420 LECTURE SERIES - Bowen Login

Microinstruction implementation techniques

• Compromise technique

• – Divide control signals into disjoint groups

• – Implement each group as a separate field in the memory word

• – Supports reasonable levels of parallelism without too much complexity

• Second compromise: nano-programming

• – Use a 2-level control storage organization

• – Top level is a vertical format memory

• Output of the top level memory drives the address register of the bottom (nano-level) memory

• – Nano-memory uses the horizontal formal. The produces the actual control signal outputs

• – The advantage to this approach is significant saving in control memory size (bits)

• – Disadvantage is more complexity and slower operation (doing 2 memory accesses for each microinstruction).

Page 26: CIT 420 LECTURE SERIES - Bowen Login

Microprogramming applications

• i. For the typically large microprocessor systems today: there are many instructions and associated register level hardware. There are many control point to be manipulated.

• ii. Emulation: the use of a microprogram on one machine to execute programs originally written to run on another machine. By changing the microcode of a machine, you can make it execute software from another machine.

Page 27: CIT 420 LECTURE SERIES - Bowen Login

Advantages and Disadvantages of Microprogramming• The principal advantage of the use of microprogramming to implement a

control unit is that it simplifies the design of the control unit. Thus, it is both cheaper and less error prone to implement. A hardwired control unit must contain complex logic for sequencing through the many micro-operations of the instruction cycle. On the other hand, the decoders and sequencing logic unit of a microprogrammed control unit are very simple pieces of logic.

• The principal disadvantage of a microprogrammed unit is that it will be somewhat slower than a hardwired unit of comparable technology. Despite this, microprogramming is the dominant technique for implementing control units in pure CISC architectures, due to its ease of implementation. RISC processors, with their simpler instruction format, typically use hardwired control units

Page 28: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Processor• In a microprogrammed processor, the hardware does not directly execute the

instructions in the ISA (Instruction Set Architecture) Instead, the hardware executes very simple micro-operations, and each instruction specifies a sequence of micro-operations that are used to implement the instruction.

• Essentially, each instruction in the ISA is translated into a short program of microinstructions by the hardware, similar to the way a compiler translates each instruction in a high-level language program into a sequence of assembly-language instructions.

• For instance, a microprogrammed processor might translate the instruction ADD r1, r2, r3 into six micro-operations: one that reads the value of r2 and sends it to one input of the adder, one that reads the value of r3 and sends it to the other input of the adder, one that performs the actual addition, one that writes the result of addition into r1, one that increments the PC to point to the next instruction, and one that fetches the next instruction from the memory. Each micro-operation generally takes one processor cycle to execute, so an ADD instruction would require six cycles to complete in such a system.

Page 29: CIT 420 LECTURE SERIES - Bowen Login

Microprogrammed Processor Cont’d

• Microprogrammed processors contain a small memory that holds the sequences of microinstructions used to implement each instruction in the ISA.

• To execute an instruction, a microprogrammed access this memory to locate the set of microinstructions required to implement the ISA instruction, and then executes the microinstructions in sequence.

Page 30: CIT 420 LECTURE SERIES - Bowen Login

Conclusion• Microprogramming became popular because the technologies used to

implement early computers (vacuum tubes, discrete transistors, and small-scale integrated circuits) limited the amount of hardware that could be built into the processor, and computer architects wanted to design ISAs with complex instructions to reduce the number of instructions required to implement a program.

• By using microprogramming, architects could build simple hardware and then microprogram that hardware to execute complex instructions.

• Modern processors tend not to use microprogramming for two reasons. • First, it is now practical to implement most processor’s ISAs directly in hardware

because of advances in VLSI technology, making microcode unnecessary. • Second, microprogrammed processors tend to have lower performance than non-

microprogrammed processors because of the overhead involved in fetching each microinstruction from the microinstruction memory.

Page 31: CIT 420 LECTURE SERIES - Bowen Login

References• Carter, N. P. (2002). Computer Architecture, Schaum Outlines, McGraw-Hill Companies

ISBN 0-07-136207-X.

• Mostafa Abd-El-Barr, Hesham El-Rewini (2005). Fundamentals of computer organization and architecture. John Wiley & Sons, Inc., Hoboken, New Jersey. Wiley series on parallel and distributed computing ISBN 0-471-46741-3.

• Neal Harman, N. and Gimblett, A. (2008). Microprogramming in CS-323: High Performance Microprocessors Lecture Material, Department of Computer Science, University of Wales Swansea Retrieved from:

• http://euler.mat.uson.mx/~havillam/ca/CS323/0708.cs-323003.html#text2

• Nguyen, H.L. (2013). Microprogramming in Computer Architecture Lecture Notes Retrieved from:

• https://voer.edu.vn/c/microprogramming/c5bb8246/bb0f7063

• Stallings, W. (2010). Computer Organization and Architecture Designing For Performance Eighth Edition Pearson Prentice Hall ISBN-13: 978-0-13-607373-4