Professional Documents
Culture Documents
(CE-313)
Lecture – 5
Instructors:
Ms.Raazia Saher
Mr. Marwan El-Haj
Ms. Madeeha Anjam
1
Logic Microoperations
Selective Set
Selective Complement
Selective Clear
Mask Operation
Insert Operation
Clear Operation
Shift Microoperations
Logical
Circular
Arithmetic
ALU
The composite circuit for all operations
2
Categories of Microoperations
Register Transfer Microoperations:
Transfer binary information from one register to another
Arithmetic Microoperations:
Performs arithmetic operations on numeric data stored in registers.
Logic Microoperations:
Perform bit manipulation operations on non-numeric data stored in
registers
Shift Microoperations:
Perform shift operations on data stored in registers.
3
Logic Microoperations
4
Logic Microoperations
The “+” Sign has two different meanings in
logical operations:
Example:
+ between P + Q is OR operation
+ between R2 + R3 is ADD operation
5
Logic Microoperations
There are 16 different logic micro-operations that can
be performed on two different binary variables
6
Logic Microoperations
7
Logic Microoperations
8
Logic Microoperations
9
Logic Microoperations
10
Logic Microoperations
11
Logic Microoperations
12
Logic Microoperations
Similarly you can see the following
operations
13
Logic Microoperations
14
Logic Microoperations
The hardware implementation
The hadwere implementation requires that logic gates be inserted for
each bit or pair of bits in the registers to perform the required logic
function
16
Logic Microoperations
Some applications
Logic microoperations are very useful for manipulating individual bits or portion
of word stored in register
A A B
Example:
21
Logic Microoperations
The INSERT microoperation
The insert microoperation inserts a new value into
the group of bits. This is done as follows:
First mask the bits
ORing them with the required value
Example:
Lecture – 6
Instructors:
Ms.Raazia Saher
Mr. Marwan El-Haj
Ms. Madeeha Anjam
24
Shift Microoperations
Logical
Circular
Arithmetic
ALU
The composite circuit for all operations
25
Categories of Microoperations
Register Transfer Microoperations:
Transfer binary information from one register to another
Arithmetic Microoperations:
Performs arithmetic operations on numeric data stored in registers.
Logic Microoperations:
Perform bit manipulation operations on non-numeric data stored in
registers
Shift Microoperations:
Perform shift operations on data stored in registers.
26
Shift Microoperations
Logical
Shift Left (shl)
Shift Right (shr)
Circular (Rotate)
Circular Left (cil)
Circular Right (cir)
Arithmetic
Arithmetic-Shift Left (ashl)
Arithmetic-Shift Right (ashr)
27
Shift Microoperations
Logical Shift
shr (Logical shift right)
Shl (Logical shift left)
These are used for logical shift left and
logical shift right the bits of register by
one position.
The symbolic representation of operation
is:
28
Shift Microoperations
Logical Shift Right
Example :
1 0 1 0 1 1 0 1 (original)
0 1 0 1 0 1 1 0 (after shr)
29
Shift Microoperations
Logical Shift left
Example :
1 0 1 0 1 1 0 1 (original)
0 1 0 1 1 0 1 0 (after shl)
30
Shift Microoperations
Few Important Points
31
Shift Microoperations
Circular Shift
32
Circular Shift Right
Example :
1 0 1 0 1 1 0 1 (original)
1 1 0 1 0 1 1 0 (after cir)
33
Circular Shift Left
Example :
1 0 1 0 1 1 0 1 (original)
0 1 0 1 1 0 1 1 (after cil)
34
Shift Microoperations
Arithmetic Shift
35
Arithmetic Shift Right
Arithmetic shift right divides the signed
number by 2
Example 1:
0100 (+4) 4/2=2
0010 (+2)
Example 2:
1010 (-6) -6/2 = -3
1101 (-3)
36
Arithmetic Shift Right
Arithmetic shift right leaves the sign bit
unchanged and shift the number
(including sign bit) to the right
Example
1100 (-4)
0110 ( sign bit has been
changed ) put 1 on left side to maintain
the –ve sign of number
1110 (-2)
37
Arithmetic Shift Left
Arithmetic shift left multiplies the signed
number by 2
Example 1
0010 (2) 2*2=4
0100 (4)
Example 2
1110 (-2) -2 * 2 = -4
1100 (-4)
38
Shift Microoperations
39
Shift Microoperations
Arithmetic Shift
(Few important points)
Arithmetic shifts must leave the sign bit
unchanged because sign of the number
remain same when it is multiplied or
divided by 2
40
Shift Microoperations
Arithmetic Shift
(Few important points)
A sign reversal occurs if the bit in Rn-1
changes in value after the shift
This happens if the multiplication causes
an overflow
41
Arithmetic Shift Left
Arithmetic Shift Left (Overflow)
Example
1010 (-6)
0100 (overflow)
42
Shift Microoperations
An overflow flip-flop can be used to
predict the overflow
43
Arithmetic Shift Left
The operation is same with Logic shift-left
The only difference is you need to check
overflow problem
Carry out
Sign bit
R 2 ashl R 2
LSB
Rn-1 Rn-2
0 insert
Vs=1 : Overflow
44
Vs=0 : use sign bit
Shift Microoperations
Hardware implementation
A possible choice for a shift unit would be
a bidirectional shift register with parallel
load
Two clock-pulses will be required
One for loading the data into the register
One for the initiating the shift
46
Arithmetic Logic Shift Unit (ALU)
48
49
Arithmetic Logic Shift Unit (ALU)
The diagram shown in Figure 4-13
provides eight arithmetic operations, four
logic operations and two shift operations
Each operator is selected with five
variables S3, S2, S1 S0 and Cin
The Cin is used for selecting an arithmetic
operation only
50
Arithmetic Logic Shift Unit (ALU)
51