Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Counting Occurrences in ARM Assembly Objective: Write an ARM assembly program to count the occurrences of bytes from data 2 within data 1 . Utilize

Counting Occurrences in ARM Assembly
Objective:
Write an ARM assembly program to count the occurrences of bytes from data2 within data1.
Utilize the provided base addresses for data1(0x10000000- X0) and data2(0x20000000- X1).
Requirements:
Data Initialization:
data 1-2527283031333436373940424345
data 2-3031323334353637
Declare two arrays, data1 and data2, with the provided values.
Use the base addresses 0x10000000 for data1 and 0x20000000 for data2.
Counting Occurrences:
Use the base addresses of data1 and data2 to store the data.
Count the occurrences of each byte from data2 within data1 totally.
Store the total number of occurrences in X5 register.
Code :
MOVZ X0, #0x1000, LSL #16
MOVK X0, #0x0000, LSL #0
MOVZ X1, #0x2000, LSL #16
MOVK X1, #0x0000, LSL #0
MOVZ X2, #30
MOVZ X3, #8
MOVZ X4, #25
MOVZ X6, #7
MOVZ X7, #7
MOVZ X9, #8
MOVZ X10, #14
store_values_data2:
STURB X2,[X1]
ADDI X1, X1, #1
SUBI X3, X3, #1
ADDI X2, X2, #1
CBNZ X3, store_values_data2
SUBI X1, X1, #8
store_values_data1:
STURB X4,[X0]
ADDI X0, X0, #1
SUBI X6, X6, #1
SUBI X7, X7, #1
ADDI X4, X4, #2
STURB X4,[X0]
ADDI X0, X0, #1
ADDI X4, X4, #1
CBNZ X6, store_values_data1
CBNZ X7, store_values_data1
SUBI X0, X0, #14
loop:
LDURB X9,[X1]
ADDI X1, X1, #1
occurrancy:
LDURB X10,[X0]
ADDI X0, X0, #1
SUB X11, X9, X10
CBNZ X11, jump
ADDI X5, X5, #1
jump:
SUBI X9, X9, #1
CBNZ X10, occurrancy
MOVZ X1, #0x1000, LSL 16
MOVZ X10, #8
SUBI X9, X9, #1
CBNZ X9, loop
Please make my code workable and work in legv8 simulator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

What is multiple correlation Rxy?

Answered: 1 week ago

Question

Explain the various inventory management techniques in detail.

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago