Question: Write an ARMv 8 assembly function ( using Linaro Toolchain ) named count _ wd that finds the number of three - letter words in
Write an ARMv assembly function using Linaro Toolchain named countwd that finds the number of threeletter words in a given sentence. The base address of the input sentence CString is passed using register X and the number of three letter words is returned using register X Write an assembly program main to test the assembly function. Create a static character array CString for the input sentence which is stored in the data section of the assembly code and the base address is passed to the function. The user's input sentence will be in correct format without errors and will not have punctuation marks. The maximum size of the input sentence is characters. Store the returned value number of threeletter words from the function in register X Assume all the registers are used by the main caller program to store some data before calling the function. Assemble, test, and simulate the assembly code using DS simulator. Do not upload the entire DS project. Only upload the assembly file S file from the DS project. Comment your assembly code.
Example Assembly code stringcode.S that shows how to store and read strings:
This assembly code simply loads the lower case alphabets from the below
static array str and converts the alphabets to a upper case alphabets
and stores the upper case alphabets in static array str
data data section
type strobject defining object str
size str string
type strobject defining object str
size str string
str:
asciz "abc char values as string
str:
byte null char values
text program section
global main main
arch armvafpsimd processor type
type main, function main function
main:
ADR X str Load the array address to X
ADR X str Load the array address to X
LDURB WX # Load the first char from string
SUB W W # Convert to upper case
STURB WX # Store the upper case alphabet to string
LDURB WX # Load the second char from string
SUB W W # Convert to upper case
STURB WX # Store the upper case alphabet to string
LDURB WX # Load the third char from string
SUB W W # Convert to upper case
STURB WX # Store the upper case alphabet to string
LDURB WX # Load the null from string
STURB WX # Store the null to string
NOP
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
