Micro Program Examples in Computer Architecture YASH PAL, March 3, 2026March 3, 2026 Micro Program Examples in Computer Architecture – The configuration of a digital computer and its microprogrammed control unit is established; the designer’s task is to generate the microcode for the control memory. This code generation is called microprogramming and is a process of conventional machine language programming. Computer Hardware Configuration Here is the block diagram of the computer hardware configuration in the figure below. computer hardware configuration It consists of two memory units: A main memory which stores the instructions and data, and a control memory which stores the microprogram. 6 registers are used: 4 processor units register namely: {AC (accumulator), PC(Program Counter), AR(Address Register), DR(Data Register)} 2 Control unit register, namely: {CAR (Control Address Register), SBR(Subroutine Register)} The transfer of information among the registers in the processor is done through multiplexers rather than a common bus. DR can receive information from AC, PC, and memory. AR can receive information from PC or DR. PC can receive information only from AR. The arithmetic, logic, and shift unit performs micro-operations with data from AC and DR and places the result in AC. Input data written to memory comes from DR, and data read from memory can go only to DR. Microinstruction Format The microinstruction format for the control memory is shown in the figure below. F1 (3 bit)F2 (3 bit)F3 (3 bit)CD (2 bit)BR (2 bit)AD (7 bit)Microinstruction format F1, F2, F3: Micro-operation fieldsCD: Condition for branchingBR: Branch fieldAD: Address field The 20 bits of the microinstruction are divided into four functional parts as follows: The three fields F1, F2, and F3 specify microoperations for the computer. The microoperations are subdivided into three fields of three bits each. The three bits in each field are encoded to specify seven distinct microoperations. This gives a total of 21 microoperations. The CD (Conditional for branching) field selects status bit conditions. The BR (Branch field) field specifies the type of branch to be used. The AD (Address field) field contains a branch address. The address field is seven bits wide, since the control memory has 128= 27 words. Symbolic Microinstruction Each line of the assembly language microprogram defines a symbolic microinstruction. Each symbolic microinstruction is divided into five fields: label, microoperations, CD, BR, and AD. The fields are specified in the table given below. 1LabelThe label field may be empty or it may specify a symbolic address. A label is terminated with a colon (:).2MicrooperationsIt consists of one, two, or three symbols, separated by commas. There may be no more than one symbol from each F field. The NOP symbol is used when the microinstruction has no microoperations. This will be translated by the assembler to nine zeros.3CDThe CD field has one of the letters U, I, S, or Z.4BRThe BR field contains one of the four symbols.5ADThe AD field specifies a value for the address field of the microinstruction in one of three possible ways:1. With a symbolic address, this must also appear as a label.2. With the symbol NEXT to designate the next address in sequence.3. When the BR field contains a RET or MAP symbol, the AD field is left empty and is converted to seven zeros by the assembler.Symbolic Microinstruction The Fetch Routine The control memory has 128 words, and each word contains 20 bits. To micro-program the control memory, it is necessary to determine the bit value of each of the 128 words. The first 64 words (addresses 0 to 63) are to be occupied by the routines for the 16 instructions. The last 64 words may be used for any other purpose. A convenient starting location for the fetch routine is address 64. The microinstructions needed for the fetch routine are: AR ← PC DR ← M[AR] PC ← PC + 1 AR ← DR(1-10) CAR(2-5) ← DR(11-14) CAR(0,1,6) ← 0 Symbolic Microprogram A symbolic microprogram can be translated into its binary equivalent by means of an assembler. Each line of the assembly language microprogram defines a symbolic microinstruction. The execution of the third (MAP) microinstruction in the fetch routine results in a branch to address 0xxxx00, where xxxx are the four bits of operation code. (– means no value in column/row) LabelMicrooperationsCDBRADADD:ORG0NOPREADADDORG4—IUU——CALLJMPJMP——INDRCTNEXTFETCH—BRANCHOVERNOPNOPNOPARTCPORG8SUIU—JMPJMPCALLJMP—OVERFETCHINDRCTFETCH—STORE:NOPACTDRWRITEORG12IUU—CALLJMPJMP—INDRECTNEXTFETCH—EXCHANGE:NOPREADACTDR, DRTACWRITEORG64IUUU—CALLJMPJMPJMP—INDRECTNEXTNEXTFETCH—FETCH:INDRCT:PCTARREAD, INCPCDRTARREADDRTARUUUUUJMPJMPMAPJMPRETNEXTNEXT—NEXT—Symbolic Microprogram (Partial) Binary Microprogram The symbolic microprogram is a convenient form for writing microprograms in a way that people can read and understand. But this is not the way that the microprogram is stored in memory. The symbolic microprogram must be translated to binary either by means of an assembler program or by the user if the microprogram is simple enough. Binary Microinstruction = F1, F2, F3, CD, BR, AD MicroRoutineAddressDecimalAddressBinaryF1F2F3CDBRADADD0123000000000000010000010000001100000000100000010000000000000000000001000000010000001000011000001010000001000000BRANCH4567891011000010000001010000110000011100010000001001000101000010110000000000000000001110000000000000000001010000000000000001100000000000001000010001000000000001000100000000001101000000100001110000001000011000101010000001000000EXCHANGE121314150001100000110100011100001111000001100111000000101000000000000000010000000010000001000011000111000011111000000FETCH646566100000010000011000010110000101000100000000101000000000000011100000110000100000000INDRT6768100001110001000001011000000000000000001010001000000000Binary microprogram for control memory (Partial) Computer System Architecture engineering subjects Computer System Architecture