MIPS CODE :
$LFB0 = .
main:
addiu $sp,$sp,-248
sw $31,244($sp)
sw $fp,240($sp)
move $fp,$sp
lui $2,%hi($LC0)
addiu $4,$2,%lo($LC0)
jal printf
nop
addiu $2,$fp,236
move $5,$2
lui $2,%hi($LC1)
addiu $4,$2,%lo($LC1)
jal scanf
nop
lui $2,%hi($LC2)
addiu $4,$2,%lo($LC2)
jal puts
nop
$LBB2 = .
sw $0,24($fp)
lw $2,236($fp)
lw $3,24($fp)
nop
slt $2,$3,$2
beq $2,$0,$L2
nop
addiu $3,$fp,36
lw $2,24($fp)
nop
sll $2,$2,2
addu $2,$3,$2
move $5,$2
lui $2,%hi($LC1)
addiu $4,$2,%lo($LC1)
jal scanf
nop
lw $2,24($fp)
nop
addiu $2,$2,1
sw $2,24($fp)
b $L3
nop
$LBE2 = .
lui $2,%hi($LC3)
addiu $4,$2,%lo($LC3)
jal puts
nop
$LBB3 = .
sw $0,28($fp)
lw $2,236($fp)
lw $3,28($fp)
nop
slt $2,$3,$2
beq $2,$0,$L4
nop
lw $2,28($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $2,12($2)
nop
move $5,$2
lui $2,%hi($LC4)
addiu $4,$2,%lo($LC4)
jal printf
nop
lw $2,28($fp)
nop
addiu $2,$2,1
sw $2,28($fp)
b $L5
nop
$LBE3 = .
lui $2,%hi($LC5)
addiu $4,$2,%lo($LC5)
jal puts
nop
$LBB4 = .
lw $2,236($fp)
nop
addiu $2,$2,-1
sw $2,32($fp)
lw $2,32($fp)
nop
bltz $2,$L6
nop
lw $2,32($fp)
nop
sll $2,$2,2
addiu $3,$fp,24
addu $2,$3,$2
lw $2,12($2)
nop
move $5,$2
lui $2,%hi($LC4)
addiu $4,$2,%lo($LC4)
jal printf
nop
lw $2,32($fp)
nop
addiu $2,$2,-1
sw $2,32($fp)
b $L7
nop
$LBE4 = .
move $2,$0
move $sp,$fp
lw $31,244($sp)
lw $fp,240($sp)
addiu $sp,$sp,248
j $31
nop
Introduction: In this lab, you will write a MIPS program to read in (up to) 50...
MIPS 1(a): Using MARS (MIPS assembly simulator), write and debug a program with comments that will store words in a RAM array using the instruction sw and indirect addressing as specified in the data table below. Although the addresses and data are in given hexadecimal, your code will contain corresponding values in decimal. Use (268501056)_10 = (10010040)_16 as the base address of the array. Since the instruction sw and indirect addressing (using offsets) are needed to store the data in...
The name of the C++ file must be search.cpp Write a program that will read data from a file. The program will allow the user to specify the filename. Use a loop that will check if the file is opened correctly, otherwise display an error message and allow the user to re-enter a filename until successful. Read the values from the file and store into an integer array. The program should then prompt the user for an integer which will...
Q-1: Write a program in Assembly language using MIPS instruction set that reads 15 integer numbers from user and stores all the numbers in the array intArray. Now, read another integer number N from the user, find the total number of array elements that are greater or equal to the number N, and the total number of array elements that are lower than the number N You must have two procedures: i. ReadIntegerArray: this procedure should read integer array elements...
# ECE 445 Computer Organization # Homework 3, problem 9 # Write a MIPS assembly language program to count the number of positive values in an array of integers. # The array of integers and the array length are provided in the .data section below. # After running your code, the variable count (in memory) should contain the number of positive values in the array Insert your name here > Insert the date here > # Author: # Date: .text...
In C only Please! This lab is to write a program that will sort an array of structs. Use the functions.h header file with your program. Create a source file named functions.c with the following: A sorting function named sortArray. It takes an array of MyStruct's and the length of that array. It returns nothing. You can use any of the sorting algorithms, you would like though it is recommended that you use bubble sort, insertion sort, or selection sort...
Assembly Language////Write a program that read in 10 integers from the user. Save the numbers into an array; reverse the array and display the reversed array. .data arrayInt DWORD 10 DUP(?) Your program consists of 4 procedures: 1. main procedure: call procedures getInput, reverseArray, displayArray 2. getInput procedure: prompt user to enter 10 integer numbers, save the numbers into the memory for the arrayInt 3. reverseArray: reverse arrayInt 4. displayArray: display the reversed array
Exercise 6: Program exercise for 2D List Write a complete Python program including minimal comments (file name, your name, and problem description) that solves the following problem with the main function: Problem Specification: The following code reads values from the file object infile and stores them in the 2d list table2: (It assumes that each line contains values of elements in each row and the values are whitespace separated.) table2 = [] for line in infile: row=line.split() intRow = []...
X86 Assembly language lab: TITLE Lab 3: assembly language fundamentals ;;;;; Q1: Don't forget to document your program ; Name:Yuyan Wang ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; Answer each question below by writing code at the APPROPRIATE places in the file. ;;;;; Hint: the appropriate place is not always right below the question. ;;;;; Q2: Write the directive to bring in the IO library ;;;;; Q3: Create a constant called MAX and initialize it to 150...
Need to write a MIPS assembly program that finds the minimum and maximum and sum of a stored array. It also finds the locations of the minimum and maximum. The interaction between the main program and the function is solely through the stack. The function stores $ra immediately after being called and restores $ra before returning to main. The main program reserves a static C like array (index starts from 0) of 10 elements and initializes it. The maximum should...
2. Searching a String: Write a MIPS assembly language program to do the following: Read a string and store it in memory. Limit the string length to 100 characters. Then, ask the user to enter a character. Search and count the number of occurrences of the character in the string. The search is not case sensitive. Lowercase and uppercase letters should be equal. Then ask the user to enter a string of two characters. Search and count the number of...