Chapter 16 Micro-programmed Control EEL 4709C Alan Garcia Arturo Linares Henry Mitzler
16.1 Microprogrammed Control Basic Concepts
Micro-programmed Control Use sequences of instructions to control complex operations An alternative to a hardwired control unit Called micro-programming, microcode, or firmware
Control Unit Organization
Implementation (1) All the control unit does is generate a set of control signals Each control signal is on or off Each control signal is represented by a bit Have a control word for each micro-operation Have a sequence of control words for each machine code instruction Add an address to specify the next micro-instruction, depending on conditions
Implementation (2) Today’s large microprocessor Many instructions and associated register-level hardware Many control points to be manipulated This results in control memory that Contains a large number of words co-responding to the number of instructions to be executed Has a wide word width Due to the large number of control points to be manipulated
Micro-program Word Length Based on 3 factors Maximum number of simultaneous micro-operations supported The way control information is represented or encoded The way in which the next micro-instruction address is specified
Micro-instruction Types Each micro-instruction specifies single (or few) micro- operations to be performed (vertical micro-programming) Vertical instructions must be decoded to produce control signals. Slower than horizontal microprogramming, but take up less memory (ROM) space. Each micro-instruction specifies many different micro- operations to be performed in parallel (horizontal micro-programming) Requires more memory, but does requires little if any decoding.
Vertical Micro-programming Width is narrow n control signals encoded into log2 n bits Limited ability to express parallelism Considerable encoding of control information requires external memory word decoder to identify the exact control line being manipulated
Horizontal Micro-programming Wide memory word High degree of parallel operations possible Little encoding of control information
Typical Microinstruction Formats
Compromise Divide control signals into disjoint groups Implement each group as separate field in memory word Supports reasonable levels of parallelism without too much complexity
Organization of Control Memory
Control Unit
Control Unit Function Sequence logic unit issues read command Word specified in control address register is read into control buffer register Control buffer register contents generates control signals and next address information Sequence logic loads new address into control buffer register based on next address information from control buffer register and ALU flags
Next Address Decision Depending on ALU flags and control buffer register Get next instruction Add 1 to control address register Jump to new routine based on jump microinstruction Load address field of control buffer register into control address register Jump to machine instruction routine Load control address register based on opcode in IR
Functioning of Microprogrammed Control Unit
Wilkes Control Microprogram was coined by Wilkes in the early 1950s. 1951 – Wilkes first proposed microprogrammed control. Matrix partially filled with diodes During cycle, one row activated Generates signals where diode present First part of row generates control Second generates address for next cycle
Wilkes's Microprogrammed Control Unit
Advantages and Disadvantages of Microprogramming Simplifies design of control unit Cheaper Less error-prone Slower than a pure hard-wired implementation RISC processors typically use hardwired control units because of their simpler instruction formats. Bugs and Errata can be corrected by microcode update E.g. Intel Core 2 Duo – bugs and possible security vulnerabilities resolved via microcode update
Advantages and Disadvantages of Microprogramming Instructions can be easily be added with microprogramming compared with hardwired control units. Specifying the architecture and instruction set becomes a software programming issue rather than hardware design problem.
Interesting Facts The Nintendo 64’s graphics and audio co-processor (MIPS 4000 based) utilized programmable microcode Allowed for tuning of the processor for extra speed and quality e.g. to run at 640x480. Playstation 2’s vector processor units were microprogrammable via microcode. 3D Geometry and floating point arithmetic Microcode allows for programmers to fine-tune the processors at a below assembly code level, allows for more optimization.
Tasks Done By Microprogrammed Control Unit Microinstruction sequencing Microinstruction execution Must consider both together
17.2 Microinstruction Sequence
Microinstruction Sequencing Design Considerations: Size of microinstruction Address-generation time Determined by instruction registers Next sequential branch Branch
Microinstruction Sequencing Sequencing Techniques: Two address fields Single address field Address-generation time Determined by instruction registers Next sequential branch Branch
Branch Control Logic: Two Address Fields Microinstruction Sequencing Branch Control Logic: Two Address Fields
Branch Control Logic: Single Address Field Microinstruction Sequencing Branch Control Logic: Single Address Field
Branch Control Logic: Variable Format Microinstruction Sequencing Branch Control Logic: Variable Format
Microinstruction Sequencing Microinstruction Address Generation Techniques: Explicit Implicit Two-Field Mapping Unconditional Branch Addition Conditional Branch Residual Control
17.3 Microinstruction Execution
The microinstruction cycle is the basic event on a micro programmed processor. Each cycle is made up of two events Fetch Determined by generation of microinstruction address Execute To generate control signals.
Control Unit Organization Sequencing Logic Module Generates the address of the next microinstruction Control Logic Module Generates control signals
Microinstruction Classification Vertical microprogramming Each microinstruction specifies a single (or few) micro- operations to be performed Width is narrow: n control signals can be encoded into log2n 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
Microinstruction Classification Horizontal microprogramming Each microinstruction specifies many different micro-operations to be performed in parallel. Wide memory word High degree of parallel operations are possible Little to no encoding of control information
Microinstruction Encoding Microinstruction is organized as a set of fields. Each field is depicted as a set of actions. Only one of the actions specified for a given field could occur at a time.
Aspects of Encoding Functional Encoding Resource Encoding Identifies functions within the machine and designates fields by function type. Resource Encoding Devotes one field to each source( e.g., I/O, memory, ALU) Direct or Indirect Encoding The difference is that with indirect encoding, one field is used to determine the interpretation of another field.
References http://fourier.eng.hmc.edu/e85/lectures/processor/no de11.html http://www.cs.binghamton.edu/~reckert/hardwire3ne w.html http://en.wikipedia.org/wiki/Microcode http://en.wikipedia.org/wiki/Hardwired_control http://en.wikipedia.org/wiki/Control_unit http://en.wikipedia.org/wiki/Core_2_duo
References http://en.wikipedia.org/wiki/Erratum
Summary Microprogramming – alternative to hard-wired control units, provides more flexibility in designing the processor and control unit. Disadvantages – not as fast as a hard-wired implementation, RISC processors typically use hardwired control units. Microprogramming allows for errors microcode to be corrected via patches (with writable memory i.e. EEPROM) (as in C2D) Horizontal microcode represents each control signal as a bit with little or no encoding used. Vertical microcode encodes mutually exclusive control signals in different fields, which must then be decoded to produce the control signals. (Which requires more time because of additional combinational circuits).
Review Questions What is the difference between horizontal and vertical microinstructions? Why is micro programmed control used instead of hardwired control for the control unit. What are the advantages and disadvantages of micro programmed control compared with a hardwired control unit implementation? What are the main tasks performed by a micro programmed control unit?
Review Questions Why are vertical microinstructions slower than horizontal microinstructions? What is the preferred sequencing technique? What are the differences between explicit techniques and implicit techniques? What range of values does the length of vertical and horizontal microinstructions fall under? What does the control memory contain? What concerns are involved in the design of a microinstruction sequencing technique?