Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Control Unit Operation and Microprogramming Chap 16 & 17 of CO&A Dr. Farag 1 Introduction • Main components of the CPU • Special Registers (Y and Z) • The two cycles (fetch and execute phases) • The basic functions of CU – Sequencing: stepping through microinstructions – Execution: executing microinstructions • CU block diagram – Inputs ( IR, flags, clock, & control signals from system bus) – Outputs (control signals to system and internal buses) • Internal processor organization (single bus architecture) 2 Basic Operations • Four basic operations can be used to construct more complex ones – – – – Register transfer (LOAD MQ) Performing an arithmetic or logic operation Fetching a word from memory (Load M(100)) Storing a word into memory (Store M(100)) • Complete example: Write the control steps for executing IAS assembly instruction: ADD M(3000) 3 Control Unit Implementation • Two Main techniques to implement CU: – Hardwired implementation – Microprogrammed implementation • In hardwired implementations the CU is considered as a combinational logic circuit the produces its outputs (control signals) based on its inputs (IR, flags, step counter, etc.) • Ex: To derive a logical expression for Zin: • Zin = T1. (fetch phase) + T6 . Add + ……… 4 Control Unit Implementation (Cont.) • All control steps for each instruction should be specified then the logical expression for each control signal is derived. • This process becomes very complex with the increase in processor complexity. • An effective alternative is microprogrammed implementation. • The idea of microprogramming is to consider each instruction as a sequence of much simpler steps called microinstructions. 5 Control Unit Implementation (Cont.) • Each microinstruction basically activates a number of control signals. • Microinstructions can be stored into memory locations as control words. • Each control word contains a number of bits equals to the number of CPU & bus control signals in addition to an address field and a jump condition field. • For those active control signals in a microinstruction corresponding bits will be set otherwise all other bits store zero. 6 Control Unit Implementation (Cont.) • The previously described technique is called horizontal microinstruction. • To execute such instructions: – Issue control signals for active bits – If condition is false, execute the following instruction – Otherwise, execute the instruction whose address is stored in the address field • Another for of structuring the microinstruction is called vertical organization where the system bus and the internal CPU control signals are coded. • Think of the pros and cons 7 Control Unit Implementation (Cont.) • Now the components of a microprogrammed CU are : – Decoder: to decode the IR – Sequencing logic: to determine the address Of the next microinstruction to be executed – Control address register: to hold the above address – Control memory: to store control words – Control buffer register: to store the currently read microinstruction – Decoder: to decode microinstructions if need 8 Advantages and Disadvantages • Simplicity – Cheaper – Less error-prone • Flexibility: The content of the control memory can be modified or even replaced to update the instruction set architecture of the computer. • This is impossible in can of Hardwires control. • The principle disadvantage of microprogramming is performance. Despite this, it is the dominant technique to implement CUs in CISC processors. • RISC processors usually use Hardwired control. 9 Microprogramming Applications • Realization of CUs. • Emulation. • Operating system support: Implement primitives that replace important portions of OS S/W. • HLL support: various functions and data type can be implemented directly in firmware. • Monitoring, detecting, isolating, and repairing system errors (microdiagnostics). • User tailoring: Enable the use to write to the control memory by implementing it using RAM. 10