SlideShare a Scribd company logo
1 of 18
Download to read offline
Logic Microoperations 
Tarunpreet Bhatia 
CSED, Thapar University
LIST OF LOGIC MICROOPERATIONS 
• List of Logic Microoperations - 16 different logic operations with 2 binary variables. - n binary variables → functions 
2 
2 
n 
• Truth tables for 16 functions of 2 variables and the corresponding 16 logic micro-operations 
Boolean Function 
Micro- 
Operations 
Name 
x 0 0 1 1 y 0 1 0 1 
0 0 0 0 F0 = 0 F  0 Clear 
0 0 0 1 F1 = xy F  A  B AND 
0 0 1 0 F2 = xy' F  A  B’ 
0 0 1 1 F3 = x F  A Transfer A 
0 1 0 0 F4 = x'y F  A’ B 
0 1 0 1 F5 = y F  B Transfer B 
0 1 1 0 F6 = x  y F  A  B Exclusive-OR 
0 1 1 1 F7 = x + y F  A  B OR 
1 0 0 0 F8 = (x + y)' F  A  B)’ NOR 
1 0 0 1 F9 = (x  y)' F  (A  B)’ Exclusive-NOR 
1 0 1 0 F10 = y' F  B’ Complement B 
1 0 1 1 F11 = x + y' F  A  B 
1 1 0 0 F12 = x' F  A’ Complement A 
1 1 0 1 F13 = x' + y F  A’ B 
1 1 1 0 F14 = (xy)' F  (A  B)’ NAND 
1 1 1 1 F15 = 1 F  all 1's Set to all 1's
HARDWARE IMPLEMENTATION OF LOGIC MICROOPERATIONS 
0 0 F = A  B AND 
0 1 F = AB OR 
1 0 F = A  B XOR 
1 1 F = A’ Complement 
S1 S0 
Output 
-operation 
Function table 
B 
A 
S 
S 
F 
1 
0 
i 
i 
i 
0 
1 
2 
3 
4 X 1 
MUX 
Select
APPLICATIONS OF LOGIC MICROOPERATIONS 
•Logic microoperations can be used to manipulate individual bits or a portions of a word in 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 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 
1 1 0 0 At 
1 0 1 0 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. 
•OR microoperation can be used to selectively set bits of a register.
SELECTIVE COMPLEMENT 
•In a selective complement operation, the bit pattern in B is used to complement certain bits in A 
1 1 0 0 At 
1 0 1 0 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. 
•The exclusive-OR microoperation 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 
1 1 0 0 At 
1 0 1 0 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
MASK OPERATION 
•In a mask operation, the bit pattern in B is used to clear certain bits in A 
1 1 0 0 At 
1 0 1 0 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
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. 
1 1 0 0 At 
1 0 1 0 B 
0 1 1 0 At+1 (A  A  B) 
•It compares words in A and B and produces all 0’s result if the two numbers are equal. This operation is achieved by XOR 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 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)
SHIFT MICROOPERATIONS 
•Shift microoperations are used for serial transfer of data. 
•The information transferred through the serial input determines the type of shift. There are three types of shifts 
–Logical shift 
–Circular shift 
–Arithmetic shift 
Serial input 
• A right shift operation 
• A left shift operation 
Serial input
LOGICAL SHIFT 
•In a logical shift the serial input to the shift is a 0. 
•A right logical shift operation: 
•A left logical shift operation: 
•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 
0 
0
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
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 
•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: 
•A left arithmetic shift operation: 
0 
sign bit 
sign bit
ARITHMETIC SHIFT 
•An left arithmetic shift operation must be checked for the overflow 
0 
V 
Before the shift, if the leftmost two 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 
sign bit
ARITHMETIC LOGIC SHIFT UNIT 
S3 S2 S1 S0 Cin Operation Function 0 0 0 0 0 F = A Transfer A 0 0 0 0 1 F = A + 1 Increment A 0 0 0 1 0 F = A + B Addition 0 0 0 1 1 F = A + B + 1 Add with carry 0 0 1 0 0 F = A + B’ Subtract with borrow 0 0 1 0 1 F = A + B’+ 1 Subtraction 0 0 1 1 0 F = A - 1 Decrement A 0 0 1 1 1 F = A TransferA 0 1 0 0 X F = A  B AND 0 1 0 1 X F = A B OR 0 1 1 0 X F = A  B XOR 0 1 1 1 X F = A’ Complement A 1 0 X X X F = shr A Shift right A into F 1 1 X X X F = shl A Shift left A into F 
Arithmetic 
Circuit 
Logic 
Circuit 
C 
C 
4 x 1 
MUX 
Select 
0 
1 
2 
3 
F 
S3 
S2 
S1 
S0 
B 
A 
i 
A 
D 
A 
E 
shr 
shl 
i+1 
i 
i 
i 
i+1 
i-1 
i 
i
Example 
Register A holds 8-bit operand 11011001. Determine the operand B and logic microoperation to be performed in order to change the value of A to 
a)01101101 
b)11111101 
A = 11011001 A = 11011001 
B = 10110100 ⊕ B = 11111101 (OR) 
A’ = 01101101 A’ ← A ⊕ B A’ = 11111101 A’ ← AVB

More Related Content

What's hot

Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithmGaurav Subham
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operationsNitesh Bichwani
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operationsSanjeev Patel
 
Shift micro operations & 4 bit combinational circuit shifter
Shift micro operations &  4 bit combinational circuit shifterShift micro operations &  4 bit combinational circuit shifter
Shift micro operations & 4 bit combinational circuit shifterMonika Chauhan
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operationsLakshya Sharma
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructionsihsanjamil
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructionsDr. Girish GS
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processingKamal Acharya
 
Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And SubtractionKeyur Vadodariya
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)Siddhi Viradiya
 
Fixed point and floating-point numbers
Fixed point and  floating-point numbersFixed point and  floating-point numbers
Fixed point and floating-point numbersMOHAN MOHAN
 
Input output organization
Input output organizationInput output organization
Input output organizationabdulugc
 
Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 
Register organization, stack
Register organization, stackRegister organization, stack
Register organization, stackAsif Iqbal
 
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.ATUL KUMAR YADAV
 

What's hot (20)

Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithm
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operations
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operations
 
Shift micro operations & 4 bit combinational circuit shifter
Shift micro operations &  4 bit combinational circuit shifterShift micro operations &  4 bit combinational circuit shifter
Shift micro operations & 4 bit combinational circuit shifter
 
Basic Computer Organization and Design
Basic  Computer  Organization  and  DesignBasic  Computer  Organization  and  Design
Basic Computer Organization and Design
 
Instruction format
Instruction formatInstruction format
Instruction format
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operations
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
 
Program control instructions
Program control instructionsProgram control instructions
Program control instructions
 
Pipelining and vector processing
Pipelining and vector processingPipelining and vector processing
Pipelining and vector processing
 
Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And Subtraction
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)
 
Fixed point and floating-point numbers
Fixed point and  floating-point numbersFixed point and  floating-point numbers
Fixed point and floating-point numbers
 
Input output organization
Input output organizationInput output organization
Input output organization
 
Stack organization
Stack organizationStack organization
Stack organization
 
Register organization, stack
Register organization, stackRegister organization, stack
Register organization, stack
 
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.COMPUTER INSTRUCTIONS & TIMING & CONTROL.
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 

Viewers also liked

Register transfer and micro operation
Register transfer and micro operationRegister transfer and micro operation
Register transfer and micro operationKamal Acharya
 
Micro operation control of processor
Micro operation control of processorMicro operation control of processor
Micro operation control of processorMuhammad Ishaq
 
Computer organiztion4
Computer organiztion4Computer organiztion4
Computer organiztion4Umang Gupta
 
Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...Rai University
 
Shift Microoperations by Pir Sarfraz RSDT larkana
Shift Microoperations by Pir Sarfraz RSDT larkanaShift Microoperations by Pir Sarfraz RSDT larkana
Shift Microoperations by Pir Sarfraz RSDT larkanaPir Sarfraz Ahmed
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instructionkashif Shafqat
 
Lecture 2
Lecture 2Lecture 2
Lecture 2GIKI
 
Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit (ALU)Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit (ALU)Student
 
Instruction codes and computer registers
Instruction codes and computer registersInstruction codes and computer registers
Instruction codes and computer registersSanjeev Patel
 
Error Detection And Correction
Error Detection And CorrectionError Detection And Correction
Error Detection And CorrectionRenu Kewalramani
 
IS 139 Lecture 4
IS 139 Lecture 4IS 139 Lecture 4
IS 139 Lecture 4wajanga
 

Viewers also liked (20)

Register transfer and micro operation
Register transfer and micro operationRegister transfer and micro operation
Register transfer and micro operation
 
Instruction code
Instruction codeInstruction code
Instruction code
 
Micro operation control of processor
Micro operation control of processorMicro operation control of processor
Micro operation control of processor
 
Computer organiztion4
Computer organiztion4Computer organiztion4
Computer organiztion4
 
Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.2-overview of register transfer, micro operations and basic c...
 
Instruction cycle
Instruction cycleInstruction cycle
Instruction cycle
 
Shift Microoperations by Pir Sarfraz RSDT larkana
Shift Microoperations by Pir Sarfraz RSDT larkanaShift Microoperations by Pir Sarfraz RSDT larkana
Shift Microoperations by Pir Sarfraz RSDT larkana
 
Ch4
Ch4Ch4
Ch4
 
Shift rotate
Shift rotateShift rotate
Shift rotate
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit (ALU)Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit (ALU)
 
Instruction codes and computer registers
Instruction codes and computer registersInstruction codes and computer registers
Instruction codes and computer registers
 
Co ppt
Co pptCo ppt
Co ppt
 
Error Detection And Correction
Error Detection And CorrectionError Detection And Correction
Error Detection And Correction
 
Al2ed chapter18
Al2ed chapter18Al2ed chapter18
Al2ed chapter18
 
4_BIT_ALU
4_BIT_ALU4_BIT_ALU
4_BIT_ALU
 
IS 139 Lecture 4
IS 139 Lecture 4IS 139 Lecture 4
IS 139 Lecture 4
 
Lec20
Lec20Lec20
Lec20
 
RTL
 RTL RTL
RTL
 

Similar to Logic Microoperations Explained in 40 Characters

Similar to Logic Microoperations Explained in 40 Characters (20)

Logic Micro Operation
Logic Micro OperationLogic Micro Operation
Logic Micro Operation
 
Booth Multiplier
Booth MultiplierBooth Multiplier
Booth Multiplier
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Logical, Shift, and Rotate Instruction
Logical, Shift, and Rotate InstructionLogical, Shift, and Rotate Instruction
Logical, Shift, and Rotate Instruction
 
Shift register
Shift registerShift register
Shift register
 
lec41.ppt
lec41.pptlec41.ppt
lec41.ppt
 
C bitwise operators
C bitwise operatorsC bitwise operators
C bitwise operators
 
CA UNIT II.pptx
CA UNIT II.pptxCA UNIT II.pptx
CA UNIT II.pptx
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
B sc cs i bo-de u-ii logic gates
B sc cs i bo-de u-ii logic gatesB sc cs i bo-de u-ii logic gates
B sc cs i bo-de u-ii logic gates
 
Digital logic
Digital logicDigital logic
Digital logic
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
 
Dpsd lecture-notes
Dpsd lecture-notesDpsd lecture-notes
Dpsd lecture-notes
 
Hemanth143
Hemanth143 Hemanth143
Hemanth143
 
UNIT-1_CSA.pdf
UNIT-1_CSA.pdfUNIT-1_CSA.pdf
UNIT-1_CSA.pdf
 
Binary operations
 Binary operations Binary operations
Binary operations
 
Synchronous Sequential Logic Unit 4
Synchronous Sequential Logic Unit 4Synchronous Sequential Logic Unit 4
Synchronous Sequential Logic Unit 4
 
02-gates-w.pptx
02-gates-w.pptx02-gates-w.pptx
02-gates-w.pptx
 
Decppt
DecpptDecppt
Decppt
 

More from Nitesh Singh

More from Nitesh Singh (20)

Risk taking and emotions
Risk taking and emotionsRisk taking and emotions
Risk taking and emotions
 
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SADProject report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
 
The real comedy behind comedy
The real comedy behind comedyThe real comedy behind comedy
The real comedy behind comedy
 
Project report Rs Dry celaners
Project report Rs Dry celaners Project report Rs Dry celaners
Project report Rs Dry celaners
 
BIG DATA ANALYSIS
BIG DATA ANALYSISBIG DATA ANALYSIS
BIG DATA ANALYSIS
 
Udp vs-tcp
Udp vs-tcpUdp vs-tcp
Udp vs-tcp
 
Routing protocols-network-layer
Routing protocols-network-layerRouting protocols-network-layer
Routing protocols-network-layer
 
Routers vs-switch
Routers vs-switchRouters vs-switch
Routers vs-switch
 
New udp
New udpNew udp
New udp
 
I pv4 format
I pv4 formatI pv4 format
I pv4 format
 
I pv4 addressing
I pv4 addressingI pv4 addressing
I pv4 addressing
 
Hub vs-switch
Hub vs-switchHub vs-switch
Hub vs-switch
 
Ftp
FtpFtp
Ftp
 
Email ftp
Email ftpEmail ftp
Email ftp
 
Www and http
Www and httpWww and http
Www and http
 
Transmission main
Transmission mainTransmission main
Transmission main
 
Ta 104-topology
Ta 104-topologyTa 104-topology
Ta 104-topology
 
Ta 104-topology (1)
Ta 104-topology (1)Ta 104-topology (1)
Ta 104-topology (1)
 
Ta 104-tcp
Ta 104-tcpTa 104-tcp
Ta 104-tcp
 
Ta 104-media-3
Ta 104-media-3Ta 104-media-3
Ta 104-media-3
 

Logic Microoperations Explained in 40 Characters

  • 1. Logic Microoperations Tarunpreet Bhatia CSED, Thapar University
  • 2. LIST OF LOGIC MICROOPERATIONS • List of Logic Microoperations - 16 different logic operations with 2 binary variables. - n binary variables → functions 2 2 n • Truth tables for 16 functions of 2 variables and the corresponding 16 logic micro-operations Boolean Function Micro- Operations Name x 0 0 1 1 y 0 1 0 1 0 0 0 0 F0 = 0 F  0 Clear 0 0 0 1 F1 = xy F  A  B AND 0 0 1 0 F2 = xy' F  A  B’ 0 0 1 1 F3 = x F  A Transfer A 0 1 0 0 F4 = x'y F  A’ B 0 1 0 1 F5 = y F  B Transfer B 0 1 1 0 F6 = x  y F  A  B Exclusive-OR 0 1 1 1 F7 = x + y F  A  B OR 1 0 0 0 F8 = (x + y)' F  A  B)’ NOR 1 0 0 1 F9 = (x  y)' F  (A  B)’ Exclusive-NOR 1 0 1 0 F10 = y' F  B’ Complement B 1 0 1 1 F11 = x + y' F  A  B 1 1 0 0 F12 = x' F  A’ Complement A 1 1 0 1 F13 = x' + y F  A’ B 1 1 1 0 F14 = (xy)' F  (A  B)’ NAND 1 1 1 1 F15 = 1 F  all 1's Set to all 1's
  • 3. HARDWARE IMPLEMENTATION OF LOGIC MICROOPERATIONS 0 0 F = A  B AND 0 1 F = AB OR 1 0 F = A  B XOR 1 1 F = A’ Complement S1 S0 Output -operation Function table B A S S F 1 0 i i i 0 1 2 3 4 X 1 MUX Select
  • 4. APPLICATIONS OF LOGIC MICROOPERATIONS •Logic microoperations can be used to manipulate individual bits or a portions of a word in 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 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
  • 5. SELECTIVE SET •In a selective set operation, the bit pattern in B is used to set certain bits in A 1 1 0 0 At 1 0 1 0 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. •OR microoperation can be used to selectively set bits of a register.
  • 6. SELECTIVE COMPLEMENT •In a selective complement operation, the bit pattern in B is used to complement certain bits in A 1 1 0 0 At 1 0 1 0 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. •The exclusive-OR microoperation can be used to selectively complement bits of a register.
  • 7. SELECTIVE CLEAR •In a selective clear operation, the bit pattern in B is used to clear certain bits in A 1 1 0 0 At 1 0 1 0 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
  • 8. MASK OPERATION •In a mask operation, the bit pattern in B is used to clear certain bits in A 1 1 0 0 At 1 0 1 0 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
  • 9. 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. 1 1 0 0 At 1 0 1 0 B 0 1 1 0 At+1 (A  A  B) •It compares words in A and B and produces all 0’s result if the two numbers are equal. This operation is achieved by XOR microoperation.
  • 10. 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 operation to clear the desired bit positions, followed by –An OR operation to introduce the new bits into the desired positions
  • 11. –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)
  • 12. SHIFT MICROOPERATIONS •Shift microoperations are used for serial transfer of data. •The information transferred through the serial input determines the type of shift. There are three types of shifts –Logical shift –Circular shift –Arithmetic shift Serial input • A right shift operation • A left shift operation Serial input
  • 13. LOGICAL SHIFT •In a logical shift the serial input to the shift is a 0. •A right logical shift operation: •A left logical shift operation: •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 0 0
  • 14. 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
  • 15. 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 •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: •A left arithmetic shift operation: 0 sign bit sign bit
  • 16. ARITHMETIC SHIFT •An left arithmetic shift operation must be checked for the overflow 0 V Before the shift, if the leftmost two 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 sign bit
  • 17. ARITHMETIC LOGIC SHIFT UNIT S3 S2 S1 S0 Cin Operation Function 0 0 0 0 0 F = A Transfer A 0 0 0 0 1 F = A + 1 Increment A 0 0 0 1 0 F = A + B Addition 0 0 0 1 1 F = A + B + 1 Add with carry 0 0 1 0 0 F = A + B’ Subtract with borrow 0 0 1 0 1 F = A + B’+ 1 Subtraction 0 0 1 1 0 F = A - 1 Decrement A 0 0 1 1 1 F = A TransferA 0 1 0 0 X F = A  B AND 0 1 0 1 X F = A B OR 0 1 1 0 X F = A  B XOR 0 1 1 1 X F = A’ Complement A 1 0 X X X F = shr A Shift right A into F 1 1 X X X F = shl A Shift left A into F Arithmetic Circuit Logic Circuit C C 4 x 1 MUX Select 0 1 2 3 F S3 S2 S1 S0 B A i A D A E shr shl i+1 i i i i+1 i-1 i i
  • 18. Example Register A holds 8-bit operand 11011001. Determine the operand B and logic microoperation to be performed in order to change the value of A to a)01101101 b)11111101 A = 11011001 A = 11011001 B = 10110100 ⊕ B = 11111101 (OR) A’ = 01101101 A’ ← A ⊕ B A’ = 11111101 A’ ← AVB