Barrel Shifter Flashcards

1
Q

Barrel Shifter

A

The barrel shifter is a functional unit which can be used in a number of different circumstances. It provides five types of shifts and rotates which can be applied to Operand2. (These are not operations themselves in ARM mode.)

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

LSL – Logical Shift Left

Example: Logical Shift Left by 4.

A


Equivalent to << in C.

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

LSR – Logical Shift Right

Example: Logical Shift Right by 4.

A

Equivalent to >> in C. i.e. unsigned division by a power of 2.

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

ASR – Arithmetic Shift Right

Example: Arithmetic Shift Right by 4, positive value.

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

ASR – Arithmetic Shift Right

Example: Arithmetic Shift Right by 4, negative value.

A


Equivalent to >> in C. i.e. signed division by a power of 2.

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

ROR – Rotate Right

Example: Rotate Right by 4.

A


Bit rotate with wrap-around.

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

RRX – Rotate Right Extended

Example: Rotate Right Extended.

A


33-bit rotate with wrap-around through carry bit.

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

MOV r0, r0, LSL #1

A

Multiply R0 by two.

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

MOV r1, r1, LSR #2

A

Divide R1 by four (unsigned).

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

MOV r2, r2, ASR #2

A

Divide R2 by four (signed).

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

MOV r3, r3, ROR #16

A

Swap the top and bottom halves of R3.

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

ADD r4, r4, r4, LSL #4

A

Multiply R4 by 17. (N = N + N * 16)

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

RSB r5, r5, r5, LSL #5

A

Multiply R5 by 31. (N = N * 32 – N)

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

Certain C operations don’t map onto available CPU operations. \_\_\_ and\_\_\_ are two of those operations.

A

At the start I mentioned that certain C operations don’t map onto available CPU operations. ROR andRRX are two of those operations.

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

Certain ARM instructions such as \_\_\_, ___ and \_\_\_ cannot use the barrel shifter.

A

Certain ARM instructions such as MUL, CLZ and QADD cannot use the barrel shifter.

17
Q
A