Quantcast
Channel: MIPS assembly for a simple for loop - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by Maria for MIPS assembly for a simple for loop

add $vo, $vo, $zero add $t0, $t0, $zeroLOOP: slti $t1, $t0, 15 beq $t1, $zero, EXIT addi $t0, $t0, 1 addi $t2, $zero, 2 mul $t3, $v0, $t2 addi $v0, $t3, 3 j LOOPEXIT:

View Article



Answer by Meech for MIPS assembly for a simple for loop

I also don't know what MIPS simulator you're running, but I knowsome of them don't constants and they demand you assign those toregisters. So like bgt Rsrc1, Src2, label, normally if you put aninteger...

View Article

Answer by Raul Batalha for MIPS assembly for a simple for loop

.datamensage: asciiz "Text Test"newline: asciiz "\n".text# tmp = $v0# j = $t0main: li $t0,0 li $t1,0 li $t3,0loop: bgt $t0,15,exit addi $t0,$t0,1 j loop mul $t1,$t1,2 add $t3,$t1,3 exit: li $v10,0 syscall

View Article

Answer by Richard Pennington for MIPS assembly for a simple for loop

You don't set j ($t0) to zero before the loop.

View Article

Answer by MrD for MIPS assembly for a simple for loop

Your loop goes from 0 to 14, so your bgt instruction should be: bgt $t0,14,exit I think..

View Article


MIPS assembly for a simple for loop

I need to translate this C code to MIPS assembly.Here is the C code:int tmp = 0; for (int j = 0; j < 15; ++j) tmp = tmp * 2 + 3This is my MIPS assembly code. Is it a correct translation? If you see...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images