Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
CS304PC:Computer Organization and Architecture Session 4 Arithmetic shift logic unit .pptx
1. CS307PC:Computer Organization
and Architecture (R18 II(I sem))
Department of computer science and engineering
(AI/ML)
Session 4
by
Asst.Prof.M.Gokilavani
VITS
11/23/2022 Department of CSE (AI/ML) 1
2. TEXT BOOK:
• 1. Computer System Architecture – M. Moris Mano, Third Edition,
Pearson/PHI.
REFERENCES:
• Computer Organization – Car Hamacher, Zvonks Vranesic, Safea
Zaky, Vth Edition, McGraw Hill.
• Computer Organization and Architecture – William Stallings Sixth
Edition, Pearson/PHI.
• Structured Computer Organization – Andrew S. Tanenbaum, 4th
Edition, PHI/Pearson.
11/23/2022 Department of CSE (AI/ML) 2
3. UNIT - I
11/23/2022 Department of CSE (AI/ML) 3
Digital Computers: Introduction, Block diagram of Digital Computer,
Definition of Computer Organization, Computer Design and Computer
Architecture.
Register Transfer Language and Micro operations: Register Transfer
language, Register Transfer, Bus and memory transfers, Arithmetic
Micro operations, logic micro operations, shift micro operations,
Arithmetic logic shift unit.
Basic Computer Organization and Design: Instruction codes,
Computer Registers Computer instructions, Timing and Control,
Instruction cycle, Memory Reference Instructions, Input – Output and
Interrupt.
4. Topics covered in session 4
• Register Transfer Language and Micro operations
• Register Transfer language
• Register Transfer
• Bus and memory transfers
• Arithmetic Micro operations
• logic micro operations
• shift micro operations
• Arithmetic logic shift unit
11/23/2022 Department of CSE (AI/ML) 4
5. Logic Micro Operation
• Logic micro operations specify binary operations for string 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 micro operation with the contents of
two registers R1 and R2 is symbolized by the statement
• It specifies a logic micro operation to b executed on the individual bits
of th registers provided that the control variable P=1.
11/23/2022 Department of CSE (AI/ML) 5
6. Logic Micro Operation
• As a numerical example, assume that each register has four digits. Let the content
of R1 be 1010 and the content of R2 be 1100. The Exclusive- OR micro operation
stated above symbolizes the following logic computation:
• Special symbol are used for logical operations.
• Ʌ Denotes AND symbol and V denotes OR operation.
• When + symbol occur in micro operation if denotes arithmetic addition but it
control signals it denote the OR.
11/23/2022 Department of CSE (AI/ML) 6
7. List of Logic Micro Operation
11/23/2022 Department of CSE (AI/ML) 7
• There are 16 different logic operations that can be performed with two binary
variables.
• They can be determined from all possible truth tables obtained with two binary
variables as shown in Table.
• 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.
9. Hardware Implementation
11/23/2022 Department of CSE (AI/ML) 9
• Although there are 16 logic micro operations, most computers use only four — AND, OR, XOR (exclusive-OR),
and complement from which all others can be derived. Figure shows one stage of a circuit that generates the four
basic logic micro operations.
10. Other Applications
• Logic micro operations can be used to manipulate individual bits or a
portion of 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 content of A.
11/23/2022 Department of CSE (AI/ML) 10
11. Other Applications
1. In a selective set operation, the bit pattern in B is used to set certain bits in A
(logic OR operation)
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
(logic Ex-OR operation)
If a bit in B is set to 1, that same position in A gets complemented from its original
value, otherwise it is unchanged.
11/23/2022 Department of CSE (AI/ML) 11
12. Other Applications
3. In a selective clear operation, the bit pattern in B is used to clear certain bits in
A
(B’s one’s Complement)
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 AAt
(AND operation)
If a bit in B is set to 0, that same position in A gets set to 0, otherwise it is
unchanged.
11/23/2022 Department of CSE (AI/ML) 12
13. Other Applications
• 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
• 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/23/2022 Department of CSE (AI/ML) 13
14. Shift Micro Operations
11/23/2022 Department of CSE (AI/ML) 14
• Shift micro operations 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 register can be shifted to the left or the right.
• During a shift-left operation the serial input transfers a bit into the rightmost
position. During a shift-right operation the serial input transfers a bit into the
leftmost position.
• There are three types of shifts:
• Logical
• Circular
• arithmetic
15. Logical Shift
• A logical shift is one that transfers 0 through the serial input.
• We will adopt the symbols shl and shr for logical shift-left and shift-right micro
operations.
• Logical shift-left
• Logical shift-Right
• For Example,
11/23/2022 Department of CSE (AI/ML) 15
16. Circular Shift
• In a circular shift the serial input is the bit that is shifted out of the other end of the
register.
• We will adopt the symbols cil and cir for logical shift-left and shift-right micro
operations.
• Circular shift-left
• Circular shift-right
• For Example,
11/23/2022 Department of CSE (AI/ML) 16
17. 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:
A left arithmetic shift operation:
11/23/2022 Department of CSE (AI/ML) 17
18. ARITHMETIC SHIFT
• An left arithmetic shift operation must be checked for the overflow.
• In a RTL, the following notation is used
• ashl for an arithmetic shift left
• ashr for an arithmetic shift right
For Example:
11/23/2022 Department of CSE (AI/ML) 18