Ass4 - Department of Electrical Engineering Course...

This preview shows pages 1–11. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Question 2 Implement the binary division function you wrote in Assignment 1, Question 5, in MIPS assembly code, assuming the following convention for passing arguments: Register Argument Mechanism \$4 dividend pass by value \$5 divisor pass by value \$6 quotient pass by value \$7 rmdr pass by value \$8 status return pass by value Although this is not quite the convention used by a “C” compiler (quotient and rmdr are pointers and would otherwise by passed by reference), we will use it here since argument passing mechanisms have not been dealt with in detail at this point in the course. In coding your function it is absolutely essential that the context of the calling program is fully preserved. You will also need to write a suitable test program. The SPIM environment includes a number of SYSCALL functions for printing strings and integers. Test your functions with the same table of test cases that you used in Assignment 1. Your results should be identical. FPF/March 3, 2008. 2/17
3/17

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4/17
5/17

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6/17
7/17

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
8/17
9/17

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
#----------------------------------------------------------------------------- # Procedure Name: int div32(long dividend,long divisor, # long *quotient, long *rmdr); # # Description: Implements a binary division algorithm using # shift and subtract. Dividend and divisor are # passed in registers \$4 and \$5 respectively, with # quotient and remainder returned in \$6 and \$7. # # Notes:
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2008 for the course ESCE 221 taught by Professor Ferrie during the Spring '08 term at McGill.

Page1 / 17

Ass4 - Department of Electrical Engineering Course...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online