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

Purpose of this project is to increase your understanding of data, address, memo

ID: 3861280 • Letter: P

Question

Purpose of this project is to increase your understanding of data, address, memory contents, and strings. You will be expected to apply selected MIPS assembly language instructions, assembler directives and system calls sufficient enough to handle string manipulation tasks. You are tasked to develop a program that finds how many times a word is used in a given statement. To test your program, you should hardcode the below sample statement in your code, and ask user to input two different words, which are "UCF" and "KNIGHTS" in this project, however your code should work for any words with less than 10 characters. Your program should not be case sensitive and regardless of the way user inputs the words it should correctly find the words. Sample Statement: UCF, its athletic program, and the university's alumni and sports fans are sometimes jointly referred to as the UCF Nation, and are represented by the mascot Knightro. The Knight was chosen as the university mascot in 1970 by student election. The Knights of Pegasus was a submission put forth by students, staff, and faculty, who wished to replace UCF's original mascot, the Citronaut, which was a mix between an orange and an astronaut. The Knights were also chosen over Vincent the Vulture, which was a popular unofficial mascot among students at the time. I11 1994, Knightro debuted as the Knights official athletic mascot. Sample Output: Please input first word: Knight (or KnIGhT, knight, ...) Please input second word: UCF (or ucf, UcF, ...) KNIGHT: - 6

Explanation / Answer

.data

    str: .space 100
    input: .space 10
    ins: .asciiz "Please enter a sentence: "
    seek: .asciiz "Please enter a word: "
    nomatch: .asciiz "No Match(es) Found"
    found: .asciiz " Match(es) Found"
    newline: .asciiz " "

    .text

    li $v0, 4
    la $a0, ins
    syscall

    li $a1, 100
    la $a0, str
    li, $v0, 8
    syscall

    move $t9, $a0

    li $v0, 4
    la $a0, seek
    syscall

    la $a0, input
    li $a2, 30
    li, $v0, 8
    syscall

    move $t8, $a0
    la $s5, input

    wloop:
    lb $t0, 0($t8)
    beqz $t0, sentence
    sb $t0, 0($s5)
    addi $t8, $t8, 1
    addi $s5, $s5, 1
    j wloop

    la $s4, str

    sentence:
    lb $t0, 0($t9)
    beqz $t0, resetsen
    sb $t9, 0($s4)
    addi $t9, $t9, 1
    addi $s4, $s4, 1
    j sentence

    resetsen:
    li $s4, 0

    resetword:
    li $s5, 0

    check:
    lb $t1, 0($s4)
    beq $t1, 46, quit
    bne $t1, 70, nextword
    beq $t1, 70, checkword

    nextword:
    lb $t1, 0($s4)
    beq $t1, 46, quit
    bne $t1, 32, increment
    beq $t1, 32, plusone
    increment:
    addi $s4, $s4, 1
    j nextword
    plusone:
    addi $s4, $s4, 1
    j resetword

    checkword:
    addi $s4, $s4, 1
    addi $s5, $s5, 1
    lb $t1, 0($s4)
    lb $t0, 0($s5)
    bne $t1, $t0, increment
    addi $s4, $s4, 1
    addi $s5, $s5, 1
    lb $t1, 0($s4)
    lb $t0, 0($s5)
    bne $t1, $t0, increment
    addi $s4, $s4, 1
    addi $s5, $s5, 1
    lb $t1, 0($s4)
    lb $t0, 0($s5)
    bne $t1, $t0, increment
    addi $s4, $s4, 1
    addi $s5, $s5, 1
    lb $t1, 0($s4)
    lb $t0, 0($s5)
    bne $t1, $t0, increment
    addi $t2, $t2, 1
    j resetword

    quit:
    beqz $t2, exit
    li $v0, 1
    move $a0, $t2
    syscall
    li $v0, 4
    la $a0, found
    syscall
    j endprogram

    exit:
    li $v0, 4
    la $a0, nomatch
    syscall

    endprogram:
    li $v0, 10
    syscall

This program is used for taking an input string and searching the number of times a string is coming in the given sentence, the string may be of length 10 or below and it may be case insensitive. This was written in MIPS assembly Language.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote