Category "mips"

Break down the logic for a C for-loop into something I can implement in MIPS? (count number occurrences in an array)

Hi all i am converting my C code to MIPS but problem is here i couldn't make correct logic for this for (int i=0;i<count;i++) { h[a[i]]++; } as

How do you enter command line arguments in SPIM

I am trying to make programs using argc and argv in MIPS simulator SPIM. This is my code: .data nl: .asciiz "\n" .globl main .text main: # print argv[0] lw

error in partition function (mips assembly)

This is the code I wrote trying to implement the c partition function in mips. There seems to be an error because the program doesn't work, yet I can't find whe

Ho to convert base 10 floating point input to base 2 in MIPS?

I have been tasked with writing a program in MIPS that converts a user-inputted base 10 floating point number to base 2. I am a relatively inexperienced program

How to open a saved .asm file in MARS on MacOS

I am new to using MIPS and I can't find how to open a file that I saved. I saved a .asm file under my downloads folder but when I try to open a file in MARS and

Understanding MIPS while Loops

Given the traditional while loop in C: while(save[i] == k) i += 1; The answer in MIPS is such: The first step is to load save[i] into a temporary reg

partition function in c and MIPS

I was trying to write some MIPS code that simulates a C function, but it seems like I've come across an obstacle that I cant get over it. int partition(int f, i

adressing in MIPS the proper way

what does the following line mean. is it taking the 4 bytes (16 bits) of whatever bit pattern is at $a3 and storing it to $t0? lw $t0, 4($a3) # extract ch

Optimize a loop for static predict-not-taken? Which prediction problems exist for that in a normal loop?

Which problems arise in the following assembly loop, if Predict Not Taken is chosen by default? Optimize the example to Predict not Taken. addi $s1, $zero, 1024

Is it possible to have a switch/case with mips using a JumpTable for non sequential options?

I want to practice using switch/cases and JumpTables in MIPS. Currently, I am able to achieve a similar logic via stacking several BEQ commands after each other

Understanding bubble vs stall vs repeated decode/fetch

I'm really confused on the difference between bubbles, stalls, and repeated decoding/fetching. My text is the Patterson text, 3rd edition. Example 1: add $3,