Modify the ARMSIM program to do the following:
1) output the square sum of the data
2) output the sum of all negatives and positives separately
.text @ Direvtive
.global _start @ declare global begining
_start:
LDR R1,=idx @ content of idx is length of Vec and now R1 is a
counter.
LDR R1,[R1] @ R1 is now the length of Vec. read inderectly
LDR R2,=Vec @ R2 is the address of first element of vector
MOV R0,#0 @ R0 is a Register to accumolate the summation of the
element of the vector.
LOOP: LDR R3,[R2] @ R3 = Vec[i]
ADD R0,R0,R3 @ R0 = R0 + Vec[i]
ADD R2,R2,#4 @ R2 pointing to the next element of vector
SUB R1,R1,#1 @ contor elemente este decrementat
CMP R1,#0 @ if counter = 0, end of Vec
BNE LOOP @ loop until R1=0
MOV R0,R0, ASR #4 @ Divding R0=SUM by 16
LDR R1,=Avg @ R1 now is the address of the Avg
STR R0,[R1] @ Inderect writing for average results in Avg
MOV R1,R0 @ Making R1 ready for print out
MOV R0,#1 @ To print out using SWI 0x6b
SWI 0x6b @ Printing the contant of R1
SWI 0x11 @ Termination
.data @ Directive for begining of data part
.align @ Directive for alagnment of memory addresses
idx: .word 16 @ Total number of elements of vector
Vec: .word -7,3,5,1 @ vector initiation
.word -3,5,-18,-10
.word 2,-1,0,6
.word -10,-9,8,2
Avg: .skip 4 @ results
.end
PART 1(SUM OF SQUARES )
.text
@ Direvtive
.global
_start
@ declare global begining
_start:
LDR
R1,=idx
@ content of idx is the length of Vec and now R1 is a
counter.
LDR R1,[R1]
@ R1 is now the length of Vec. read inderectly
LDR R2,=Vec
@ R2 is the address of first element of vector
MOV R0,#0
@TO STORE SUM OF POSITIVE
INTEGERS.[r0=0]
LOOP:
LDR R3,[R2] @ R3 = Vec[i](r3= vec[0] initially)
MUL R3 @R3= R3*R3
ADD
R0,R0,R3
@ R0 = R0 + (R3*R3)
ADD R2,R2,#4
@ R2 pointing to the next element of vector
SUB R1,R1,#1
@ contor elemente este decrementat
CMP R1,#0
@ if counter = 0, end of Vec
BNE LOOP
@ loop until R1=0
MOV R1 , R0
SWI 0x6b
@ Printing the content of R1
SWI 0x11
@ Termination
.data
@ Directive for begining of data part
.align
@ Directive for alagnment of memory addresses
idx: .word 16
@ Total number of elements of vector
Vec: .word -7,3,5,1
@ vector initiation
.word -3,5,-18,-10
.word 2,-1,0,6
.word -10,-9,8,2
.end
PART 2
.text
@ Direvtive
.global
_start
@ declare global begining
_start:
LDR
R1,=idx
@ content of idx is length of Vec and now R1 is a
counter.
LDR R1,[R1]
@ R1 is now the length of Vec. read inderectly
LDR R2,=Vec
@ R2 is the address of first element of vector
MOV R0,#0
@TO STORE SUM OF POSITIVE
INTEGERS.[r0=0]
MOV R4,#0 @TO STORE SUM OF NEGATIVE INTEGERS[r4=0]
LOOP:
LDR R3,[R2] @ R3 = Vec[i](r3= vec[0] initially)
ITE PL @LOOP FOR POSITIVE AND NEGAVTIVE NUMBERS
ADDPL R0, R0,
R3
@ R0 = R0 + (R3)
ADDMI R4, R4,
R3
@ R4= R0 + (R3)
ADD R2, R2, #4
@ R2 pointing to the next element of vector
SUB R1, R1, #1
@ counter element decrement
CMP R1, #0
@ if counter = 0, end of Vec
BNE LOOP
@ loop until R1=0
MOV R1, R0
SWI 0x6b @ Printing the content of R1(POSITIVE SUM)
MOV R1, R4
SWI 0x6b
@ Printing the content of R1(NEGATIVE SUM)
SWI 0x11 @ Termination
.data
@ Directive for begining of data part
.align
@ Directive for alagnment of memory addresses
idx: .word 16
@ Total number of elements of vector
Vec: .word -7,3,5,1
@ vector initiation
.word -3,5,-18,-10
.word 2,-1,0,6
.word -10,-9,8,2
.end
Modify the ARMSIM program to do the following: 1) output the square sum of the data...
Problem 5 (15pts): Describe what the following program is doing (Do not need to explain each line of instruction. Just show me the purpose of this code). .equ LEDS, Ox100000 10 # define LEDS Ox10000010 .text global start #base address of LEDS on DEO-Nano start: movia r2, LEDS movi r3, 0b00000001 movi r4, OX7FFF slli r4, r4, 3 add r4, r4, r4 load: movi r5, 0b10000000 loop: stw rs, o(r2) mov r6, ro count: addi r6, r6, 1 bne r6,...