Register Transfer and Micro-operations 1
Overview
Register Transfer Language
Register Transfer
Bus and Memory Transfers
Arithmetic Micro-operations
Logic Micro-operations
Shift Micro-operations
Arithmetic Logic Shift Unit
CSE 211
Logic Micro operations
Logic microoperations 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.
It specifies a logic microoperation to be executed
on the individual bits of the registers provided
that the control variable P = 1.
Register Transfer and Micro-operations 3
Logic Micro operations
CSE 211
Register Transfer and Micro-operations 4
Logic Microoperations
CSE 211
Register Transfer and Micro-operations 5
Hardware Implementation
Ai
0
Bi
1
4X1 Fi
MUX
2
3 Select
S1
S0
Function table
S1 S0 Output -operation
0 0 F=AB AND
0 1 F = AB OR
1 0 F=AB XOR
1 1 F = A’ Complement
CSE 211
Question
1. Design a hardware implementation to
perform 2 separate XOR and NAND logic
micro-operations.
2. Design a hardware implementation to
execute any 8 different logic micro-
operations.
Applications of Logic Microoperations
Logical microoperations are used for masking purposes.
The AND microoperation is used to mask bits of a register.
Logical microoperations are used to build arithmetic
circuits such as adders and subtracters.
They are formed by the combination of XOR, AND, and
OR for performing subtraction and addition operations.
Register Transfer and Micro-operations 8
Applications of Logic Microoperations
Logic micro operations can be used to manipulate individual bits or a
portions of a word in a register. They can be used to change bit values,
delete a group of bits, or insert new bit values into a register.
Consider the data in a register A. In another register, B, is bit data that
will be used to modify the contents of A
Selective-set AA+B
Selective-complement AAB
Selective-clear A A • B’
Mask (Delete) AA•B
Clear AAB
Insert A (A • B) + C
Compare AAB
CSE 211
Register Transfer and Micro-operations 9
Applications of Logic Microoperations
1. In a selective set operation, the bit pattern in B is used to set certain bits in A
1 1 0 0 At
1010 B
1 1 1 0 At+1 (A A + B)
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
2. In a selective complement operation, the bit pattern in B is used to
complement certain bits in A
1 1 0 0 At
1010 B
0 1 1 0 At+1 (A A B)
If a bit in B is set to 1, that same position in A gets complemented from its
original value, otherwise it is unchanged
CSE 211
Register Transfer and Micro-operations 10
Applications of Logic Microoperations
3. In a selective clear operation, the bit pattern in B is used to clear certain bits
in A
1 1 0 0 At
1010 B
0 1 0 0 At+1 (A A B’)
If a bit in B is set to 1, that same position in A gets set to 0, otherwise it is
unchanged
4. In a mask operation, the bit pattern in B is used to clear certain bits in A
1 1 0 0 At
1010 B
1 0 0 0 At+1 (A A B)
If a bit in B is set to 0, that same position in A gets set to 0, otherwise it is
unchanged
CSE 211
Register Transfer and Micro-operations 11
Applications of Logic Microoperations
5. 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
1 1 0 0 At
1010 B
0 1 1 0 At+1 (A A B)
CSE 211
Register Transfer and Micro-operations 12
Applications of Logic Microoperations
6. 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 operation to clear the desired bit positions, followed by
– An OR operation to introduce the new bits into the desired positions
– Example
• Suppose you wanted to introduce 1010 into the low order four bits of A:
• 1101 1000 1011 0001 A (Original)
1101 1000 1011 1010 A (Desired)
• 1101 1000 1011 0001 A (Original)
1111 1111 1111 0000 Mask
1101 1000 1011 0000 A (Intermediate)
0000 0000 0000 1010 Added bits
1101 1000 1011 1010 A (Desired)
CSE 211
Question
• Register A:1100 Register B:1010 After applying
Selective-Set on the given data, value of
register A is:
– 1001
– 0111
– 1000
– 0110
Question
• Register A:1100 Register B:1010 After applying
Selective-Clear on the given data, value of
register A is:
– 1001
– 0111
– 1000
– 0100
Question
• Register A:1100 Register B:1010 After applying
Selective-Mask on the given data, value of
register A is:
– 1001
– 0111
– 1000
– 0110
Question
• Register A:1100 Register B:1010 After applying
Selective-Complement on the given data,
value of register A is:
– 1001
– 0111
– 1000
– 0110
Question
• Register A:1100 Register B:1010 After applying
Selective-Complement on the given data,
value of register A is:
– 1001
– 0111
– 1000
– 0110
Register Transfer and Micro-operations 18
Shift Microoperations
• There are three types of shifts
– Logical shift
– Circular shift
– Arithmetic shift
• What differentiates them is the information that goes into the serial input
• A right shift operation
Serial
input
• A left shift operation
Serial
input
CSE 211
Register Transfer and Micro-operations 19
Logical Shift
• In a logical shift the serial input to the shift is a 0.
• A right logical shift operation:
0
• A left logical shift operation:
0
• 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
CSE 211
Register Transfer and Micro-operations 20
Circular Shift
• In a circular shift the serial input is the bit that is shifted out of the other
end of the register.
• A right circular shift operation:
• A left circular shift operation:
• 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
CSE 211
Register Transfer and Micro-operations 21
Arithmetic Shift
• An arithmetic shift is meant for signed binary numbers (integer)
• An arithmetic left shift multiplies a signed number by two
• An arithmetic right shift divides a signed number by two
• Sign bit : 0 for positive and 1 for negative
• The main distinction of an arithmetic shift is that it must keep the sign of
the number the same as it performs the multiplication or division
• A right arithmetic shift operation:
sign
bit
• A left arithmetic shift operation: 0
sign
bit
CSE 211
Register Transfer and Micro-operations 22
Arithmetic Shift
• An left arithmetic shift operation must be checked for the overflow
0
sign
bit
Before the shift, if the leftmost two
V bits differ, the shift will result in an
overflow
• In a RTL, the following notation is used
– ashl for an arithmetic shift left
– ashr for an arithmetic shift right
– Examples:
» R2 ashr R2
» R3 ashl R3
CSE 211
Question
• What is the effect on the output if ashr
operation is performed?
– Subtraction by 2
– Multiplication by 2
– Division by 2
– Addition by 2
Register Transfer and Micro-operations 24
Hardware Implementation of Shift Microoperation
CSE 211
Register Transfer and Micro-operations 25
Arithmetic Logic and Shift Unit
S3
S2 C
i
S1
S0 S3 S2 S1 S0 Cin Operation
0 0 0 0 0 F=A
0 0 0 0 1 F=A+1
D 0 0 0 1 0 F=A+B
Arithmetic i
0 0 0 1 1 F=A+B+1
Circuit 0 0 1 0 0 F = A + B’
0 0 1 0 1 F = A + B’+ 1
Select 0 0 1 1 0 F=A-1
0 0 1 1 1 F=A
0 1 0 0 X F=AB
0 4x1 0 1 0 1 X F = A B
C i+1 F 0 1 1 0 X F=AB
1 i
MUX 0 1 1 1 X F = A’
2 1 0 X X X F = shr A
3 1 1 X X X F = shl A
E
Logic i
Bi
Circuit
A
i
shr
A
i-1
shl
A
i+1
CSE 211
Question
• An 8-bit register contains the binary value 10011100. What is
the register value after an arithmetic shift right? Starting from
the initial number 10011100, determine the register value
after an arithmetic shift left, and state whether there is an
overflow.
• In a RTL, the following notation is used
– ashl for an arithmetic shift left
– ashr for an arithmetic shift right
– Examples:
» R2 ashr R2
» R3 ashl R3
•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
Overflow Detection –
Overflow occurs when:
• Two negative numbers are added and an answer
comes positive or
• Two positive numbers are added and an answer
comes as negative.
Considering the above scenarios we can also say that – If we add two operands of
same sign and get result of opposite sign, overflow occurs.
Overflow Occurs when C-in C-out.
Conclusion:-
To summarise, we studied shift micro-operation and its
types in this article:-
• There are three types of shift micro-operation -
logical shift, arithmetic shift and circular shift.
• We went through all these types along with their
subtypes.