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

Please add thorough comments so I can understand the thought process Using figur

ID: 1846859 • Letter: P

Question

Please add thorough comments so I can understand the thought process




Using figure 9.3 on page 141 in the book as a guide, implement a full program, using a jump table, that takes in three arguments (x, y and z) and performs the following operations: If x = 0: load in an element from a table of data, whose base address is given by y and element number is given by z. if the loaded element is a negative number (2's complement), make it positive. If positive, make it negative. If zero, leave unchanged. Store the new element back into the same place in memory it was retrieved from. If x = 1: compare y to z. if y > z, calculate yAz and store in memory. If z > y, calculate zAy and store in memory. If y = z, calculate y * z and store in memory. Else: do nothing. Create your own table of data for use by the x=0 function. It should contain at least 5 elements. You will be given test data during lab time for which your code must work to receive credit. To receive full credit, your code must not only be functional, but efficient as well. Programs with excessive branches, unnecessary "brute force" methods, or that exploit some unforeseen loophole will be docked points. Use the methods discussed in class to avoid this. We have discussed that branches can be useful, but can lead to inefficiency behind the scenes due to issues in the pipeline. Discuss some other potential advantages and disadvantages of using branches in SoC applications outside of personal computing (recall where we might see ARM devices outside of computers). will be given for lab report, which should meet all general lab report formatting requirements discussed in class. The report should be written so that someone with no prior experience with the experiment can understand and perform the experiment, completely replicate your results, and understand your approach. What is the relationship between the individual wattmeter readings and the total three- phase power? Is it possible that one wattmeter may indicate a negative value? If so. under what conditions will this occur? Will the two-wattmeter method work for all three-phase loads (e.g., unbalanced loads, inductive loads, capacitive loads, delta-connected loads)? Will the two-wattmeter method work for an unbalanced source?

Explanation / Answer

AREA data1,DATA

result DCW 0 ; to store the end result

ALIGN

END


AREA Jump, CODE, READONLY

CODE32

ENTRY

start

MOV R0,#0 ; Setup three parameters x

MOV R1,#0 ; y

MOV R2,#0 ; z

BL main ; Call the main routine

stop

B stop ;


main

CMP R0,#2 ; checking if x = 0

MOVHS pc,lr ; x is not 0 or 1 so return

ADR R3, JumpTable

LDR pc, [R3,R0,LSL#2]


JumpTable

DCD Zero

DCD One


Zero

LDR R3,[R1,R2,LSL#2] ; load the element

MVN R3,R3 ; Invert all the bits in the loaded element

ADD R3,R3,#1 ; Add 1 to the inverted element to find 2's complement

;No need of condition here, as every condition will perform 2's compliment

; positive to negative, negative to positive, zero to zero

STR R3,[R1,R2,LSL#2] ; store the element

MOV pc,lr ; return


One

EOR R4,R4 ; clear contents of R4

ADD R4,R4,#1 ; load R4 with 1

CMP R1,R2 ; compare y,z

BGT Greater ; y>z

BLT Lesser ; y<z

MUL R0,R1,R2 ; y*z for y=z

STR R0,result ; store the result in memory


Greater

MOV R0,R1 ; R0 = y

MOV R3,R2 ; R3 = z

B R0powerR3 ; branch to calculate y^z


Lesser

MOV R0,R2 ; R0 = z

MOV R3,R1 ; R3 = y


R0powerR3 ; routine to calculate R0^R3

CMP R3,#0 ;

BEQ done ; calculation is completed

MUL R4,R0,R4 ; R4 = R4 * R0

SUB R3,R3,#1 ; R3 = R3 - 1

B R0powerR3 ; loop back to calculate R0powerR3


done

STR R4,result ; store the result in memory

MOV pc,lr ; return

END


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote