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
4 13002
You have to learn both MIPS and C then. There is no point in providing all the code for you.
is there any tutorial that you know that can help??
Google has lots of links to both MIPS and C tutorials.
donbock 2,426
Recognized Expert Top Contributor
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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: .space 1024
arrayB: .space 1024
arrayC: .space 1024
str: .asciiz " "
|
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 char
macaddress". The strange thing is that it prints zeroes on MIPS
processor where as it works correctly on x86 systems. Appreciate if
some body could help to understand the fscanf() behavior.
Here is the code I am using:
|
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 into few posts in this
group. I could make out that there are several languages for parallel
programming and parallel C is one of them. I need to know if this is
supported by MIPS Pro C Compiler. Or are there any other parallel C
languages that have...
|
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
configure runs perfectly. I then run "make" and it fails .
I have also tried appling some patches, and running autoconf , but I
end up with the
same compile errrors.
|
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 compiler
which will run on windows and generate MIPS ASM from my C code.
Thanks ahead of time,
Shell
| |
by: sekhar_ps |
last post by:
whats the difference between mips and mcps
|
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 in C++ (works perfectly), and I've been trying to translate it, but the online tutorials aren't very good. So here's one thing I find difficult to translate:
int array={0};
for (int i=0; i<8; i++)
{
cout << "Input number " << i+1 << ": ";
...
|
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 consistently (and
significantly) larger than the x86 binaries.
Compiling to x86 without any selected optimization level results in a
binary of 961600 bytes while compiling to mips32 with -Os results in a
binary of 1414612 bytes. Both binaries...
|
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 -mips code , please
convert this to me. thx!
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |