Chapter 3: Flow Control, Branch/Data Processing Instructions, and Addressing Modes Flashcards

1
Q

What is unconditional branching?

A

Branch always, branch without a condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is conditional branching?

A

branches depending on the status the CPSR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How many bits does ARM dedicate in each instruction to encode conditions?

A

4 bits

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How many possible different conditions are there in ARM?

A

16 difference conditions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Of ARM’s ___ different conditions, how many are dedicated to a single bit in the CPSR (N, Z, V, C)?

A

There are 16 possible conditions

Eight possible conditions:

  • Four for true
  • Four for false
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Of ARM’s ___ different conditions, how many are dedicated to compound conditions?

A

There are 16 possible conditions:

  • Six are dedicated to compound conditions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Of ARM’s ___ different conditions, what are the conditions dedicated to non-CPSR related conditions?

A

There are 16 possible conditions:

  • One is dedicated to ALWAYS
  • One is dedicated to NEVER
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does a while loop in ARM look like?

A

While CMP r0, #0
BNE Exit

        {code...}

        B   While Exit      {Post-loop}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does a Repeat-Until loop in ARM look like?

A

Repeat {code…}

            CMP r0, #0
            BNE Repeat

           {Post-loop}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does a for loop in ARM look like?

A

MOV r0, #10

Loop {code}

         SUBS r0, #1
         BNE Loop

         {Post-loop}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A repeat-until loop….

A

Carries out the code while the condition is false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ARM branch instructions have to keep in mind what?

A

The pipelining effect of the PC, which is 2 instructions ahead always

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The PC is always ____ instructions or ____ bytes ahead of the current instructions

A

2 instructions ahead

or 8 bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Rotate Right Through Carry (RRX) is encoded as what?

A

Rotate right with zero shift

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When appending an S to conditional code, the S can go where?

A

Before or after the condition

ADDEQS & ADDSEQ

are both valid

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When there is no shift at all, what it is encoded as?

A

Logical left (00) with 0 shift (00000)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

In all test and compare instructions, the destination register field must be….

List the instructions

A

Encoded as 0000 and S = 1

TST
CMP
TEQ
CMN

18
Q

In all moving instructions, the register source 1 must be encoded as…

A

0000

MOV
MVN

19
Q

When encoding literals, rotations are always…

A

Rotating right

20
Q

When encoding literals, the ENCODED rotation is always…

A

Doubled before being used

21
Q

When encoding literals, ARM encodes ____ bits as the total, ____ of which are the rotation, and the remaining _____ is the number before rotation…

A

12 bits total literal,

4 of which are the rotation

8 of which are the number before rotation

22
Q

When encoding literals, the 8 bits must be a value from…

A

0 to 255

23
Q

The number of rotations must always be

A

Even, they can never be odd

24
Q

The number of rotations can never be

A

Odd, must always be even

25
Q

When encoding literals, N rotations right is equal to

A

32-N rotations left

26
Q

If, after alignment, the number cannot be encoded in _____ bytes….

A

1 bytes (8 bits), the number cannot be encoded

27
Q

To align the pattern of the literal,

A

Augment the pattern by zeros to make it 8 bits in total (the 0-to-255 value). Make sure that the number of the other zeros to the left and to the right are even, OR the length of left and right pattern are even

28
Q

What are the three kinds of addressing modes?

A

Literal, Register Direct, and Register Indirect

29
Q

What addressing modes are supported by ARM?

A

Literal and Register Indirect

30
Q

What addressing mode is not supported in ARM?

A

Register Direct?

31
Q

What is literal addressing?

A

loading a register with a literal amount in the instruction

32
Q

What is Register Direct addressing?

A

load the contents of a memory location into a register

not supported by ARM

33
Q

What is Register Indirect addressing?

A

load a register with the contents of a memory location pointed at by a register

34
Q

In register indirect addressing, what is the format?

A

Indicated by means of square brackets:
LDR r1,[r0]

;[r1] ← [[r0]]

35
Q

What is base plus displacement addressing?

A

The effective address of an operand is computed by adding the contents of a register to a literal offset encoded into the load/store instruction

36
Q

In ARM indirect addressing, the offset can be…

A

A second register so that you can use a dynamic offset that can be modified at runtime:

LDR r2,[r0,r1]
;[r2] ← [[r0] + [r1]]

37
Q

In ARM indirect addressing, what can be used to SCALE an offset?

A

Logical shifts can also be used to scale an offset:

LDR r2,[r0,r1,LSL #2] ;[r2] ← [[r0] + [r1] × 4]

38
Q

What are the two types of auto-indexing modes in ARM?

A

Auto-indexing pre-indexed

Auto-indexing post-indexed

39
Q

What is pre-indexing in ARM? What is the syntax?

A

Pre-Index: LDR r0,[r1,#8]!

Load r0 with contents of memory location stored in (r1 + 8) and then increment r1 by 8

The offset can also be an index register, for example, “r2” instead of “#12”, or can be an index register with shift, for example, “r2,LSL#3” instead of “#12”

40
Q

What is post-indexing in ARM? What is the syntax?

A

Post-Index: LDR r0,[r1],#8

Load r0 with the contents pointed at by r1 and then increment r1 by 8

The offset can also be an index register, for example, “r2” instead of “#12”, or can be an index register with shift, for example, “r2,LSL#3” instead of “#12”