Digital Systems 2021 – Sheet 4

Since some questions in this sheet are programming exercises, you should complete them at a computer and test your code with a MIPS simulator. One good MIPS assembler and runtime simulator is MARS, developed by Pete Sanderson and Kenneth Vollmar (https : //tinyurl.com/3kc2lorf). It is possible to use other simulators as long as they provide sufficient instruction sets. It is preferable to complete the problems using the basic MIPS instructions. However, if you use pseudo-instructions, show how they are expanded. You should also include a suitable test suite for each problem to make sure that your implementation works correctly.

10.8 Write a function to calculate the quotient and remainder on dividing a (small) non-negative number by a (small) positive number; and then translate your function into MIPS code. Try a simple algorithm to begin with, and then one logarithmic in the quotient. The force of ‘small’ is that you need not worry about making your code work for the very largest representable positive numbers. What would your code do in case of extremely large values, in case of division by zero, in case of negative arguments?

10.10 Write a function to test whether its argument is prime, and then translate your function into MIPS code.

13.1 The IEEE half-precision floating point representation uses a sign , a five bit exponent and a ten bit significand packed in a sixteen bit word. 1 7 1 1 1. What are the representations of 2 , 8 , 1, 1 2 , 2 and 6 2 ? 1 3 2. What are the closest representable numbers to 5 and 5 ? 3. What are the smallest and largest positive numbers representable in normalised form? 4. What is the smallest positive denormalised number? 5. What is the smallest positive ε for which 1+ ε is representable?

13.6 A certain of minifloat number has four of exponent and three bits of mantissa. If it follows the pattern of IEEE 754 numbers, exactly what range of numbers can be represented, to what relative precision? Suppose we want to represent integers to about one significant decimal digit of pre- cision. How might these minifloat numerals best be used? How do they compare with the usual binary representation of integers?

2:26pm 3rd March 2021