Blog

Micro-operations

Micro-Operations: The operations performed on the data stored inside the registers are called micro-operations.

There are four categories of the most common micro operations:

  • Register transfer: transfer binary information from one register to another.
  • Arithmetic: perform arithmetic operations on numeric data stored in registers.
  • Logic: perform bit manipulation operations on non-numeric data stored in registers.
  • Shift: perform shift operations on data stored in registers.

Register Transfer Microoperations

Designate computer registers by capital letters to denote its function. The register that holds an address for the memory unit is called MAR. The program counter register is called PC. IR is the instruction register and R1 is a processor register. The individual flip-flops in an n-bit register are numbered in sequence from 0 to n-1. Refer to Figure below for the different representations of a register.

Block Diagram of a Register

Normally, we want the transfer to occur only under a predetermined control condition. This can be shown by means of an if-then statement. If (P = 1) then (R2 ← R1) where P is a control signal generated in the control section. It is sometimes convenient to separate the control variables from the register transfer operation by specifying a control function. A control function is a Boolean variable that is equal to 1 or 0. The control function is included in the statement as follows: P: R2 ← R1. The control condition is terminated with a colon. It symbolizes the requirement that the transfer operation be executed by the hardware only if P = 1. Every statement written in a register transfer notation implies a hardware construction for implementing the transfer. Figure below shows the block diagram that depicts the transfer from R1 to R2. The n outputs of register R1 are connected to the n inputs of register R2. The letter n will be used to indicate any number of bits for the register. It will be replaced by an actual number when the length of the register is known. Register R2 has a load input that is activated by the control variable P.

It is assumed that the control variable is synchronized with the same clock as the one applied to the register.

As shown in the timing diagram, P is activated in the control section by the rising edge of a clock pulse at time t. The next positive transition of the clock at time t + 1 finds the load input active and the data inputs of R2 are then loaded into the register in parallel. P may go back to 0 at time t + 1; otherwise, the transfer will occur with every clock pulse transition while P remains active. Note that the clock is not included as a variable in the register transfer statements. It is assumed that all transfers occur during a clock edge transition. Even though the control condition such as P becomes active just after time t, the actual transfer does not occur until the register is triggered by the next positive transition of the clock at time t + 1. The basic symbols of the register transfer notation are listed in Table below. 

Registers are denoted by capital letters, and numerals may follow the letters. Parentheses are used to denote a part of a register by specifying the range of bits or by giving a symbol name to a portion of a register. The arrow denotes a transfer of information and the direction of transfer. A comma is used to separate two or more operations that are executed at the same time. The statement T: R2 ← R1, R1 ← R2 denotes an operation that exchanges the contents of two registers during one common clock pulse provided that T = 1. This simultaneous operation is possible with registers that have edge-triggered flip-flops.

Arithmetic Microoperations

The basic arithmetic micro operations are addition, subtraction, increment, decrement, and shift. Example of addition: R3 <– R1+R2

Subtraction is most often implemented through complementation and addition. Example of subtraction: R3 <– R1 +R2 + 1 (strikethrough denotes bar on top – 1‟s complement ofR2).

Adding 1 to the 1’s complement produces the 2’s complement. Adding the contents of R1 to the 2’s complement of R2is equivalent to subtracting. Multiply and divide are not included as micro operations. A micro operation is one that can be executed by one clock pulse Multiply (divide) is implemented by a sequence of add and shift micro operations (subtract and shift).

To implement the add micro operation with hardware, we need the registers that hold the data and the digital component that performs the addition. A full-adder adds two bits and a previous carry. A binary adder is a digital circuit that generates the arithmetic sum of two binary numbers of any length. A binary adder is constructed with full-adder circuits connected in cascade. An n-bit binary adder requires n full-adders.

4-bit Binary Adder

Get the 2’s complement by adding 1. Add the result to A. The addition and subtraction operations can be combined into one common circuit by including an XOR gate with each full-adder. The increment micro operation adds one to a number in a register. This can be implemented by using a binary counter – every time the count enable is active, the count is incremented by one. If the increment is to be performed independent of a particular register, then use half-adders connected in cascade. An n-bit binary incrementer requires n half-adders. Each of the arithmetic micro operations can be implemented in one composite arithmetic circuit. The basic component is the parallel adder Multiplexers are used to choose between the different operations. The output of the binary adder is calculated from the following sum: D = A + Y + Cin.

Logic Microoperations

Logic operations specify binary operations for strings of bits stored in registers. These operations consider each bit of the register separately and treat them as binary variables.

For example, the exclusive-OR microoperation with the contents of two registers R 1 and R2 is symbolized by the statement P: R1 ← R1 ⊕ R2.

It specifies a logic microoperation to be executed on the individual bits of the registers provided that the control variable P = 1. As a numerical example, assume that each register has four bits. Let the content of R1 be 1010 and the content of R2 be 1100. The exclusive-OR microoperation stated above symbolizes the following logic computation:

The content of R1, after the execution of the microoperation, is equal to the bit-by-bit exclusive-OR operation on pairs of bits in R2 and previous values of R1. The logic microoperations are seldom used in scientific computations, but they are very useful for bit manipulation of binary data and for making logical decisions.

Special symbols will be adopted for the logic microoperations OR, AND, and complement, to distinguish them from the corresponding symbols used to express Boolean functions. The symbol V will be used to denote an OR microoperation and the symbol ∧ to denote an AND microoperation. The complement microoperation is the same as the 1’s complement and uses a bar on top of the symbol that denotes the register name. By using different symbols, it will be possible to differentiate between a logic microoperation and a control (or Boolean) function. The + sign has two different meanings: logical OR and summation. When + is in a microoperation, then summation. When + is in a control function, then OR.

For example: In the statement P + Q: R1 ← R2 + R3, R4 ← R5 ∨ R6 the + between P and Q is an OR operation between two binary variables of a control function. The + between R2 and R3 specifies an add microoperation. The OR microoperation is designated by the symbol V between registers R5 and R6.

There are 16 different logic operations that can be performed with two binary variables. The hardware implementation of logic microoperations requires that logic gates be inserted for each bit or pair of bits in the registers. All 16 microoperations can be derived from using four logic gates. They can be determined from all possible truth tables obtained with two binary variables as shown in Table below.

In this table, each of the 16 columns F0 through F15 represents a truth table of one possible Boolean function for the two variables x and y.

Note that the functions are determined from the 16 binary combinations that can be assigned to F. The 16 Boolean functions of two variables x and y are expressed in algebraic form in the first column of Table below. The 16 logic microoperations are derived from these functions by replacing variable x by the binary content of register A and variable y by the binary content of register B. It is important to realize that the Boolean functions listed in the first column of Table below represent a relationship between two binary variables x and y. The logic microoperations listed in the second column represent a relationship between the binary content of two registers A and B. Each bit of the register is treated as a binary variable and the microoperation is performed on the string of bits stored in the registers.

Hardware Implementation

The hardware implementation of logic microoperations requires that logic gates be inserted for each bit or pair of bits in the registers to perform the required logic function. Although there are 16 logic microoperations, most computers use only four-AND, OR, XOR (exclusive-OR), and complement from which all others can be derived. Figure below shows one stage of a circuit that generates the four basic logic microoperations. It consists of four gates and a multiplexer. Each of the four logic operations is generated through a gate that performs the required logic. The outputs of the gates are applied to the data inputs of the multiplexer. The two selection inputs S1 and S0 choose one of the data inputs of the multiplexer and direct its value to the output. The diagram shows one typical stage with subscript i. For a logic circuit with n bits, the diagram must be repeated n times for i = 0, 1, 2, … , n – 1. The selection variables are applied to all stages. The function table in Fig. below lists the logic microoperations obtained for each combination of the selection variables.

Logic microoperations are very useful for manipulating individual bits or a portion of a word stored in a register. They can be used to change bit values, delete a group of bits, or insert new bit values into a register. 

Shift Microoperations

Shift microoperations are used for serial transfer of data. They are also used in conjunction with arithmetic, logic, and other data- processing operations. There are three types of shifts: logical, circular, and arithmetic. A logical shift is one that transfers 0 through the serial input. The symbols shl and shr are for logical shift-left and shift-right by one position.

 For example:

The circular shift circulates the bits of the register around the two ends without loss of information. The symbols cil and cir are for circular shift left and right. The symbolic notation for the shift microoperations is shown in Table below.

Micro-Operations - Tutorial And Example

An arithmetic shift is a microoperation 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. Arithmetic shifts must leave the sign bit unchanged because the sign of the number remains the same.

A sign reversal occurs if the bit in Rn-1 changes in value after the shift. This happens if the multiplication by 2 causes an overflow. An overflow occurs after an arithmetic shift left if initially, before the shift, Rn-1 is not equal to Rn-2. An overflow flip-flop Vs, can be used to detect an arithmetic shift-left overflow. Vs = Rn-1 ⊕ Rn-2. If Vs = 0, there is no overflow, but if Vs = 1, there is an overflow and a sign reversal after the shift. Vs must be transferred into the overflow flip-flop with the same clock pulse that shifts the register.

Leave a Reply

Your email address will not be published. Required fields are marked *