Question: How do I convert this C code into Assembly? I am using QTSpim simulator that uses MIPS32. The code I would like to convert to
How do I convert this C code into Assembly? I am using QTSpim simulator that uses MIPS32.
The code I would like to convert to assembly:
int main(void) { int var1[4] ={4, 7, 12, 5}; int var2[4]= {15, 3, 6, 14}; int result[4]={0}; for (int i=0 ; i< 4; i++) result[i] = distance (var1[i], var2[i]); } This is the QTSpim simulator that I would like for you to start out with:
# Comment giving name of program and description of function # Template.s # Bare-bones outline of MIPS assembly language program .data # variable declarations follow this line , Format would be like label: storage_type value(s) var1: .word 3 # create a single integer variable with initial value 3 array1: .byte 'a','b' # create a 2-element character array with elements initialized to a and b array2: .space 40 # allocate 40 consecutive bytes, with storage uninitialized .text # instructions follow this line main: # indicates start of code (first instruction to execute) Func1: Func2:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
