Question: 4 Next fill in the code for Part4_Function. Since we are now familiar with condition codes and arithmetic operations, we will perform a simple computation

4 Next fill in the code for "Part4_Function." Since we are now familiar with condition codes and arithmetic operations, we will perform a simple computation that requires both flow control and mathematical operations: finding the population count of an integer. The population count is the number of set bits (1s) in the binary encoding of a number. You may also hear this operation referred to as "Hamming Weight."\ Following the AAPCS calling convention, there will be a 32-bit integer in R0 when your code written inside Part4_Function starts. You should return from the function after placing the number of

1s

that were present in the encoding of that number back in R0.\ This code is tested by holding down SW2. A successful test of your code will result in the Green LED blinking. Incorrect code will result in the Red LED blinking.\ Notes:\ Population count is a common operation in bit-oriented algorithms, and especially in cryptographic algorithms.\ There are several classic algorithms for this problem. We suggest you use something iterative rather than recursive, as writing recursive algorithms in assembly is a bit of a stretch at this point.\ If you go looking online, you may see references to the ARM NEON instruction vcnt. 8 or the ARMv8 instruction CNT, neither of which are present in our Cortex M4 processor, don't try to use them.

 4 Next fill in the code for "Part4_Function." Since we are

Next fill in the code for "Part4_Function." Since we are now familiar with condition codes and arithmetic operations, we will perform a simple computation that requires both flow control and mathematical operations: finding the population count of an integer. The population count is the number of set bits (1s) in the binary encoding of a number. You may also hear this operation referred to as "Hamming Weight." Following the AAPCS calling convention, there will be a 32-bit integer in R0 when your code written inside Part4_Function starts. You should return from the function after placing the number of 1s that were present in the encoding of that number back in R0. This code is tested by holding down SW2. A successful test of your code will result in the Green LED blinking. Incorrect code will result in the Red LED blinking. Notes: - Population count is a common operation in bit-oriented algorithms, and especially in cryptographic algorithms. - There are several classic algorithms for this problem. We suggest you use something iterative rather than recursive, as writing recursive algorithms in assembly is a bit of a stretch at this point. - If you go looking online, you may see references to the ARM NEON instruction vcnt. 8 or the ARMv8 instruction CNT, neither of which are present in our Cortex M4 processor, don't try to use them

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!