BITWISE operations. 353156 – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat. Objectives. To understand Bitwise Logical Operations OR AND XOR Shift Operations Shift Left Shift Right Rotate. Bitwise Operations (1). Up until now, we’ve done :
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
BITWISE operations
353156 – Microprocessor
Asst. Prof. Dr. ChoopanRattanapoka and Asst. Prof. Dr. SuphotChunwiphat
0 0 1 1 1 0 1 1 AND
1 0 0 1 0 0 1 0
0
0
0
1
0
0
1
0
(1)
(2)
AREA ex1_1, CODE, READONLY
ENTRY
start
MOV a2, #0x42
MOV a3, #0xFC
AND a1, a2, a3
END
AREA ex1_2, CODE, READONLY
ENTRY
start
MOV a2, #0xBC000000
AND a1, a2, #0xFF
END
0011BIC
0101
0
0
1
0
(1)
(2)
AREA ex2_1, CODE, READONLY
ENTRY
start
MOV a2, #0x42
MOV a3, #0xFC
BIC a1, a2, a3
END
AREA ex2_2, CODE, READONLY
ENTRY
start
MOV a2, #0xBC000000
BIC a1, a2, #0xFF
END
0 0 1 1 1 0 1 1 OR
1 0 0 1 0 0 1 0
1
0
1
1
1
0
1
1
AREA ex3_1, CODE, READONLY
ENTRY
start
MOV a2, #0x34
MOV a3, #0x86
ORR a1, a2, a3
END
0 0 1 1 1 0 1 1 XOR
1 0 0 1 0 0 1 0
1
0
1
0
1
0
0
1
AREA ex4_1, CODE, READONLY
ENTRY
start
MOV a2, #0x34
MOV a3, #0x86
EOR a1, a2, a3
END
Given A an 8-bit register which stores data 1100 1010
1
1
0
0
1
0
1
0
0
0
0
0
1
1
0
0
1
0
1
0
Shift right by 4 bits
Shift left by
4 bits
1
1
0
0
1
0
1
0
0
0
0
0
(1)
(2)
AREA ex5_1, CODE, READONLY
ENTRY
start
MOV a1, #0x01
MOV a2, #4
LSL a1, a2
END
AREA ex5_2, CODE, READONLY
ENTRY
start
MOV a1, #0xFF
LSR a1, a1, #0x4
END
1
1
0
0
1
0
1
0
1
1
1
1
1
1
0
0
1
0
1
0
Shift right by 4 bits
0
1
0
0
1
0
1
0
0
0
0
0
1
1
0
0
1
0
1
0
Shift right by 4 bits
(1)
(2)
AREA ex6_1, CODE, READONLY
ENTRY
start
MOV a1, #0xFFFFFF10
MOV a2, #2
ASR a1, a2
END
AREA ex6_2, CODE, READONLY
ENTRY
start
MOV a1, #0xFF
ASR a1, a1, #0x2
END
Given A an 8-bit register which stores data 1100 1010
Rotate right by 3 bits
1
0
1
1
0
1
0
0
1
0
0
1
1
0
0
1
0
0
1
1
0
1
1
0
0
1
0
(1)
(2)
AREA ex7_1, CODE, READONLY
ENTRY
start
MOV a1, #0xFFFFFF10
MOV a2, #4
ROR a1, a2
END
AREA ex7_2, CODE, READONLY
ENTRY
start
MOV a1, #0xFF
ROR a1, a1, #0x4
END
Operand 1
Operand 2
Barrel
Shifter
ALU
Result
(1)
(2)
AREA hw5_1, CODE, READONLY
ENTRY
start
MOV a1, #0xFFFFFF18
MOV a2, #16
ROR a1, a2
MOV a2, #0xFF000000
AND a1, a1, a2, LSR #4
LSR a1, #16
END
AREA hw5_2, CODE, READONLY
ENTRY
start
MOV a1, #0xFF
MOV a2, #0xCC
MOV a3, #16
ADD a1, a1, a2, LSL a3
EOR a2, a2, #0x65
ORR a1, a1, a2, LSL #8
END