0
0
ARM Architectureknowledge~10 mins

Compare and branch patterns in ARM Architecture - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to compare register R0 with zero and branch if equal.

ARM Architecture
CMP R0, [1]
BEQ label_equal
Drag options to blanks, or click blank then click option'
A#1
B#0
CR1
D#-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a register instead of an immediate value for zero comparison.
2fill in blank
medium

Complete the code to branch to label_greater if R2 is greater than R3.

ARM Architecture
CMP R2, R3
B[1] label_greater
Drag options to blanks, or click blank then click option'
AGT
BEQ
CLT
DNE
Attempts:
3 left
💡 Hint
Common Mistakes
Using branch conditions for equality or less than instead of greater than.
3fill in blank
hard

Fix the error in the code to branch if R4 is less than or equal to R5.

ARM Architecture
CMP R4, R5
B[1] label_less_equal
Drag options to blanks, or click blank then click option'
AGE
BLT
CLE
DGT
Attempts:
3 left
💡 Hint
Common Mistakes
Using LT instead of LE causes the branch to miss the equal case.
4fill in blank
hard

Fill both blanks to compare R6 with R7 and branch if not equal.

ARM Architecture
CMP [1], [2]
BNE label_not_equal
Drag options to blanks, or click blank then click option'
AR6
BR7
C#0
DR0
Attempts:
3 left
💡 Hint
Common Mistakes
Using an immediate value instead of the correct registers for comparison.
5fill in blank
hard

Fill all three blanks to compare R8 with immediate 5 and branch if greater or equal.

ARM Architecture
CMP [1], [2]
B[3] label_ge
Drag options to blanks, or click blank then click option'
AR8
B#5
CGE
DLT
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong immediate value or branch condition.