pcspim

Compile time initialized array error

老子叫甜甜 提交于 2019-12-29 09:37:26
问题 I am trying to make an array to which I have provided the data at compile time in MIPS. but I am getting error and thus the code is not getting compiled. Here is the chunk of code which is causing error. .data array: .space 'A','B','C','D','E','F','G','H','I' What is the reason for error? If you know any tutorials which explain arrays of .space , .byte and .word , please mention them in answer. Regards 回答1: You can't use .space directive for initialized arrays. .space is for reserving N

using multiple mips arguments >4

空扰寡人 提交于 2019-12-24 09:25:10
问题 Im trying to program a function to use extra arguments besides 4 (since my version of mips only supports $a0-$a3) by pushing them on the stack, but my code is incorrect. Here is my code in main (snippet): li $t0,40 #temp value for our 5th arg. addi $sp, $sp, -4 #decrement stack pointer by 4 sw $t0, 0($sp) #save the value of $t0 on the stack. jal printf which sets a temporary value of 40, gives space on the stack, and saves it. My function is then called. As a test to see if this worked,

Show division result in MIPS

眉间皱痕 提交于 2019-12-11 23:20:10
问题 Merged with Use the floating point instructions to get results in decimal. Hi I'm coding a small program in MIPS and I have this code li $v0, 2 div $t0,$t2,$t1 move $a0,$t0 syscall (it's not the full code, just the section handling division) Where $t1 is 2, $t2 is 9. So, 2/9 is 0.2222222222222222 But when I run it I only get 0.0 Why?, how I show the true result? Thanks in advance. 来源: https://stackoverflow.com/questions/6513610/show-division-result-in-mips

MIPS ADDIU confusion

不羁岁月 提交于 2019-12-08 11:58:10
问题 I am doing an assignment on single cycle MIPS processor and I am a little confused on the addiu instruction. On this website, as my reference the author states that the immediate will be sign extened Description: Adds a register and a sign-extended immediate value and stores the result in a register Operation: $t = $s + imm; advance_pc (4); Syntax: addiu $t, $s, imm Encoding: 0010 01ss ssst tttt iiii iiii iiii iiii If I have the following instructions lui $3,0x1001 addiu $3,$3,0x8010 and I

Compile time initialized array error

♀尐吖头ヾ 提交于 2019-11-29 17:39:31
I am trying to make an array to which I have provided the data at compile time in MIPS. but I am getting error and thus the code is not getting compiled. Here is the chunk of code which is causing error. .data array: .space 'A','B','C','D','E','F','G','H','I' What is the reason for error? If you know any tutorials which explain arrays of .space , .byte and .word , please mention them in answer. Regards You can't use .space directive for initialized arrays. .space is for reserving N uninitialized bytes. You can use .byte or .word for such purpose, depending on the size of your data. In your