These are the low-level building blocks of a digital computer.
The operations on the data in registers are called microoperations.
Examples of micro-operations are
– Shift
– Load
– Clear
– Increment
Introduction to Microoperation
Alternatively we can say that an elementary operation performed during one clock pulse on the information stored in one or more registers is called micro-operation. f: shift, load, clear, increment, add, subtract, complement ,and, or, xor, … The result of the operation may replace the previous binary information of the resister or may be transferred to another resister.
Register transfer language can be used to describe the (sequence of) micro-operations.
Register Transfer Language
It is an algebraic notation used to define machine level operations. Rather than specifying a digital system in words, a specific notation is used, register transfer language.
It is not executed by computer.
It is used to explain how computer works.
For any function of the computer, the register transfer language can be used to describe the (sequence of) microoperations.
Register transfer language
– A symbolic language
– A convenient tool for describing the internal organization of digital computers
– Can also be used to facilitate the design process of digital systems.
Microoperation Types
The microoperations most often encountered in digital computers are classified into 4 categories:1. Register transfer microoperations
2. Arithmetic microoperations
3. Logic microoperations
4. Shift microoperations
The symbolic notation used to describe the microoperation transfer among registers is called a register transfer language.>br> Registers are designated by capital letters, sometimes followed by numbers (e.g., A, R13, IR).>br> Often the names indicate function:>br>MAR Memory Address Register>br> PC Program Counter>br>IR Instruction Register>br> Information transfer from one register to another is described in symbolic form by replacement operator.>br> The statement “R2 R1” denotes a transfer of the content of the R1 into resister R2.>br> Control Function>br> Often actions need to only occur if a certain condition is true.>br> In digital systems, this is often done via a control signal, called a control function.>br>Example: P: R2 R1 i.e. if (P = 1) then (R2 R1)>br>Which means “If P = 1, then load the contents of register R1 into register R2>br> If two or more operations are to occur simultaneously, they are separated with commas.
Example: P: R3 R5, MAR IR
Arithmetic Microoperations
The basic arithmetic microoperations are– Addition
– Subtraction
– Increment
– Decrement
The additional arithmetic microoperations are
– Add with carry
– Subtract with borrow
– Transfer/Load
Table:Summary of Typical Arithmetic Micro-Operations
Binary Adder
The digital circuit that generates the arithmetic sum of two binary numbers of any lengths is called Binary adder. The binary adder is constructed with the full-adder circuit connected in cascade, with the output carry from one full-adder connected to the input carry of the next full-adder.
An n-bit binary adder requires n full-adders. The output carry from each full-adder is connected to the input carry of the next-high-order-full-adder. Inputs A and B come from two registers R1 and R2.
Binary Subtraction
The subtraction A – B can be done by taking the 2's complement of B and adding to A. It means if we use the inverters to make 1’s complement of B (connecting each Bi to an inverter) and then add 1 to the least significant bit (by setting carry C0 to 1) of binary adder, then we can make a binary subtractor.
Binary Adder-Subtractor
How binary adder and subtractor can be accommodated into a single circuit? explain. The mode input M controls the operation.
When M=0, the circuit is an adder and when M=1 the circuit becomes a subtractor.
Each exclusive-OR gate receives input M and one of the inputs of B.
When M=0: B ⊕ M = B ⊕ 0 = B, i.e. full-adders receives the values of B, input carry is B and circuit performs A+B.
When M=1: B ⊕ M = B ⊕ 1 = B' and C0= 1, i.e. B inputs are all
complemented and 1 is added through the input carry.
The circuit performs A + (2's complement of B).
Arithmetic Microoperation
Binary Incrementer
The increment microoperation adds one binary value to a number in a register.For example, if a 4-bit register has a binary value 0110, it will go to 0111 after it is incremented.
Increment microoperation can be done with a combinational circuit (half- adders connected in cascade) independent of a particular register.
One of the inputs to the least Significant Half Adder is connected to logic 1 and the other input is connected to least significant bit of number to be incremented
Arithmetic Circuit
The arithmetic microoperations can be implemented in one composite arithmetic circuit. By controlling the data inputs to the adder (basic component of an arithmetic circuit), it is possible to obtain different types of arithmetic operations. In the circuit below contains:
4 full-adders
4 multiplexers (controlled by selection inputs S0 and S1)
Two 4-bit inputs A and B and a 4-bit output D
Input carry Cin goes to the carry input of the full-adder.
Output of the binary adder is calculated from the arithmetic sum:
D = A + Y + Cin
By controlling the value of Y with the two selection inputs S1 & S0 and making Cin = 0 or 1, it is possible to generate the 8 arithmetic microoperations listed in the table below:
Arithmetic Microoperations
• Arithmetic circuit Operation mechanism: When S1S0=00, the value of B is applied to Y inputs of adder. If Cin=0, Output D=A+B. If Cin=1, Output D=A+B+1.Both cases perform add operation with or without carrying input carry.
When S1S0=01, the complement of B is applied to Y inputs of adder. If Cin=0, Output D=A+B’; this is equivalent to a subtract with borrow(A-B-1).If Cin=1, Output D=A+B’+1; which is equivalent to a subtraction of A-B.
When S1S0=10, the inputs from B are neglected and instead all 0’s are inserted to Y inputs. The Output becomes D=A+0+Cin.This gives D=A when Cin=0 and D=A+1 when Cin=1.In the first case there is direct transfer from input A to output D. In the second case value of A is incremented by 1.
When S1S0=11, all 1’s are inserted into Y inputs of the adder to produce the decrement operation D=A-1 when Cin=0.When Cin=1 then D=A-1+1=A, which causes a direct transfer from input A to output D.
Logic Microoperations
• What do you mean by Logic microoperations? Explain with its applications.• How Logic microoperations can be implemented with hardware?
Logic microoperations are bit-wise operations, i.e., they work on the individual bits of data.
Useful for bit manipulations on binary data and for making logical decisions based on the bit value.
There are, in principle, 16 different logic functions that can be defined over two binary input variables.
However, most systems only implement four of these
– AND (^), OR (٧), XOR (⊕), Complement/NOT
The others can be created from combination of these four functions.
Hardware implementation
Hardware implementation of logic microoperations requires that logic gates be inserted for each bit or pair of bits in the resisters to perform the required logic operation. Although there are 16 logic microoperations, most computers use only four- AND,OR,XOR and complement from which all others can be derived.Applications of Logic Microoperations
Logic microoperations can be used to manipulate individual bits or a portion of a word in a register. Consider the data in a register A. Bits of register B will be used to modify the contents of A.
– Selective-set A A + B
– Selective-complement A A ⊕ B
– Selective-clear A A • B’
– Mask (Delete) A A • B
– Clear A A ⊕ B
– Insert A (A • B) + C
– Compare A A ⊕ B
Selective-set
In a selective set operation, the bit pattern in B is used to set certain bits in A Therefore OR Microoperation can be used to selectively set bits of a register.
If a bit in B is set to 1, that same position in A gets set to 1, otherwise that bit in A keeps its previous value. It does not affect the bit positions that have 0’s in B.
Selective-complement
In a selective complement operation, the bit pattern in B is used to complement certain bits in A If a bit in B is set to 1, that same position in A gets complemented from its original value, otherwise it is unchanged. The exclusive OR operation can be used to selectively complement bits of a register.
Selective-clear
In a selective clear operation, the bit pattern in B is used to clear certain bits in A. If a bit in B is set to 1, that same position in A gets set to 0, otherwise it is unchanged.
Mask Operation In a mask operation, the bit pattern in B is used to clear certain bits in A.
If a bit in B is set to 0, that same position in A gets set to 0, otherwise it is unchanged. This is achieved logically ANDing corresponding bits of A and B. The mask operation is similar to selective clear operation except that the bits of A are cleared only when there is ccorresponding 0’s in B.
Clear Operation
In a clear operation, if the bits in the same position in A and B are the same, they are cleared in A, otherwise they are set in A. This operation is achieved by exclusive OR Microoperation. Insert Operation
An insert operation is used to introduce a specific bit pattern into A register, leaving the other bit positions unchanged. This is done as
– A mask (ANDing) operation to clear the desired bit positions, followed by
– An OR operation to introduce the new bits into the desired positions
– Example
o Suppose you wanted to introduce 1010 into the low order four bits of
Question: What do you mean by shift microoperations ? Explain its types.
Question: Is there a possibility of Overflow during arithmetic shift? If yes, how it can be detected?
Shift microoperations are used for serial transfer of data.
They are also used in conjunction with arithmetic, logic and other data processing operations.
The contents of a resister can be shifted left or right. There are three types of shifts
1. Logical shift
2. Circular shift
3. Arithmetic shift
A logical shift is one that transfers 0 through the serial input. In a Register Transfer Language, the following notation is used
– shl for a logical shift left
– shr for a logical shift right
Examples: R2 shr R2
R3 shl R3
Circular Shift
Circular shift also known as a rotate operation. Circular-shift circulates the bits of the resister around the two ends without the loss of information.
This is accomplished by connecting the serial output of the shift register to its serial input.
In a RTL, the following notation is used
cil for a circular shift left
cir for a circular shift right
Examples:
R2 cir R2
R3 cil R3
Arithmetic Shift
An arithmetic shift is meant for signed binary numbers (integer) to the left or right. An arithmetic shift left multiplies a signed number by 2 and an arithmetic shift right divides a signed number by 2.
Arithmetic shifts must leave the sign bit unchanged because the sign of the number remains the same when it is multiplied or divided by 2.
The left most bit in a resister holds a sign bit and remaining hold the number.
The sign bit is 0 for positive and 1 for negative. Negative numbers are in 2's complement form.
In a Resister Transfer Language, the following notation is used
– ashl for an arithmetic shift left
– ashr for an arithmetic shift right
– Examples:
» R2 ashr R2
» R3 ashl R3
Arithmetic shift-right
Arithmetic shift-right leaves the sign bit unchanged and shifts the number (including a sign bit) to the right. Thus Rn-1 remains same; Rn-2 receives input from Rn-1 and so on for the other bits in the register. The bit in R0 is lost.
Arithmetic shift-left
Arithmetic shift-left inserts a 0 into R0 and shifts all other bits to left. Initial bit of Rn-1 is lost and replaced by the bit from Rn-2.
Overflow case during arithmetic shift-left:
If a bit in Rn-1 changes in value after the shift, sign reversal occurs in the result.
This happens if the multiplication by 2 causes an overflow.
Thus, left arithmetic shift operation must be checked for the overflow:
an overflow occurs after an arithmetic shift-left if before shift Rn-1 ≠ Rn-2.
Overflow case during arithmetic shift-left
An overflow flip-flop V can be used to detect an arithmetic shift- left overflow.
V = Rn-1 ⊕ Rn-2
If V = 0, there is no overflow but if V = 1, overflow is detected.
Hardware implementation of shift Microoperations
A combinational circuit shifter can be constructed with multiplexers as shown below:
Hardware implementation of shift Microoperation
It has 4 data inputs A0 through A3 and 4 data outputs H0 through H3. There are two serial inputs, one for shift-left (IL) and other for shift-right (IR).
When S = 0; input data are shifted right (down in fig).
When S = 1; input data are shifted left (up in fig).
Q) What is the value of output H if Input A is 1001,S=1,IR=1 and IL=0?
• This is a common operational unit called arithmetic logic unit (ALU).
• To perform a microoperation, the contents of specified registers are placed in the inputs of the common ALU.
• The ALU performs the operation and transfer result to destination resister.
• A particular microoperation is selected with inputs S1 and S0.
• A 4x1 MUX at the output chooses between an arithmetic output in Di and logic output Ei.
• Other two inputs to the MUX receive inputs Ai-1 for right-shift operation and Ai+1 for left-shift operation.
• The diagram shows just one typical stage. The circuit must be repeated n times for an n-bit ALU.
• This circuit provides 8 arithmetic operations, 4 logic operations and 2 shift operations.
• Each operation is selected with five variables S3, S2, S1, S0 and Cin.
• The input carry Cin is used for arithmetic operations only.
• Table below lists the 14 operation of the ALU.
0 Comments