mips

Dynamic vs Static instruction count

梦想与她 提交于 2020-08-27 07:17:20
问题 What is the difference between dynamic and static instruction count? a. Derive an expression to calculate the user CPU time as a function of following parameters: the dynamic instruction count (N), clock cycle per instruction (CPI) and clock frequency (f) b. Explain the reason for choosing ‘dynamic’ instruction count as a parameter in Question 3a instead of ‘static’ instruction count 回答1: The dynamic instruction count is the actual number of instructions executed by the CPU for a specific

Alternative to mul/mult for multiplication in assembly (MIPS)?

不羁岁月 提交于 2020-07-30 07:41:39
问题 I'm implementing a simple single-cycle MIPS processor for a class, and the only operations we implemented are lw , sw , j , addi , or , and , add , sub , beq , slt , jr , andi , jal , bne and sll . I have to write a MIPS file testing a factorial function. Obviously, I can't use instructions that haven't been implemented but since factorial means: result = n * factorial(n-1) , I need a way to multiply two values. Is there a way to do that with the instructions mentioned earlier? EDIT: I got it

Difference between Syscall and Traps

ⅰ亾dé卋堺 提交于 2020-07-18 08:09:30
问题 I am wondering if there is any difference between the MIPS syscall and trap instructions. I can't find anything involving this, so I am not sure if there is a difference. Traps seem to just be a conditional syscall, but some clarifying can be helpful. 回答1: The SYSCALL and TRAP instructions both trigger exceptions, but the resulting exception is of a different type (SystemCall versus Trap), and the operating system will likely handle them differently. 回答2: A Trap is an exception switches to

Difference between Syscall and Traps

▼魔方 西西 提交于 2020-07-18 08:08:12
问题 I am wondering if there is any difference between the MIPS syscall and trap instructions. I can't find anything involving this, so I am not sure if there is a difference. Traps seem to just be a conditional syscall, but some clarifying can be helpful. 回答1: The SYSCALL and TRAP instructions both trigger exceptions, but the resulting exception is of a different type (SystemCall versus Trap), and the operating system will likely handle them differently. 回答2: A Trap is an exception switches to

Caesar cipher encrypting a single character in MIPS

心不动则不痛 提交于 2020-07-16 10:22:00
问题 I'm having some problems in creating a program to encrypt a message. At this point i'm just trying to input a char and the output should be the char+5 positions in the alphabet. So the program should read the char in ASCII and add 5 to it and then print the letter. Ex.: Input: A Output: F It should only work for Capital letters, so every char should be >=65 and <=90. So, if I write 'Z' it should start the alphabet from the beginning and print 'E'. So far, my code looks like this: li $v0, 8

Caesar cipher encrypting a single character in MIPS

不想你离开。 提交于 2020-07-16 10:20:44
问题 I'm having some problems in creating a program to encrypt a message. At this point i'm just trying to input a char and the output should be the char+5 positions in the alphabet. So the program should read the char in ASCII and add 5 to it and then print the letter. Ex.: Input: A Output: F It should only work for Capital letters, so every char should be >=65 and <=90. So, if I write 'Z' it should start the alphabet from the beginning and print 'E'. So far, my code looks like this: li $v0, 8

Reading and printing an integer in mips

时光怂恿深爱的人放手 提交于 2020-07-14 22:36:22
问题 My program is suppose to read an integer and print it back to the user but every time it just prints 268501230 no matter what is entered. Any help would be appreciated. .data prompt2: .asciiz "Please enter value: " array1: .space 40 array2: .space 40 buffer: .space 4 .text main: #Prints the prompt2 string li $v0, 4 la $a0, prompt2 syscall #reads one integer from user and saves in t0 li $v0, 5 la $t0, buffer syscall li $v0, 1 li $t0, 5 # $integer to print syscall exitProgram: li $v0, 10 #

Reading and printing an integer in mips

坚强是说给别人听的谎言 提交于 2020-07-14 22:29:09
问题 My program is suppose to read an integer and print it back to the user but every time it just prints 268501230 no matter what is entered. Any help would be appreciated. .data prompt2: .asciiz "Please enter value: " array1: .space 40 array2: .space 40 buffer: .space 4 .text main: #Prints the prompt2 string li $v0, 4 la $a0, prompt2 syscall #reads one integer from user and saves in t0 li $v0, 5 la $t0, buffer syscall li $v0, 1 li $t0, 5 # $integer to print syscall exitProgram: li $v0, 10 #

How to run Valgrind to find out memory leaks on my Embedded MIPSEL- linux box?

笑着哭i 提交于 2020-07-06 03:47:11
问题 How can I run valgrind on an embedded Linux box to find memory leaks in my main software? In the rcS script, I am running like this: ./main_app How can I associate the ./main_app program with valgrind? The main_app process never terminates. I want to constantly log the data to file. Also, I want to access the log file without terminating the main_app process. I can do telnet and can access the log file. But the problem is until and unless the handler is closed, how can I open the file i.e. I

How to run Valgrind to find out memory leaks on my Embedded MIPSEL- linux box?

拈花ヽ惹草 提交于 2020-07-06 03:40:02
问题 How can I run valgrind on an embedded Linux box to find memory leaks in my main software? In the rcS script, I am running like this: ./main_app How can I associate the ./main_app program with valgrind? The main_app process never terminates. I want to constantly log the data to file. Also, I want to access the log file without terminating the main_app process. I can do telnet and can access the log file. But the problem is until and unless the handler is closed, how can I open the file i.e. I