Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
assembly data u32pat word 0x000000F0 au32k word 0x80000000 word 0xFFFFFFFF word 0x0000A5AA word 0xF0...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started