3 Assume that the following registers contain these hex cont

3. Assume that the following registers contain these hex contents: R0 = 0xF000, R1 = 0x3456, and R2 = 0xE390. Perform the following operations. Indicate the result and the register where it is stored. Note: the operations are independent of each other. (a) AND R3, R2, R0 (b) ORR R3, R2, R1 (c) EOR R0, R0,# 0x76 (d) AND R3, R2, R2 (e) EOR R0, R0, R0 (f) ORR R3, R0, R2 (g) AND R3, R0,# 0xFF (h) ORR R3, R0,# 0x99 (i) EOR R3, R1, R0 (j) EOR R3, R1, R1

Solution

Given inputs:

R0 = 0xF000,

R1 = 0x3456,

R2 = 0xE390

(a) AND R3, R2, R0

This instruction performs “Bitwise AND” operation between R2, R0 and stores the result in R3. (In simple terms, this instruction is equivalent to R3 = R2 & R0 in C)

Therefore,

            R3 = 0xE390 & 0xF000

Taking in Binary format for ease of understanding,

1110 0011 1001 0000

                                                &

1111 0000 0000 0000

------------------------------

1110 0000 0000 0000 = 0xE000

So, R3 = 0xE000

(b) ORR R3, R2, R1

This instruction performs “Bitwise OR” operation between R2, R1 and stores the result in R3. (In simple terms, this instruction is equivalent to R3 = R2 | R1 in C)

Therefore,

            R3 = 0xE390 & 0x3456

Taking in Binary format for ease of understanding,             

1110 0011 1001 0000

                                                |

0011 0100 0101 0110

------------------------------

1111 0111 1101 0110 = 0xF7D6

So, R3 = 0xF7D6

(c) EOR R0, R0,# 0x76

This instruction performs “Bitwise XOR” operation between R0, the constant value 0x76 and stores the result in R0. (In simple terms, this instruction is equivalent to R0 = R0 ^ 0x76 in C)

Taking in Binary format for ease of understanding,

1111 0000 0000 0000

                                                ^

0000 0000 0111 0110

------------------------------

1111 0000 0111 0110 = 0xF076

So, R0 = 0xF076

(d) AND R3, R2, R2

This instruction performs “Bitwise AND” operation on R2 itself and stores the result in R3. Bitwise AND operation on self is always result in same value.

Therefore,

            R3 = 0xE390 & 0xE390 = 0xE390

(e) EOR R0, R0, R0

This instruction performs “Bitwise XOR” operation on R0 itself and stores the result in R0 only. Bitwise XOR operation on self is always result in zero.

Therefore,

            R0 = 0xF000 ^ 0xF000 = 0x0

(f) ORR R3, R0, R2

This instruction performs “Bitwise OR” operation between R0, R2 and stores the result in R3. (In simple terms, this instruction is equivalent to R3 = R0 | R2 in C)

Therefore,

            R3 = 0xF000 | 0xE390

Taking in Binary format for ease of understanding,             

1111 0000 0000 0000

                                                |

1110 0011 1001 0000

------------------------------

1111 0011 1001 0000 = 0xF390

So, R3 = 0xF390

(g) AND R3, R0,# 0xFF

This instruction performs “Bitwise AND” operation between R0, the constant value 0xFF and stores the result in R3. (In simple terms, this instruction is equivalent to R3 = R0 & 0xFF in C)

Taking in Binary format for ease of understanding,

1111 0000 0000 0000

                                                &

0000 0000 1111 1111

------------------------------

0000 0000 0000 0000 = 0x0

So, R0 = 0x0

(h) ORR R3, R0,# 0x99

This instruction performs “Bitwise OR” operation between R0, constant value 0x99 and stores the result in R3. (In simple terms, this instruction is equivalent to R3 = R2 | 0x99 in C)

Therefore,

            R3 = 0xE390 & 0x0099

Taking in Binary format for ease of understanding,             

1110 0011 1001 0000

                                                |

0000 0000 1001 1001

------------------------------

1110 0011 1001 1001 = 0xE399

So, R3 = 0xE399

(i) EOR R3, R1, R0

This instruction performs “Bitwise XOR” operation between R1, R0 and stores the result in R3. (In simple terms, this instruction is equivalent to R3 = R1 ^ R0 in C)

Therefore,

            R3 = 0x3456 & 0xF000

Taking in Binary format for ease of understanding,

0011 0100 0101 0110

                                                ^

1111 0000 0000 0000

------------------------------

1100 0100 0101 0110 = 0xC456

So, R0 = 0xC456

(j) EOR R3, R1, R1

This instruction performs “Bitwise XOR” operation on R1 itself and stores the result in 3. Bitwise XOR operation on self is always result in zero.

Therefore,

            R3 = 0x3456 ^ 0x3456 = 0x0

3. Assume that the following registers contain these hex contents: R0 = 0xF000, R1 = 0x3456, and R2 = 0xE390. Perform the following operations. Indicate the res
3. Assume that the following registers contain these hex contents: R0 = 0xF000, R1 = 0x3456, and R2 = 0xE390. Perform the following operations. Indicate the res
3. Assume that the following registers contain these hex contents: R0 = 0xF000, R1 = 0x3456, and R2 = 0xE390. Perform the following operations. Indicate the res

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site