# How to Identify which instructions are represented by this microcode

I'm having issues with a question how to identify which instruction are represented by this microcode. The pc starts at 5000 and 7000 and 7001 have values 31 and 64 - I'm really confused how to approach this wouldn't each line be an instruction?

 MAR = PC, PC+1, Assert MAR
IR = MBR, decodes IR
put addr 7000 into MAR, Assert MAR
Move MBR to R1
MAR = PC, PC+1, Assert MAR
IR = MBR, decodes IR
put addr 7001 into MAR, Assert MAR
Move MBR to R2
MAR = PC, PC+1, Assert MAR
IR = MBR, decode IR
R1 = R1 + R2
MAR = PC, PC+1, Assert MAR


## 1 Answer

Microcode instruction sets typically have more fields than ordinary instruction sets.

Sometimes this is called wide word, as a very long instruction can offer access to multiple hardware components in the same cycle for many operations to be performed in parallel.

In simpler microcoded systems, instead of being wide in the extreme, the numerous (smaller) fields offer access to simple operations (though still in parallel), like read from memory, write, transfer one register to another, etc..

We also generally won't see overlapping fields in microcoded instruction sets, like we do with normal instruction sets. Look at MIPS for example, which has half a dozen different instruction forms, like J-type and R-type where the fields overlap and the hardware decides how the fields are to be interpreted based on the instruction type.

In microcode, you just use the fields you need in each microcoded instruction, instead of choosing a different instruction type. This keeps the micro-machine simpler, at an expense of either needing a wider microcoded instruction set, or having fewer micromachine features, like fewer micromachine registers and/or hardware units (like adders).

Because of the large number of instruction fields in each microcoded instruction, we can expect multiple operations per instruction.

In your example, I think we can assume the following are all encoded in a single instruction:

MAR = PC       // transfer PC to address bus
PC = PC + 1    // increment PC register
IR = MBR       // transfer data bus to IR register
Assert MR      // assert memory read


And it looks like the "put addr 7000 into MAR, Assert MAR" is a programming comment associated with this instruction.

N.S. Matloff has a description of a 32-bit microcoded instruction set that looks roughly like what you're showing. You can see the large number of fields, and also that by comparison to a normal instruction set. There are fields of the instruction for branching, fields for alu operation, register source & target, memory access, etc.. These fields exist in every instruction; there are no overlapping fields as there is only one instruction type.

• so there would only be 1 instruction? – rahulchawla Feb 1 '18 at 4:13
• I believe that each PC = PC + 1 is in a different instruction. I think that R1 = R1 + R2 is also in its own instruction since the same ALU is being shared by that and by PC = PC + 1. Looks to me like there might be 5 instructions here in total. – Erik Eidt Feb 1 '18 at 4:46
• so there are 4 instructions of pc=pc+1 and 1 instruction r1=r1+r2? correct me if I'm wrong and thank you for the insight – rahulchawla Feb 1 '18 at 6:24
• I believe so: the instructions that advance the program counter are consuming bytes(?) from stream of the regular instruction set. The r1 += r2 is performing a addition that I suspect to have been requested by the regular instruction set (that prior microcode is not shown), maybe as an add or as an addressing mode computation. Also not shown is using r1 for some useful purpose after the addition... – Erik Eidt Feb 1 '18 at 16:07