Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2005 – Curt Hill MicroProgramming Programming at a different level.

Similar presentations


Presentation on theme: "Copyright © 2005 – Curt Hill MicroProgramming Programming at a different level."— Presentation transcript:

1 Copyright © 2005 – Curt Hill MicroProgramming Programming at a different level

2 Copyright © 2005 – Curt Hill The Control Unit What does it do? Decodes the instruction Causes the ALU to perform the needed actions This can be done in two ways: –Hardwire the CU from gates –Microprogram the CU

3 Copyright © 2005 – Curt Hill History 1 Control Units were traditionally hardwired Wilkes proposed in papers in 1951 and 1953 the concept of a microprogram This is the same Wilkes of the EDSAC It was kicked around for a while with no practical implementations

4 Copyright © 2005 – Curt Hill History 2 In the 1950s virtually every machine had its own machine language Average lifetime of a machine was two years Every two years every piece of software had to be rewritten for the new machine This was good motivation for both microprogramming and high level languages

5 Copyright © 2005 – Curt Hill History 3 In the February 1964 issue of Datamation was an article decrying the commercial failure of microprogramming In April of the same year IBM introduced the System 360 All the low end machines were microprogrammed The high end machines were hardwired for performance

6 Copyright © 2005 – Curt Hill Hardwired vs. Software A variety of applications can use either a hard or soft solution –Controllers being typical The hard solution is a digital gate network –Such as a Programmable Logic Array The soft solution is a microprocessor with control program What are the tradeoffs?

7 Copyright © 2005 – Curt Hill Tradeoffs Given the same level of technology the hardwired solution is: –Faster –Uses fewer gates The software solution is: –More flexible –Less error prone –Easier to maintain The Control Unit can be either

8 Copyright © 2005 – Curt Hill The Control Unit May be hardwired with just a gate network It may be microprogrammed as well Then known as a microcontroller –Aka microprocesser, but that term is ambiguous The software is then the microcode Microcode comes in two formats: –Horizontal and vertical

9 Copyright © 2005 – Curt Hill Microcode The goal of the microcode is to sequence the ALU and other parts of CPU to implement the instruction set of the computer In this context the instruction set of the processor is called the macrocode Generally the microcode is not visible to the macrocode programmer The microcode only deals with very low level features

10 Copyright © 2005 – Curt Hill Vertical Microcode Vertical microcode is somewhat similar to macrocode Each macrocode instruction becomes a parameterless subroutine call The subroutine then implements the macrocode instruction Consider the example of a 32 bit add from System 360

11 Copyright © 2005 – Curt Hill Add Example Consider the following add instruction A r4,120(r6) It means this: –Add 120 to contents of register 6 –Use that address to fetch a 32 bit item –Add that to contents of register 4 –Leave the result in register 4

12 Copyright © 2005 – Curt Hill CPU Units ALU ALU Cmd Operand A Operand B ALU Result Register File Control Unit Memory Mem Cmd

13 Copyright © 2005 – Curt Hill Vertical Microcode Implementation Copy register 6 to ALU A Copy last 10 bits of instruction to ALU B Execute ALU add Send result to memory as a fetch Send returned memory value to ALU A Send register 4 to ALU B Execute ALU add Send result to register 4

14 Copyright © 2005 – Curt Hill Partial Implementation The above did nothing about several important activities of the CPU –Fetching the current instruction –Determining the length of current instruction –Incrementing Program Counter –Setting condition codes These may be part of the microcode program or hardwired –A control unit may have a mix of hardwired and software implementation

15 Copyright © 2005 – Curt Hill Problems Vertical microcode must do several things for even a simple instruction such as add Thus it must be very fast compared to the basic hardware of the CPU It tends also to sequence the sub-parts of the instruction This impairs performance since it does not do well with parallel execution

16 Copyright © 2005 – Curt Hill Vertical Microcode Example The LSI 11 used a vertical microcode instruction Used a 22 bit micro instruction 11 bit micro address allowing 2048 words of micro instructions Somewhat similar to the PDP 11 instruction set that it emulated Supplied arithmetic, logical, general and I/O operations

17 Copyright © 2005 – Curt Hill Microcode Types Vertical microcode looks like traditional assembly language The exception is the items that it deals with are not always visible to the assembly language programmer Thus it is easy for programmers to deal with Horizontal microcode is a word where each set of bits has a particular meaning to the sub-units

18 Copyright © 2005 – Curt Hill Horizontal Microcode Each instruction is a word divided into fields Each field is the command for one of the units Using our example diagram our fields could be: –ALU Command Two Operands One result –Memory –Registers

19 Copyright © 2005 – Curt Hill CPU Units ALU ALU Cmd Operand A Operand B ALU Result Register File Control Unit Memory Mem Cmd

20 Copyright © 2005 – Curt Hill ALU Operations Suppose our ALU has following commands: –Add –Not –And –Or –Shift left –Shift right –No operation –Continue Eight instructions – 3 bits of command

21 Copyright © 2005 – Curt Hill Operands The ALU has three registers Two operand registers and one result register There is an implied command for each For the two operand registers it is: –Accept contents –Do nothing For result it is: –Output (to lines) result –Do nothing

22 Copyright © 2005 – Curt Hill Memory and Registers The registers and memory have three commands: –Fetch data –Store data –Do nothing In addition they both need an address to get or fetch from –Registers is typically 2-8 bits May be from microcode or instruction –Memory is typically 32 or more bits Almost always computed

23 Copyright © 2005 – Curt Hill Horizontal Microcode 0-2ALU command 3Operand A command 4Operand B command 5Result command 6-7Memory command 8-9Register command

24 Copyright © 2005 – Curt Hill Microcode Word The above shows a 10 bit word Memory addresses are handled in other The microcode may have some bits to handle choosing a register These words are dropped on the bus periodically Hence two commands may execute at the same time –Storing a register value in memory could be simultaneously done with an ALU computation –The ALU continue command allows the ALU to take more than one cycle to finish its computation

25 Copyright © 2005 – Curt Hill Horizontal Microcode A different paradigm than programmers expect –Makes it more difficult to program The parallelism makes for faster execution

26 Copyright © 2005 – Curt Hill Example This time use horizontal micro code –10 opcode bits Consider the following add instruction A r4,120(r6) It means this: –Add 120 to contents of register 6 –Use that address to fetch a 32 bit item –Add that to contents of register 4 –Leave the result in register 4

27 Copyright © 2005 – Curt Hill Horizontal Microcode 000 1 0 0 00 01 –Copy register 6 to ALU A 000 0 1 0 00 01 –Copy last 10 bits of instruction to ALU B 001 0 0 0 00 00 –Execute ALU add 000 0 0 1 10 00 –Send result to memory as a fetch This ignores: –How registers are selected –How pieces of instruction are used –All parallelism

28 Copyright © 2005 – Curt Hill IBM 360 Example Microprogramming was used to make all the machines to have the same macroinstruction set The model 20 was a 16 bit machine The model 30, 40, 50, 60 were microprogrammed 32 bit machine These came out before semiconductor ROM –Used IMPL to start The model 90 was a high end scientific machine

29 Copyright © 2005 – Curt Hill IBM 3033 Example Successor to 360/370 Horizontal microcode 4096 word control store Two sizes of micro instructions –2048 108 bit micro instructions –2048 126 bit micro instructions

30 Copyright © 2005 – Curt Hill Partial Microprogramming The instruction set of a computer could be mostly set That is the microcode is in ROM However, allow undefined opcodes to be programmed as microcode subroutines in some type of PROM IBM used unused opcodes in the 370 and 3000 series to speed the OS and other products –Common code made an instruction

31 Copyright © 2005 – Curt Hill The Day Has Passed The heyday of microprogramming was the 60-70s It simplified CU design and made it easy Then CPUs were constructed out of discrete chips The age of one chip microprocessors ended the day Now a single CPU chip can generally run software faster than the many chips with custom microprogram

32 Copyright © 2005 – Curt Hill Last Thoughts There is no reason why the microprogram could not be a ROM external to the main chip However, in most cases it is not needed Only specialized CPUs such as runs the Java Byte Code would need The price of software is too large for most new machine designs


Download ppt "Copyright © 2005 – Curt Hill MicroProgramming Programming at a different level."

Similar presentations


Ads by Google