Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The code is executed for the datawords listed above. Initially the general purpo

ID: 3683089 • Letter: T

Question

The code is executed for the datawords listed above. Initially the general purpose registers contain 0. Complete the table below by filling in its columns for every instruction in sequence from the first until a branch away from this code occurs. The first instuction is already filled to show the infro required.

Hex sequence of addresses in PC | Sequence of fetched instructions. EA in memory if there is a memory access | Contents after exection [R1],[R2],[R3],[R4]

0x70 | Load R1, KEY EA = 0x406 | 0x0A,0,0,0

The following assembly language is part of a larger program. The first instruction is at byte address 112_10 = 0x70 and the 32-bit data words begin at byte address 1030_10 = 0x406. LOAD R1, KEY AND R1, R1, #0xFF LOAD R2, N MOVE R4, #Data1 Loop: LOAD R3, (R4) AND R3, R3, #0xFF BR_IF_[R3]=[R1] Yes ADD R4, R4, #4 SUB R2, R2, #1 BR_IF_[R2] > 0 Loop BR No KEY: DATAWORD 0x0A N: DATAWORD 3 Data1: DATAWORD 0x31A DATAWORD 10 DATAWORD 0x55A This code searches N data words at consecutive addresses in the memory to find out whether an ASCII code is in it the bits 7-0 in any data word. The ASCII code to be searched for is bits 7-0 in the data word with symbolic name KEY. If at least one occurrence is found, the code must branch to Yes; otherwise, the code must branch to No. Symbolic name Yes has word address 2048_10 = 0x800 in a part of the program not listed here; symbolic name No has word address 4096_10 = 0x1000 also not listed here.

Explanation / Answer

    LOAD R1,KEY
   ADD R1,#0XFF
   LOAD R2,N
   MOVE R4,#DATA1
LOOP:   LOAD R3,R4
   ADD R3,#0XFF
   CMP R3,R1
   JE R3,YES
   ADD ,R4,#4
   SUB R2,#1
   JG R2,0
   JMP NO

KEY:   DATAWORD 0X0A
N:   DATAWORD 3
DATA1:   DATAWORD 0X31A
YES:   DATAWORD 0X800
NO :   DATAWORD 0X1000