80 likes | 173 Views
Data Representation and Machine Concepts. Computer SCIENCE. Section 2.4. Instructor: Lin Chen. Sept 2013. 2 Data Manipulation. 2.4 Arithmetic/Logic Instructions. Logic Operations Rotation and Shift Operations. http://www.cs.kzoo.edu/cs108/lectures/machine-assembly.pdf.
E N D
Data Representation and Machine Concepts Computer SCIENCE Section 2.4 Instructor: Lin Chen Sept 2013
2 Data Manipulation 2.4 Arithmetic/Logic Instructions Logic Operations Rotation and Shift Operations http://www.cs.kzoo.edu/cs108/lectures/machine-assembly.pdf
2.4 Arithmetic/Logic Instructions Logic Operations AND 10011010 11001001 Force a 0 in some bit AND 10001000 0 AND 0 0 0 AND 1 0 1 AND 0 0 1 AND 1 1
2.4 Arithmetic/Logic Instructions Logic Operations AND Suppose we have 8 lights in the room, each one is represented with 1 bit want to check if third light is on Yellow ON Blue OFF Expressed as 00101010 Set up a mask 00100000 AND 00100000 Equals to 0, third light is off Not equals to 0, third light is on
2.4 Arithmetic/Logic Instructions Logic Operations OR 10011010 11001001 Force a 1 in some bit OR 11011011 0 OR 0 0 0 OR 1 1 1 OR 0 1 1 OR 1 1
2.4 Arithmetic/Logic Instructions Logic Operations XOR 10011010 11001001 Form the complement of a bit XOR 01010011 0 OR 0 0 0 OR 1 1 1 OR 0 1 1 OR 1 0
2.4 Arithmetic/Logic Instructions Rotation and Shift Operations Rotation 01100101 Right Rotation 10110010 01100101 Left Rotation 11001010 http://www.cs.kzoo.edu/cs108/lectures/machine-assembly.pdf
2.4 Arithmetic/Logic Instructions Rotation and Shift Operations Shift Fill with 0 at the leftmost position 01100101 Right Shift 00110010 Fill with 0 at the rightmost position 01100101 Left Rotation 11001010 http://www.cs.kzoo.edu/cs108/lectures/machine-assembly.pdf