Question: [10 marks] Write a MIPS assembly language function (called CountZero) that accepts a binary number in register Sal and returns a value corresponding to the

  1. [10 marks] Write a MIPS assembly language function (called CountZero) that accepts a binary number in register Sal and returns a value corresponding to the number of zero's in the binary number in $v0.
  2. [10 marks] Translate the following pseudocode expression to MIPS assembly language code. Include code to insure that there is no array bounds violation when the store word (sw) instruction is executed. Note that the array "zap" is an array containing 50 words, thus the value in register $a0 must be in the range from 0 to 196. Include code to insure that the value in register $a0 is a word address offset into the array "zap.

If an array bounds violation is detected or the value in register $a0 is not a word address offset then branch to the label "Error".

data

zap:

space 200

text

zap[$a0] = $s0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!