1 / 5

ENSE 352 Lab 4

Objective The objective of this lab is to introduce the students to bit manipulations using the ARM assembly instruction set. ENSE 352 Lab 4. Bit Shifting. ASR, LSL, LSR, ROR, and RRX arithmetic shift right logical shift left logical shift right rotate right

uta-price
Download Presentation

ENSE 352 Lab 4

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Objective The objective of this lab is to introduce the students to bit manipulations using the ARM assembly instruction set. ENSE 352 Lab 4

  2. Bit Shifting • ASR, LSL, LSR, ROR, and RRX • arithmetic shift right • logical shift left • logical shift right • rotate right • rotate right with extend Flags affected N, Z, R

  3. Examples Bit Shifting MOV R0,#1 LSL R0, R0, #3 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0

  4. Isolating Bits • Very important for embedded programming. • Often referred to as masking. • Affect only the bit you are interested in. • Utilize the AND and ORR instructions. Ex. Want to determine the state of bit 1 in R0. AND R2, R0, #0x2 Result X X X X X X X X R0 0 0 0 0 0 0 1 0 This bit is isolated and All other bits cleared. R2 0 0 0 0 0 0 X 0

  5. Isolating Bits • Setting a bit without affecting the other bits • Use the ORR instruction. Ex. We want to set bit 1 in R0. ORR R0, R0, #0x2 Result X X X X X X X X R0 0 0 0 0 0 0 1 0 This bit is set to one now. R0 X X X X X X 1 X

More Related