Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program used it uVision (Keil), some instructions said it should be both C and assembly. I need to compete the code to do this: Should
Program used it uVision (Keil), some instructions said it should be both C and assembly. I need to compete the code to do this:
Should be done by filling in the the missing pieces of the provided code:
#includeuint32_t array0[] = {0x00000001,0x00000020,0x00000400,0x00008000,0x00440000,0x02200000,0x12000000,0x80000000}; // answer = 255; uint32_t array1[] = {0x00000001,0x00000020,0x00000400,0x00008000,0x00440000,0x02200000,0x12000000,0x00000000}; // answer = 220; uint32_t array2[] = {0x00000001,0x00000020,0x00000400,0x00008000,0x00440000,0x02200000,0x00000000,0x00000000}; // answer = 185; uint32_t array3[] = {0x00000001,0x00000020,0x00000400,0x00008000,0x00440000,0x00000000,0x00000000,0x00000000}; // answer = 150; uint32_t array4[] = {0x00000001,0x00000020,0x00000400,0x00008000,0x00000000,0x00000000,0x00000000,0x00000000}; // answer = 111; uint32_t array5[] = {0x00000001,0x00000020,0x00000400,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000}; // answer = 74; uint32_t array6[] = {0x00000001,0x00000020,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000}; // answer = 37; uint32_t array7[] = {0x00000001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000}; // answer = 0; uint32_t *arrays[] = {array0, array1, array2, array3, array4, array5, array6, array7}; uint32_t narrays = sizeof(arrays)/sizeof(uint32_t*); uint32_t nelements = sizeof(array0)/sizeof(uint32_t); uint32_t findHighBitASM(uint32_t*, uint32_t); uint32_t findHighBitC(uint32_t*, uint32_t); int main(void){ uint8_t i; volatile uint32_t position; for (i = 0; i The assembly function accepts two input arguments. The first input is the address of a uint32_t, which corresponds to the first address of an array of eight 32-bit integers. The second argument is of type uint32_t and represents the number of 32-bit words in the array. This array of eight 32-bit numbers will be interpreted as an array of 256 bits. The first 32-bit integer has bits 0 (lowest bit) to bit 31 (highest bit), the second 32-bit integer has bits 32 (lowest bit) to bit 63 (highest bit), and so on. The function returns a uint32_t, which corresponds to the bit-position of the highest bit that contains a 1. The function may assume that at least one of the 256 bits will contain a 1. I.e., you do not need to add any code that returns error values
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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