Micro Code

Microcode is the encoding of what specific steps the computer should take to complete an instruction.

It is effectively a large combinational logic circuit where the inputs are the instruction byte, microcode step and flag bits and the outputs are the control signals to drive the modules. EEPROM chips are programmed and used to implement this combinational logic circuit. The same address is fed into 4 chips, differently programmed to get the 30 output bits.

Every instruction is comprised of up to six micro code steps. There are eight available but the first two are reserved for fetching the instruction byte itself. The steps are executed sequentially to perform the instruction. The microcode step counter controls the order of the sequence. The flags bits allow conditional operation based on a given instruction byte and step. An instruction can “surrender” it’s remaining steps and move onto the next instruction if it has completed all it’s necessary steps.

Address bits

The address bits for the EEPROM and their meanings are:

Bits Meaning
xxxxxxxx....... Instruction byte
........xxxx... Flags
............xxx Microcode step

Output bits

The output bits for the EEPROMs and their meanings (which will typically occur on the next rising data clock edge) are:

Bits Name Description
1....... ........ ........ ........ ACC_IN Enable input for the accumulator register.
.1...... ........ ........ ........ ACC_OUT Enable output for the accumulator register.
..1..... ........ ........ ........ A_IN Enable input for the A register.
...1.... ........ ........ ........ A_OUT Enable output for the A register.
....1... ........ ........ ........ B_IN Enable input for the B register.
.....1.. ........ ........ ........ B_OUT Enable output for the B register.
......1. ........ ........ ........ C_IN Enable input for the C register.
.......1 ........ ........ ........ C_OUT Enable output for the C register.
........ 1....... ........ ........ ALU_STORE_RESULT Store the current output of the ALU.
........ .1...... ........ ........ ALU_STORE_FLAGS Store the current flags of the ALU..
........ ..1..... ........ ........ ALU_OUT Enable output for the ALU.
........ ...1.... ........ ........ ALU_A_IS_BUS Set the A input of the ALU to be the bus (otherwise it is the content of the accumulator register).
........ ....1... ........ ........ ALU_S0 Set the S0 function select input on the ALU.
........ .....1.. ........ ........ ALU_S1 Set the S1 function select input on the ALU.
........ ......1. ........ ........ ALU_S2 Set the S2 function select input on the ALU.
........ .......1 ........ ........ ALU_S3 Set the S3 function select input on the ALU.
........ ........ 1....... ........ ALU_M Set the M input on the ALU.
........ ........ .1...... ........ ALU_C_IN Set the carry in input on the ALU.
........ ........ ..1..... ........ MAR_IN Enable input for the memory address register.
........ ........ ...1.... ........ RAM_IN Enable input for the RAM.
........ ........ ....1... ........ RAM_OUT Enable output for the RAM.
........ ........ .....1.. ........ RAM_SEL_PROG_MEM Retrieve data from program memory rather than data memory.
........ ........ ......1. ........ SP_IN Enable input for the stack pointer.
........ ........ .......1 ........ SP_OUT Enable output for the stack pointer.
........ ........ ........ 1....... PC_IN Enable input for the program counter.
........ ........ ........ .1...... PC_OUT Enable output for the program counter.
........ ........ ........ ..1..... PC_COUNT Increment the value stored in the program counter.
........ ........ ........ ...1.... IR_IN Enable input for the instruction register.
........ ........ ........ ....1... CU_STEP_RESET Reset the step counter in the control unit.
........ ........ ........ .....1.. CLOCK_HALT Halt the computer.