Question: Implement the following C program in MIPS assembly language (name the file pattern.s): //count number of items that match the pattern (have '1' bits

Implement the following C program in MIPS assembly language (name the file

Implement the following C program in MIPS assembly language (name the file pattern.s): //count number of items that match the pattern (have '1' bits in the same place as the pattern) // pu32_a points to first element of the array // u32_n is the number of elements in the array // u32 pat is the pattern to match uint32_t pmatch (uint32_t* pu32_a, uint32_t u32_n, uint32_t u32_pat) { uint32_t u32_result; u32 result = 0; while (u32_n != 0) { if ((*pu32_a & u32_pat) == u32 pat) u32_result++; pu32_a++; u32_n--; } // this is pointer arithmetic! actually is pu32_a + 4! } return u32_result; uint32_t au32_k[] = {0x80000000, 0xFFFFFFFF, 0x0000A5AA, 0xFOFOFOFO}; uint32_t u32_count; main() { u32 count pmatch (au32_k, 4, 0x000000F0); printf("Number of matches is: %d ", u32_count); } This program has you write a subroutine that processes the elements of an array. The array contains 32-bit unsigned integers. The subroutine returns the number of elements of array that have '1' bits in the same locations as a 'pattern' value that is passed in.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

assembly data u32pat word 0x000000F0 au32k word 0x80000000 word 0xFFFFFFFF word 0x0000A5AA word 0xF0... View full answer

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 Programming Questions!