Question: 5. Below is a RISC-style program that finds the number of negative integers in a list of n consecutive 32-bit integers and stores and count

5. Below is a RISC-style program that finds the number of negative integers in a list of n consecutive 32-bit integers and stores and count in location NEGCNT. The value n is stored in memory location NUM, and the first integer in the list is stored in location LIST. RO is dedicated to hold a constant zero, i.e., R0+-0. Fill in the blanks (highlighted) with appropriate register numbers (e.g., R2, R3). Note: Show how you get your answers to receive partial credit. (24pts, 4pts each) Move Load Move Move R2, #NUM Get the address NUM Load the size of the list. Initialize the counter to 0 Load address of the first number Get the next number Test if number is negative. Increment the count. Increment the pointer to list Decrement the list counter Loop back if not finished. Get the address NEGCNT Store the result. R3, R0 R4. #LIST LOOP: Load Branch if[ Add P[RO] NE R3 R4 R2, R2, #1 LOOP R6, # NEGCNT R3, (R6) NEXT: Add #4 Subtract Branch-it_L_HR01 Move Store The registers are (in the order of the instructions)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
