Micro Operations | Computer Architecture YASH PAL, October 8, 2025October 8, 2025 Micro Operations in Computer Architecture – A micro operation is an elementary operation executed on the information stored in one or more registers. A prespecified sequence of micro operations is performed on the stored information to complete a specified operation. The micro operations can be classified as follows: Arithmetic micro operation Logic micro operation hift micro operation Micro Operations Arithmetic micro operations Basic arithmetic micro operations are addition, subtraction, negate, increment and decrement. Multiplication and division are also valid arithmetic operations but not included in the basic set of micro operations. In most of the computer systems, the multiplication operation is implemented with a sequence of addition and shift micro operations. The division operation is implemented with a sequence of subtraction and shift micro operations. below table shows the basic arithmetic micro operations. Register transfer languageDescriptionR3 ← R1 + R2Sum of R1 and R2 is copied to R3R3 ← R1 – R2Difference of R1 and R2 is copied R3R3 ← R3 + 12’s complement the contents of R3 (negate)R1 ← R1 + 1Increment the contents of R1R1 ← R1 – 1Decrement the contents of R1Basic Arithmetic Micro Operations Above table shows that the basic micro operations are addition and subtraction. The increment and decrement micro-operations are symbolized by plus-one and minus-one operations, respectively. Following circuits can be used to implement various arithmetic micro-operations: Binary Adder Binary Adder/Subtraction Binary Increments Arithmetic Circuit Binary Adder The digital circuit that results the arithmetic sum of two binary number of any length is called binary adder. The binary adder can be designed with full adders connected in serial manner. In such type of design, the output carry of one full adder is tansferred to the input carry of the next full adder. below figure shows the 3 bit binary adder which is constructed with 3 full adders. 3 Bit Binary Adder Binary Adder/Subtractor The subtraction of binary number can be performed by taking the 2’s complement of second number and adding it to first number. The 2’s complement can be obtained by taking 1’s complement and adding one to the least significant bit. Whereas the addition of binary numbers can be done by performing direct addition operation as discussed in pervious section. The addition and subtraction operation can be combined into common circuit by including an Ex-OR gate with each full adder. A 3-bit adder/subtractor is shown in below figure. 3 Bit Adder/Subtractor Mode selection input, as shown in above figure, controls the operations. When mode selection input M=1, the circuit behaves as subtractor whereas for M=0, the circuit behaves as adder. Binary Incrementer The binary increment micro operation is defined as addition of one in a register. This can be achieved by means of half adders connected in serial manner. The block diagram of 3-bit binary incrementer is shown in below figure. 3 Bit Binary Incrementer Arithmetic Circuit The basic arithmetic micro operations listed in above table, can be implemented in one composite arithmetic circuit. The basic component of an arithmetic circuit is the full adders with the multiplexer circuits. The 4-bit arithmetic circuit is shown in below figure. 4-bit Arithmetic Circuit The 4-bit arithmetic circuit has four full adders to make a four bit adder. Four 4:1 multiplexers are used to choose different operations. There are two 4-bit inputs (A and B) and one 4 bit output (D). Each bit of input B is connected to the corresponding Y input of full adder through the multiplexer whereas each bit of input A is connected directly to X input of full adder. The output of the circuit is calculated from the following arithmetic sum. D = X+Y+Cin Here X input is always equals to A input wheres Y input can be B, B, 0 or 1 according to the selection lines (S1 and S0) of multiplexer. Cin is the input carrry which can be equal to 0 or 1. By controlling the value of selection lines and input carry it is possible to generate eight arithmetic micro operations shown in below table. S1S0CinYD = X+Y+CinMicro Operations000BD = A + BAddition001BD = A + B + 1Addition with carry010BD = A + BSubtraction with borrow011BD = A + B + 1Subtraction1000D = ATransfer A1010D = A + 1Increment A1101D = A – 1Decrement A1111D = ATransfer AFunctions for 4-bit arithmetic circuit When S1 S0 = 00 the output of multiplexer is B and applied to the Y input of full adder. if Cin = 0, the output D = A+B+0 (addition) and if Cin = 1, the output D = A+B+1 (addition with carry). When S1 S0 = 01 the output of multiplexer is B and applied to the Y input of full adder. if Cin = 0, the output D = A+B+0 = A+(B+1)-1 = A + (2’s complement of B) – 1 = A-B-1 (subtraction with borrow) and if Cin = 1, the output D = A+B+1 = A+(2’s complement of B) = A-B (subtraction). When S1 S0 = 10, the outputs of all multiplexers are 0 and applied to the Y inputs of all full adders. In Cin = 0, the output D=A + (0000)2 +0 = A (Transfer) and if Cin=1, the output D=A+(0000)2+1 = A+1 (Increment). When S1 S0 = 11, the output of all multiplexers are 1 and applied to the Y inputs of all full adders. If Cin = 0, the output D=A+(1111)2+0=A+(1’s complement of 0) + 1-1 = A+(2’s complement of 0)-1=A-0-1=A-1 (Decrement) and if Cin = 1, the output D=A+(1111)2+1 = A+(1’s complement of 0)+1=A+(2’s complement of 0) = A-0=A(Transfer). Note – The micro operation D = A (transfer) is generated two time, so there are only seven distinct micro operations in the arithmetic circuit. Logic Micro Operations The logic micro operations include the basic operations like AND, OR, EX-OR, NOT etc. These operations consider each bit of the register separately and treat them as binary variables. It means logic micro operations are bit wise micro operations. If there are two binary variables, 16 different logic micro operations can be performed on them. The sixteen logic micro operations are derived from the truth table of logic functions as shown in below table. The bit wise variables are represented by x (contents of register A) and y (Contents of register B). Each bit of the register is considered as a binary variable is micro operation is performed on the string of bits stored in the registers. All the sixteen logic micro operations are shown in below table. FunctionInput Bit VariablesInput Bit VariablesInput Bit VariablesInput Bit VariablesBooleanFunctionRegisterTransferLanguage(RTL)MicroOperationx yx yx yx y00011011F00000F0 = 0F ← 0CleanF10001F1 = xyF ← A ∧ BANDF20010F2 = xyF ← A ∧ BF30011F3 = xF ← ATransfer AF40100F4 = xyF ← A ∧ BF50101F5 = yF ← BTransfer BF60110F6 = x⊕yF ← A ⊕ BEx – ORF70111F7 = x+yF ← A ∨ BORF81000F8 = x+yF ← A ∨ BNORF91001F9 = x⊕yF ← A⊕BEx-NORF101010F10 = yF ← BComplement BF111011F11 = x+yF ← A ∨ BF121100F12 = xF ← AComplement AF131101F13 = x+yF ← A ∨ BF141110F14 = xyF ← A ∧ BNANDF151111F15 = 1F ← 1Set Hardware Implementation (Logic Circuit) Although there are sixteen logic micro-operation listed in above table but most of the digital systems use only four micro operations (AND, OR, Ex-OR and complement). Other micro operation can be derived from the combination of these four. One stage of logic circuit is shown in below figure. One Stage of Logic Circuit S1S0OutputOperation00F = A ∧ BAND01F = A ∨ BOR10F = A⊕BEx-OR11F ← AComplementOne stage of logic circuit functional table When S1S0=00, the input I0 will be at the output of multiplexer. Hence Fi=I0=Ai ∧ Bi (AND). When S1S0=01, the input I1 will be at the output of multiplexer. Hence Fi=I1=Ai ∧ Bi (OR). When S1S0=10, I2 input will be available at the output of multiplexer. Hence Fi=Ai ⊕ Bi (Ex-OR). In the same manner, when S1S0=11, I3, input will be at output of multiplexer. Hence Fi=A (complement of A). Logic Circuit Application The logic micro operations are executed on the individual bits of the data stored in register. The logic micro operations are rarely used in scientific computations, but they are useful for bit manipulation of binary data and for making logical decisions. It means, logic micro operations can be used to change bit values, delete a group of bits or insert new bit values into a register. Therefore, a logic circuit can be used for the following operations. Selective Set Selective Reset Selective Complement Selective Insert Selective Set – The selective set operation sets (makes high) the selectid bits of a register. Consider a register A which is containing the data. This operation sets the bits in register A where there are corresponding 1’s in other register B. It does not effect bit positions that have 0’s in register B. The truth table for selective set operation is given in below table. Bit of Register A(Before)CorrespondingBit of Register BBit of Register A(After)Operation000No Change011Set101No Change111SetSelective Set operation truth table From the above truth table, it can be noticed that the bits of register A after the operation are obtained from the logic-OR operation of bits in register B and previous values of register A. Therefore, the OR micro operation can be used to selective set bits of a register. Numeric example: 10110110 – Register A (Before)01101110 – Register B————————11111110 – Register A (After)———————– Selective Reset (Mask) – The selective reset operation resets (makes low) the selected bits of a register. Consider a register, which is containing the original data. This operation resets, the bits in register A where there are corresponding 0’s in other register B. It does not affect bit positions in register A that have corresponding 1’s in register B. The truth table for selective reset operation is shown in below table. Bit of Register A(Before)CorrespondingBit of Register BBit of Register A(After)Operation000Reset010No change100Reset111No changeSelective reset operation truth table From the above truth table, it can be noticed that the bits of register A after the operation are obtained from the logic-AND operation of bits in register B and previous values of register A. Therefore, the AND micro operation can be used to selective set bits of a register. Numeric example: 10110110 – Register A (Before)01101110 – Register B————————00100110 – Register A (After)———————– Selective Complement – The selective complement operation complements the selected bits of a register. Consider a register A which is containing the data. This operation complements the bits of register A where there are corresponding 1’s in other register B. It does not make any change the bit positions that have 0’s in register B. The below table shows the truth table for selective complement opeation. Bit of Register A(Before)CorrespondingBit of Register BBit of Register A(After)Operation000No change011Complement101No change110ComplementSelective complement opereational truth table It can be seen from the above truth table that the bits of register A after the operation are obtained from the logic Ex-OR operation of bits in register B and previous values in register A. Therefore the Ex-OR micro operation can be used to selective complement bits of a register. Numeric example: 1011 0110 – Register A (Before)0110 1110 – Register B————————0010 0110 – Register A (After)———————– Selective Insert – The selective insert operation inserts a new value into a group of bits. This operation is combination of selective reset and selective set operations. This is performed by first selective reset the bits and selective set them with the required value. Numeric example: – Let, in group of eight bits (stored in register A) four most significant bits are required to be 1001. Step-I 1011 0110 – Register A (Before)0000 1111 – Register B————————0000 0110 – Register A (After selective reset)———————– Step-II 0000 0110 – Register A (Before)1001 0000 – Register B————————1001 0110 – Register A (After selective reset)———————– Shift Micro Operation Shift micro operations are used for serial transfer of data. The contents of a register can be shifted to the left or to the right in different ways. There are three types of shifts: Logical Shift Circular Shift Arithmetic Shift. Logical Shift The logical shift inserts 0 through the serial input. The symbols shl (Shift left) and shr (Shift right) are used. Below figure shows the examples of logical shift. Logical shift example The above two micro operations specify a 1 bit shift to the left of the contents of register A and a 1-bit shift to the right of the contents of register B. The bit inserted to the end position is to be 0 during logical shift. Circular Shift The circular shift rotates the bits of register around the two ends without loss of information. This is also known as rotate operation. Symbols cil (circular left shift) and cir (circular right shift) are used for circular shift. Below figure shows the example of circular shift. Circular shift example The above micro operations, circulate the contents of register A in left direction (1-bit) and content of register B in right direction (1-bit) without loss of information. In circular left shift, the most significant bit will be copied to least significant bit position whereas in circular right shift the least significant bit will be copied to most significant bit position. Arithmetic Shift An arithmetic shift is a micro operation that shifts a signed binary number to the left or right. An arithmetic shift left multiplies a signed binary number by 2. An arithmetic shift right divides the number by 2. The sign of the number remains unchanged after arithmetic shift. The symbols ashl (arithmetic shift left) and ashr (arithmetic shift right) are used for arithmetic shift. The examples of arithmetic shift are shown in below figure. Arithmetic shift examples The above micro operation shows in figure perform arithmetic shift left to the contents of register A. This inserts a 0 into A0, and shift all other bits to the left. If An-1, and An-2 are not same, an error may occur. In the micro operation shows in above figure, the arithmetic shift leaves the sign bit unchanged and the same Bn-2 receives the bit from Bn-1, and so on. The bit in B0, is lost. Hardware Implementation (shifter Circuit) RTLMicro OperationDescriptionA ← shl AShift left register AContents of A shift left by 1-bit position. A ‘0’ is inserted at right most bit. Left most bit is lost.A ← shr AShift right register AContents of A shift right by 1-bit position. A ‘0’ is inserted at left most bit. Right most bit is lost.A ← cil ACircular shift left register AThe contents of register A circularly shifted left by 1-bit position. The left most bit goes into the right most bit.A ← cir ACircular shift right register AContents of register A are circularly shifted right by 1-bit position, the right most bit goes into left most bit.A ← ashl AArithmetic shift left register AShifts contents of A left by 1-bit position. ‘0’ is inserted at the right most bit position, the sign bit receives the most significant bit.A ← ashr AArithmetic shift right register AShifts contents of A right by 1-bit position. The sign bit is circulated in at the left most bit position.Shift micro operations The shift micro operations given in above table can be implemented using the circuit shown in below figure. This is a 4-bit shifter, which has four data inputs A0 to A3, and four data outputs F0 to F3. There are two serial inputs, one for shift left (IL) and the other for shift right (IR). When S=0, the input data are shifted right and when S=1, the input data are shifted left. The function table is also shown in below figure. Shifter circuit logic diagram Select Input (S)Output F0Output F1Output F2Output F30 (Shift right)IRA0A1A21 (Shift left)A1A2A3IL Computer System Architecture engineering subjects Computer System Architectureengineering subjects