Chapter 3: Flow Control, Branch/Data Processing Instructions, and Addressing Modes Flashcards
What is unconditional branching?
Branch always, branch without a condition
What is conditional branching?
branches depending on the status the CPSR
How many bits does ARM dedicate in each instruction to encode conditions?
4 bits
How many possible different conditions are there in ARM?
16 difference conditions
Of ARM’s ___ different conditions, how many are dedicated to a single bit in the CPSR (N, Z, V, C)?
There are 16 possible conditions
Eight possible conditions:
- Four for true
- Four for false
Of ARM’s ___ different conditions, how many are dedicated to compound conditions?
There are 16 possible conditions:
- Six are dedicated to compound conditions
Of ARM’s ___ different conditions, what are the conditions dedicated to non-CPSR related conditions?
There are 16 possible conditions:
- One is dedicated to ALWAYS
- One is dedicated to NEVER
What does a while loop in ARM look like?
While CMP r0, #0
BNE Exit
{code...} B While Exit {Post-loop}
What does a Repeat-Until loop in ARM look like?
Repeat {code…}
CMP r0, #0 BNE Repeat {Post-loop}
What does a for loop in ARM look like?
MOV r0, #10
Loop {code}
SUBS r0, #1 BNE Loop {Post-loop}
A repeat-until loop….
Carries out the code while the condition is false
ARM branch instructions have to keep in mind what?
The pipelining effect of the PC, which is 2 instructions ahead always
The PC is always ____ instructions or ____ bytes ahead of the current instructions
2 instructions ahead
or 8 bytes
Rotate Right Through Carry (RRX) is encoded as what?
Rotate right with zero shift
When appending an S to conditional code, the S can go where?
Before or after the condition
ADDEQS & ADDSEQ
are both valid
When there is no shift at all, what it is encoded as?
Logical left (00) with 0 shift (00000)
In all test and compare instructions, the destination register field must be….
List the instructions
Encoded as 0000 and S = 1
TST
CMP
TEQ
CMN
In all moving instructions, the register source 1 must be encoded as…
0000
MOV
MVN
When encoding literals, rotations are always…
Rotating right
When encoding literals, the ENCODED rotation is always…
Doubled before being used
When encoding literals, ARM encodes ____ bits as the total, ____ of which are the rotation, and the remaining _____ is the number before rotation…
12 bits total literal,
4 of which are the rotation
8 of which are the number before rotation
When encoding literals, the 8 bits must be a value from…
0 to 255
The number of rotations must always be
Even, they can never be odd
The number of rotations can never be
Odd, must always be even