473,399 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

MIPS to C

mia023
89
if i have the following MIPS code:
sll $t1,$s3,2
add $t1,$t1,$s6
lw $t0,0($t1)
bne $t0,$s5,Exit
Loop:
addi $s3,$s3,1
add $t1,$t1,4
lw $t0,0($t1)
beq $t0,$s5,Loop

Exit:

how should i write the c code of the following?
i seriously don't know how to convert from MIPS to C
Oct 31 '08 #1
4 12979
r035198x
13,262 8TB
You have to learn both MIPS and C then. There is no point in providing all the code for you.
Oct 31 '08 #2
mia023
89
is there any tutorial that you know that can help??
Oct 31 '08 #3
r035198x
13,262 8TB
Google has lots of links to both MIPS and C tutorials.
Oct 31 '08 #4
donbock
2,426 Expert 2GB
Can you read MIPS assembler code? Start off by commenting the MIPS code snippet. What is it doing? What is the logical meaning of inputs used by the snippet; of outputs passed out of the snippet?

Once you know what the MIPS code does, write a C program that does the same thing. You should definitely NOT focus on translating each line of assembler into an equivalent line of C.

This little snippet of MIPS code doesn't stand alone. How do you get into it; how do you get out of it? Is this perchance an assembly language function called from a C program? If so, look at the context in the C program around where the MIPS function is called. That might give you a clue to what the snippet is supposed to do.
Oct 31 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Milk | last post by:
Hi, i got a program working half part and my program is suppose to do 4*4 matrix can any one help me to check it? i dunno whic part i did wrong thx~~ Here is the program ::::: .data arrayA:...
5
by: gb | last post by:
Hi, I have a small program which opens a file (Whose content is a mac address in the form xx:xx:xx:xx:xx:xx) and uses fscanf() to get individual bytes into an array which is defined as "unsigned...
126
by: ramyach | last post by:
Hi friends, I need to write a parallel code in 'C' on the server that is running SGI Irix 6.5. This server supports MIPS Pro C compiler. I don't have any idea of parallel C languages. I looked...
4
by: nickpreiser | last post by:
Hi Everyone, I trying to get a build of Python together to run on an Embedded Linux / Mips machine. I run the ./configure --host= XXXmips(my mips proc) --build=XXX x86(my pc). and the...
1
by: shell6 | last post by:
Ok, so I want to generate MIPS ASM from C/C++ code. I tried using binutils through cygwin but that just plain doesn't work. Microsoft Visual C++ is refusing to do it... Does anybody have a free...
1
by: sekhar_ps | last post by:
whats the difference between mips and mcps
4
by: angel120 | last post by:
I'm taking a MIPS class, and our first project is to prompt the user to input 8 numbers (using a for loop & an array), and output the minimum and maximum numbers of the array. I wrote the program...
6
by: waxinwaxout | last post by:
I'm compiling the same set of c++ sources to both x86 (32 & 64) and to mips32. For x86 I'm using gcc 4.1.2 and for mips I'm using gcc 3.4.6. What I don't understand is why the mips binaries are...
1
by: jty0734 | last post by:
if you have mips cross compiler, please convert this c code to mips code. i'm try to install mips compiler 3 days, but some error fail to that. so if you have something cross compiler c code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.