130 likes | 266 Views
Microprograms. L17 Guilin Wang School of Computer Science The University of Birmingham [adapted from Ata Kaban]. This Lecture. • Control Logic • Microinstruction (execution) • Mapping clock phases to control signals • Implementing a multiplication algorithm. Clocks and Control logic.
E N D
Microprograms L17 Guilin Wang School of Computer Science The University of Birmingham [adapted from Ata Kaban]
This Lecture • Control Logic • Microinstruction (execution) • Mapping clock phases to control signals • Implementing a multiplication algorithm
Clocks and Control logic • Computer: various components connected via BUS - So, need to control the transfer to the Bus… • This is done by Control Logic. • Control Logic uses clock
Microprogrammed Computers • We now know enough about how to organize an entire computer from various components. • An example is given in Figure 4.15 (Book 1, Page 155). • This computer can execute microprograms, which are expressed in microinstructions, some extremely simple instructions. • Each word contains 16 bits.
Example: Microprogram Memory • Place a microinstruction address in MPC • The contents available in MIR • This effect happens in Phase 5 only
Microinstructions • Data is kept in main memory. • Microinstructions are placed in micromemory. • Example: The following 22 bits in micromemory are used in adder (next slide).
Adder • Input via buses 1 and 2. • Output via bus 3. • Example: - If signals 1, 6, and 14 turned on, then A+MDR MAR. - If signal 9 is on as well, then ...
Clock Phase & Control Signals During each phase only certain control signals are allowed to turn on, specified in the table: Clock Phase Control signals which can be turned on 1 1-8 2 9-14 3 15-16 4 17-22 5 The control signals marked ''Phase 5''
Multiplication Microprogram • Multiply • contents of register C by contents of A • place result in main memory cell I • The algorithm set MDR to 0 repeat A times add C to MDR move 1 to MAR and set control signal to write
Sketch of a Microprogram for Multiplication Micro Mem. add. Microinstruction Explanation 0: 0+0 MDR; MPC+1MPC Initialize MDR (13, || 17, 22) 1: MPC+TESTZEROMPC Check if A is 0 (19, 22) 2: 5 MPC Yes: exist from loop (8, ||10, ||18) 3: C+MDRMDR; MPC+1 MPC No: add C to MDR (3, 6, || 13, || 17, 22) 4: A-1A; 0+1MPC Decrease A and go to top of loop (1, 5, 7, || 9, || 17) 5: 0+1MAR; write; MPC+1 MPC Write product into cell 1 (5, || 14, ||16, || 17, 22)
Sketch of a Microprogram for Multiplication Exercise: Given A=2 and C=4, follow the execution of the above microprogram
Analysis of the Algorithm • Notice the loop executes A times (worst case: the register for A is n bits, then 2n – 1 execution) • Is there any faster way? Yes, use shift left. (For the Algorithm see Page 158 of the book)
Summary • Control Logic • How to execute Microinstruction in Microprograms • Implementing & analysing multiplication as a Microprogram