(i) Consider the ARM Assembly code:
mov Al, V1, ROR #8
Write a suitable comment for this instruction to explain what is does.
b) If V1 = OxEEBAE213, what would register A1 contain after execution of this instruction?
Copyright By PowCoder代写 加微信 powcoder
or unsigned int.
Write equivalent C code for this instruction. In your answer, consider whether the variable representing the register V1 is a signed
(ii) Consider the following segment of ARM assembly code:
AREA somecode, CODE, READONLY
LDR r1, =0x54545454
r2, =OxFFFFFFFF
How would the above code segment look like after the assembler rewrites the pseudo instructions?
(ili) If 32-bit registers V1 and V2 contain the values OxAA000000 and 0x46000000, find the values of the condition code flags after
executing the following instructions:
a) SUB V1, VI, V2
b) ADD VI, VI, V2
(iv) Convert the following decimal numbers to 12-bit signed binary, with 4 bits of integer and 8 bits of fractional components. Show your
working in the textbox with the answer or as an uploaded image.
(i) Considering the ARM 3-stage pipeline, briefly explain why BL instruction takes longer time to complete its execution.
(ii) You are required to write an AAPCS compliant assembly routine called arrayadd to compute the element-wise addition given by
YU = Al + Bl
for elements O to i, inclusive, for arrays Y, A and B.
Consider the following quidelines:
• The caller (e.g. main) will call this function as arrayadd (arg1, arg2, arg3, arg4, arg5), where the arguments are described below:
o arg1: base address for arrav A
o arg2: base address for array B
o arg3: number of elements in A
o arg4: number of elements in B
o arg5: the first n elements in A and B to perform pair-wise addition.
• It is assumed that these arguments are already set up by the caller and you do not need to implement the caller.
Your function should check whether arg5 is equal to, or less than arguments arg3 and arg4. Return -1 if either of these conditions are
false, indicating the error condition.
Otherwise the element-wise additions should be performed, storing the results in Y, then return O.
All variables are 32-bit integers.
You need to implement the function arrayadd according to the above guidelines.
Optimise vour code for soeed as much as vou can and comment vour code wherever necessarv. while statina anv assumptions vou
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com