80 likes | 259 Views
Week 7. Microcode!!!. Microcode multiplication example. Microcode instructions are 22 bits long These are executed in a 5 phase cycle Phase 1: 1-8 Phase 2: 9-14 Phase 3: 15-16 Phase 4: 17-22 Phase 5: Control lines marked ‘Phase 5’. Microcode multiplication example.
E N D
Week 7 Microcode!!!
Microcode multiplication example • Microcode instructions are 22 bits long • These are executed in a 5 phase cycle • Phase 1: 1-8 • Phase 2: 9-14 • Phase 3: 15-16 • Phase 4: 17-22 • Phase 5: Control lines marked ‘Phase 5’
Microcode multiplication example • We have registers A,B, C etc • Instructions are stored in the Micro memory • Current instruction is stored in the MIR • MPC is used to specify which instruction to execute • We have an adder that can subtract and do shift left
Microcode multiplication example • We can do ‘TESTZERO’ on register A (1 if zero 2 if >0) • We have main memory accessible using the MDR for data and MAR for address, CS 15 and 16 used to specify read/write. • Buses are used to move data around.
Microcode multiplication example Task: Write a program to multiply the contents of register C by the contents of register A. The result is to be stored in location 1 of the main memory.
Microcode multiplication example The Algorithm: multiple { set MDR to 0 repeat A times add C to the MDR end repeat move 1 to the MAR and tell the main memory to write }
Microcode multiplication example The Program sketch: Address Instruction 0 0 + 0 -> MDR; MPC + 1 -> MPC 1 MPC + TESTZERO -> MPC 2 5 -> MPC 3 C + MDR -> MDR; MPC + 1 -> MPC 4 A - 1 -> A; 0 + 1 -> MPC 5 0 + 1 -> MAR; write; MPC + 1 -> MPC
Microcode multiplication example The Microcode program: