Professional Documents
Culture Documents
2
OPERATIONS
ON DATA
Subtitle
Content
• 1 Logic
• 2 Shift
• 3.Arithmetic operations
2
1. LOGIC
0110 1110
xOr 1011 1101
------------------------------
11 01 0011
OR: phép cộng
01101110
01101110
Or 10101101
xOr 10101101
------------------------------
------------------------------
11101111
11000011
Phep cong k nho
1+1= 0
2 - Shift Operations
a. dịch trái
- Thêm 0 vào bên phải dãy bit, dịch trái các bít còn lại, lost bit trái ngoài
cùng:
b. Dịch phải
- Thêm 0 vào bên trái dãy bit, dịch phải các bít còn lại, lost bit phải ngoài
cùng
2.1 Logical shift ( dịch trái, phải)
Example 3.7
Use a logical left shift operation on the bit pattern 10011001.
Solution
A= 1010 = 10
a. dịch trái: 1 0100 = 4
b. Dịch phải
2.2. Circular Shift Operations
A= 1010111
1. dịch tròn trái
2. Dịch tròn phải
2.3 Arithmetic shift operations
000011100 =28
000111000= 56 = 28.2
Dich toan hoc trai: de hthuc hien phep
nhan 2 lan
---------------------------
000011100= 28
000011100 = 14 = 28:2
Dich toan hoc phai: chia 2
110 10
2. Not B +1 = bu 2 cua B
1. Bu 2 cua B Not B = 011011111
001 10 + 1
---------------------------
00 1 1 0
3.1 Addition and subtraction of integers in two’s
complement format
•R=A+B •R=A-B
=6+3 = 9 =-----------
-----------
0110
0110
+ 0011
+ 1101
------------- -------------
1001 10011 = -,…
Addition and subtraction of integers in two’s
complement format
A= 0101= +5 A= 0101 = +5
B= 0110= +6
R=A+B = 11 B= 0110 =+6 bu 2: 10 10
0101 R=A-B = -1
+ 0110
-------------- 0101
1 0 1 1 =11 + 1010
--------------
1 111 =- 1
Bu 2: 0001 = 1
3.2 Addition and subtraction of integers in sign-
and-magnitude
= As Am = -5
= Bs Bm= + 6
11