Micro Programming 1
First we review the structure of a micro instruction:
Micro Instructions
Micro instructions are designed to control the data flow. Each 32 bit micro instruction defines all
the control signals of the Level 1 Machine, thus controlling an operation (one complete cycle) of the processor.
The data structure of a micro instruction is as follows:
| Bit | 31 | 30,29 | 28,27 | 26,25 | 24 | 23 | 22 | 21 | 20 | 19,18,17,16 | 15,14,13,12 | 11,10,9,8 | 7,6,5,4,3,2,1,0 |
| Signal | AMUX | COND | ALU | Shift | MBR | MAR | RD | WR | ENC | C Bus | B Bus | A Bus | ADDR |
| Value | 0:Alatch | 0:No jump | 0:A+B | 0:No shift | 0:No | 0:No | 0:No | 0:No | 0:No | ||||
| 1:MBR | 1:Jump if N=1 | 1:A&B | 1:shift right | 1:Yes | 1:Yes | 1:Yes | 1:Yes | 1:Yes | |||||
| 2:Jump if Z=1 | 2:A | 2:shift left | |||||||||||
| 3:Jump always | 3:Not(A) | 3:(Not used) |
Micro Assembly Language (MAL) The following examples illustrates a symbolic language to help writing a micro program with the above 32 bit micro instruction:
| MAL Instruction | Micro Instruction | ||||||||||||
| 31 | 30,29 | 28,27 | 26,25 | 24 | 23 | 22 | 21 | 20 | 19..16 | 15..12 | 11..8 | 7..0 | |
| X | Cond | ALU | Shift | B | A | R | W | E | CBus | BBus | ABus | Addr | |
| mar:=pc; rd | 0 | 00 | 10 | 00 | 0 | 1 | 1 | 0 | 0 | 0000 | 0000 | 0000 | 00000000 |
| rd | 0 | 00 | 10 | 00 | 0 | 0 | 1 | 0 | 0 | 0000 | 0000 | 0000 | 00000000 |
| ir:=mbr | 1 | 00 | 10 | 00 | 0 | 0 | 0 | 0 | 1 | 0011 | 0000 | 0000 | 00000000 |
| pc:=pc+1 | 0 | 00 | 00 | 00 | 0 | 0 | 0 | 0 | 1 | 0000 | 0110 | 0000 | 00000000 |
| mar:=ir; mbr=:ac; wr | 0 | 00 | 10 | 00 | 1 | 1 | 0 | 1 | 0 | 0000 | 0011 | 0001 | 00000000 |
| alu:=a; if N then goto 11 | 0 | 01 | 10 | 00 | 0 | 0 | 0 | 0 | 0 | 0000 | 0000 | 1010 | 00001011 |
| ac:=inv(mbr) | 1 | 00 | 11 | 00 | 0 | 0 | 0 | 0 | 1 | 0001 | 0000 | 0000 | 00000000 |
| tir:=lshift(tir); if N then goto 19 | 0 | 01 | 10 | 10 | 0 | 0 | 0 | 0 | 1 | 0100 | 0000 | 0100 | 00010011 |
| ac:=band(ir,amask); goto 0 | 0 | 11 | 01 | 00 | 0 | 0 | 0 | 0 | 1 | 0001 | 1000 | 0011 | 00000000 |
| sp:=sp+(-1); rd | 0 | 00 | 00 | 00 | 0 | 0 | 1 | 0 | 1 | 0010 | 0010 | 0111 | 00000000 |
| tir:=lshift(ir+ir); if N then goto 69 | 0 | 01 | 00 | 10 | 0 | 0 | 0 | 0 | 1 | 0100 | 0011 | 0011 | 01000101 |
Micro Program 1 The following is the first part of the Micro Program of Tanenbaum's Machine:
| Line | MAL Instruction | Comment |
| 0 | mar:=pc; rd; | MAR<-PC, Read MEM |
| 1 | pc:=pc+1; rd; | PC<-PC+1, Read MEM |
| 2 | ir:=mbr; if N then goto 28; | if (Level 1)OPcode in IR is 1XXX jump to Line28 |
| 3 | tir:=lshift(ir+ir); if N then goto 19; | Copy Bit13.. of IR to TIR; if OPcode is 01XX jump to 19 |
| 4 | tir:=lshift(tir); if N then goto 11; | Copy Bit12.. of TIR to TIR; if OPcode is 001X jump to 11 |
| 5 | alu:=tir; if N then goto 9; | send TIR to ALU; if OPcode is 0001 jump to 9 |
| 6 | mar:=ir; rd; | start executing (Level 1)Machine Instruction "0000..." (LODD) |
| 7 | rd; | Read MEM |
| 8 | ac:=mbr; goto 0; | store the contents of MEM pointed by MAR to AC; |
| back to Line 0 | ||
| 9 | mar:=ir; mbr:=ac; wr; | start executing (Level1)Machine Instruction "0001..."(STOD) |
| 10 | wr; goto 0; | copy AC to MEM pointed by MAR; |
| back to Line 0 | ||
| 11 | alu:=tir; if N then goto 15; | if (Level 1)OPcode is 0011 jump to Line 15 |
| 12 | mar:=ir; rd; | start executing (Level 1)Machine Instruction "0010..."(ADDD) |
| 13 | rd; | read MEM |
| 14 | ac:=mbr+ac; goto 0; | add AC and the contents of MEM pointed by MAR, store it to AC |
| back to Line 0 | ||
| 15 | ... | ... |