Question: 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:

Program used it uVision (Keil), some instructions said it should be bothShould be done by filling in the the missing pieces of the provided code:

#include  uint32_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

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!