mips

Mips translating problems

眉间皱痕 提交于 2020-01-16 17:15:23
问题 I am having trouble translating this pseudo code to mips assembly i have added the registers i am using to help understand what is going on # if (n == 1) # return 1 # else if (n == 2) # return 6 # else # return 2*hex(n-1) - hex(n-2) + 4 # (hex) Registers: # $a0 - n, the argument # $v0 - the result the n-th Hexamorphic number # $t0 - holds hex(n-2) # $t1 - holds constants 1 # $t2 - holds constant 2 here is where i am at in my code i feel confident about hex: and elseif: but the else: is where

Mips translating problems

荒凉一梦 提交于 2020-01-16 17:14:19
问题 I am having trouble translating this pseudo code to mips assembly i have added the registers i am using to help understand what is going on # if (n == 1) # return 1 # else if (n == 2) # return 6 # else # return 2*hex(n-1) - hex(n-2) + 4 # (hex) Registers: # $a0 - n, the argument # $v0 - the result the n-th Hexamorphic number # $t0 - holds hex(n-2) # $t1 - holds constants 1 # $t2 - holds constant 2 here is where i am at in my code i feel confident about hex: and elseif: but the else: is where

Unable to run linux 3.10(mips) on qemu 2.5

我是研究僧i 提交于 2020-01-16 11:38:28
问题 I want to run linux 3.10 with mips64r2 on qemu. But it fails, the boot log as follows, I compile the kernel with the gcc 4.9.3 which is modified by loongson. The kernel config file is the malta_defconfig and i change it to mips64r2 cpu and 64 bit kernel. The qemu 2.5 is the default application on the ubuntu 16.04. zlp@lab302i-ES:~/projs/linux-3.10$ qemu-system-mips64el -M malta -m 1G -cpu 5KEf -kernel vmlinux -nographic Linux version 3.10.0 (zlp@lab302i-ES) (gcc version 4.9.3 20150626 (Red

What are shadow registers in MIPS and how are they used?

心不动则不痛 提交于 2020-01-14 09:32:45
问题 When I read about MIPS architecture, I came across shadow registers which are said to be copies of general purpose registers. I couldn't understand the following: When are shadow registers used? 回答1: MIPS shadow registers are used to reduce register load/store overhead in handling interrupts. An interrupt to which a shadow register set is assigned does not need to save any of the existing context to provide free registers or load any interrupt-specific data stored in the shadow registers at

What are shadow registers in MIPS and how are they used?

别来无恙 提交于 2020-01-14 09:32:31
问题 When I read about MIPS architecture, I came across shadow registers which are said to be copies of general purpose registers. I couldn't understand the following: When are shadow registers used? 回答1: MIPS shadow registers are used to reduce register load/store overhead in handling interrupts. An interrupt to which a shadow register set is assigned does not need to save any of the existing context to provide free registers or load any interrupt-specific data stored in the shadow registers at

MIPS Assembly - Arrays?

假装没事ソ 提交于 2020-01-13 18:06:47
问题 I am absolutely brand new to assembly programming and am trying to implement the following function (in C) in MIPS: int main() { int A[5]; // Empty memory region for 5 elements int B[5] = {1,2,4,8,16}; int i; for(i=0; i<5; i++) { A[i] = B[i] - 1; } i--; while(i >= 0) { A[i]=(A[i]+B[i]) * 2; i--; } } So far what I have is this: main: #Register Map #i --> $s0 #A[0] --> $s1 address of start of A #B[0] --> $s2 address of start of B #A[i] --> $t0 #B[i] --> $t1 #(A[i] + B[i]) --> $t2 #((A[i] + B[i]

MIPS Assembly - Arrays?

可紊 提交于 2020-01-13 18:05:25
问题 I am absolutely brand new to assembly programming and am trying to implement the following function (in C) in MIPS: int main() { int A[5]; // Empty memory region for 5 elements int B[5] = {1,2,4,8,16}; int i; for(i=0; i<5; i++) { A[i] = B[i] - 1; } i--; while(i >= 0) { A[i]=(A[i]+B[i]) * 2; i--; } } So far what I have is this: main: #Register Map #i --> $s0 #A[0] --> $s1 address of start of A #B[0] --> $s2 address of start of B #A[i] --> $t0 #B[i] --> $t1 #(A[i] + B[i]) --> $t2 #((A[i] + B[i]

MIPS Assembly - Arrays?

ぃ、小莉子 提交于 2020-01-13 18:04:22
问题 I am absolutely brand new to assembly programming and am trying to implement the following function (in C) in MIPS: int main() { int A[5]; // Empty memory region for 5 elements int B[5] = {1,2,4,8,16}; int i; for(i=0; i<5; i++) { A[i] = B[i] - 1; } i--; while(i >= 0) { A[i]=(A[i]+B[i]) * 2; i--; } } So far what I have is this: main: #Register Map #i --> $s0 #A[0] --> $s1 address of start of A #B[0] --> $s2 address of start of B #A[i] --> $t0 #B[i] --> $t1 #(A[i] + B[i]) --> $t2 #((A[i] + B[i]

How do I correctly use the mod operator in MIPS?

时光怂恿深爱的人放手 提交于 2020-01-13 10:58:14
问题 In MIPS, I am confused on how to get the mod to work. Below is the code I have come up with thus far. I may have more errors besides the mod, but I feel those errors are a result of the mod misunderstanding. All I'm trying to do is to get the working code (python) here: i = 1 k = 0 while i < 9: if i % 2 != 0: k = k + i i += 1 print(k) to be correctly translated into MIPS. This is my first shot at assembly, so there may be more than mod errors that are tripping me up in the code below: # Takes

Need help with MIPS program

梦想与她 提交于 2020-01-11 12:44:20
问题 I'm working on a mips program that will run on pcspim and i need a little help. The description of the program is: Write a program that reads a string (from a keyboard), stores it in the memory, and computes and prints the frequency of each character; and then it reverses the string and prints the reversed string. so far i have is... .data # Data declaration section userString: .space 256 Prompt: .asciiz "\nEnter a word: " newLine: .asciiz "\n" .text main: # Start of code section li $v0, 4 la