70 likes | 305 Views
Logical Instructions. And rd rs rt Nor rd rs rt Or rd rs rt Xor rd rs rt Andi rt rs Imm Ori rt rs Imm Xori rt rs Imm Careful: Immediate variants Zero-extend. Logic Truth Tables. How to Invert Each Bit?. Nor fuction A B C 0 0 1 0 1 0 1 0 0 1 1 0. (One's complement)
E N D
Logical Instructions • Andrd rs rt • Norrd rs rt • Orrd rs rt • Xorrd rs rt • Andirt rs Imm • Orirt rs Imm • Xorirt rs Imm • Careful: Immediate variants Zero-extend
How to Invert Each Bit? Nor fuction A B C 0 0 1 0 1 0 1 0 0 1 1 0 (One's complement) • Nor rd rs $0 • This is not! A 1 C=A' B=0
Shift Instructions Logical shift left Logical shift right A B C D A B C D lost 0 lost 0 B C D 0 0 A B C
Shift Instructions • Arithmetic shift right A B C D lost A A B C
Shift Instructions • Sllrd rt expr Srard rt expr Srlrd rt expr • rd := rt shifted by expr (0..31) • Sllvrd rt rs Sravrd rt rs Srlvrd rt rs • rd := rt shifted by rs (variable)
Rotate Instructions Rotate left Rotate right A B C D A B C D B C D A D A B C