Question: a. We want to implement the following equation using an ATmega32: y = 1310 * 210 + 1520 * 1010 Study the code in Figure

a. We want to implement the following equation using an ATmega32: y = 1310 * 210 + 1520 * 1010 Study the code in Figure Q.3(a) that implements the equation. Data has already been loaded in respective memories and register as shown in Table Q.3(a). 00 GPR (hex) R16 R17 R18 R19 Data Memory (hex) $200 OD $201 OF $202 OA Register (hex) X $0210 Y $0200 z $0500 02 00 00 Table Q.3(a) 1 LD R16, Y+ 2 MUL R16, R17 3 MOVW R1:RO, R17:R16 4 LD R18, Y+ 5 ADD R16, R18 6 MOVW R1:RO, R18:R19 // part a(ii) Figure Q.3(a) (i) Identify three wrong instructions and computation of the code in Figure Q3(a). Re-write the correct instructions for this program. (6 marks) (ii) Construct the final part of the code to complete the computation. Store the value of 16-bit y in memory address pointed by the Z register. (2 marks) a. We want to implement the following equation using an ATmega32: y = 1310 * 210 + 1520 * 1010 Study the code in Figure Q.3(a) that implements the equation. Data has already been loaded in respective memories and register as shown in Table Q.3(a). 00 GPR (hex) R16 R17 R18 R19 Data Memory (hex) $200 OD $201 OF $202 OA Register (hex) X $0210 Y $0200 z $0500 02 00 00 Table Q.3(a) 1 LD R16, Y+ 2 MUL R16, R17 3 MOVW R1:RO, R17:R16 4 LD R18, Y+ 5 ADD R16, R18 6 MOVW R1:RO, R18:R19 // part a(ii) Figure Q.3(a) (i) Identify three wrong instructions and computation of the code in Figure Q3(a). Re-write the correct instructions for this program. (6 marks) (ii) Construct the final part of the code to complete the computation. Store the value of 16-bit y in memory address pointed by the Z register. (2 marks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
