Question

In the MIPS architecture, where does the PC of a user program get saved when an...

  1. In the MIPS architecture, where does the PC of a user program get saved when an interrupt occurs?

    The Cause register

    The $ra register

    The EPC register

    The $sp register

1 points   

QUESTION 4

  1. Suppose we wish to call a function that accepts 2 input parameters (one 32 bit word each) and 1 return value (one 32 bit word). What is the minimum number of bytes that we should allocate on the stack to call this function. Assume all parameters and return values should go on the stack.

    16 bytes

    8 bytes

    4 bytes

    20 bytes

    12 bytes

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.)

  • When an interrupt occurs, all the contents of PC are moved to EPC register.
  • After returning from the expception handler, the contents in EPC is moved back to PC
  • Answer: The EPC register.

2.)

  • It is given that every parameter and return value are to be stored in stack.
  • The are two parameters of size 32 bits, each. So, in total they take up 64 bits.
  • The return value is also of size 32 bits, so, in total 96 bits.
  • 96 bits = 12 bytes.
  • The return address of the function must be stored in stack too. It takes up 8 bytes of memory
  • Total stack memory needed = 12+8 = 20 bytes
  • Answer: 20 bytes
Add a comment
Know the answer?
Add Answer to:
In the MIPS architecture, where does the PC of a user program get saved when an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What does the instruction jal do? It populates the PC with the address given by the...

    What does the instruction jal do? It populates the PC with the address given by the input. It saves the current PC (plus 4 bytes) to the $ra register and the populates the PC with the address given by the input. It populates the PC counter with the word currently stored in the $ra register. It allocates the input number of bytes (provided as an immediate value) onto the stack. 1 points    QUESTION 6 What is a function pointer?...

  • ASSEMBLY LANGUAGE (Mars MIPS) Starting code: Factorial: #Factorial Recursive function subu $sp, $sp, 4 sw $ra,...

    ASSEMBLY LANGUAGE (Mars MIPS) Starting code: Factorial: #Factorial Recursive function subu $sp, $sp, 4 sw $ra, 4($sp) # save the return address on stack beqz $a0, terminate # test for termination subu $sp, $sp, 4 # do not terminate yet sw $a0, 4($sp) # save the parameter sub $a0, $a0, 1 # will call with a smaller argument jal Factorial # after the termination condition is reached these lines # will be executed lw $t0, 4($sp) # the argument I...

  • 20 pts] 2- Consider the internal structure of the pseudo-CPU discussed in class augmented with a...

    20 pts] 2- Consider the internal structure of the pseudo-CPU discussed in class augmented with a single-port register file (i.e., only one register value can be read at a time) containing 32 8-bit registers (RO-R31) and a Stack Pointer (SP). Suppose the pseudo-CPU can be used to implement the AVR instruction ICALL (Indirect Call to Subroutine) with the format shown below: 10001 10101 00001 10011 ICALL pushes the return address onto the stack and jumps to the 16-bit target address...

  • QUESTION 11 Which instruction is used to return from a user function to its caller? return...

    QUESTION 11 Which instruction is used to return from a user function to its caller? return eret jal jr 1 points    QUESTION 12 Which of the following is the best description of memory mapped input/output (MMIO)? the ability to use a common address space to access memory as well as input/output devices. the ability to read characters from the keyboard the ability to interrupt the CPU when the result of an operation involving an IO device is complete. the...

  • Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how...

    Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how one can use subroutines (also called procedures, functions, and methods) in MIPS. Because of the importance of subroutines in modern programming, most hardware designers include mechanisms to help programmers. In a high-level language like C or Java, most of the details of subroutine calling are hidden from the programmer. MIPS has special registers to send information to and from a subroutine. The registers $a0,...

  • Implement the following statements using MS430 assembly instructions. You may use more than one, ...

    Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...

  • Need to write a MIPS assembly program that finds the minimum and maximum and sum of...

    Need to write a MIPS assembly program that finds the minimum and maximum and sum of a stored array. It also finds the locations of the minimum and maximum. The interaction between the main program and the function is solely through the stack. The function stores $ra immediately after being called and restores $ra before returning to main. The main program reserves a static C like array (index starts from 0) of 10 elements and initializes it. The maximum should...

  • computer architecture The sum of the two 32 bit integers may not be representable in 32 bits. In this case, we say that an overflow has occurred. Write MIPS instructions that adds two numbers stor...

    computer architecture The sum of the two 32 bit integers may not be representable in 32 bits. In this case, we say that an overflow has occurred. Write MIPS instructions that adds two numbers stored in registers Ss1 and Ss2, stores the sum in register $s3, and sets register Sto to 1 if an overflow occurs and to 0 otherwise. 5. (16pts) 6. Show the IEEE 754 binary representation of the number -7.425 in a single and double 7. If...

  • Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment...

    Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment BEGINS Here | ;+======================================================================+ segment .data ;Code this expression: sum = num1+num2 num1 dq 0 ;left operand of the addition operation num2 dq 0 ;right operand of the addition operation sum dq 0 ;will hold the computed Sum value RetVal dq 0 ;Integer value RETURNED by function calls ;can be ignored or used as determined by the programmer ;Message string prompting for the keyboard...

  • Computer Architecture Project Description: farh-to-cel.asm : # Revised and added code taken from Hennesey and Patterson...

    Computer Architecture Project Description: farh-to-cel.asm : # Revised and added code taken from Hennesey and Patterson 5th edition # to work with this simulator. # # Prompts a user to enter a Fahrenheit temperature as a floating point. # Displays the converted temperature in Celcius. # 10/28/2015 .data const5: .float 5.0 # store a floating point constant 5.0 const9: .float 9.0 const32: .float 32.0 .align 2 # align the next string on a word boundary .space 100 prompt: .asciiz "Please...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT