Programming Simple Processor Programming Simple Processor Programming Simple Pro
ID: 638109 • Letter: P
Question
Programming Simple Processor
Programming Simple Processor Programming Simple Processor 7.6. Problem 6 Block of positive (i.e. geq 0) numbers is stored in data section of memory, starting from address 100. This group is terminated by negative number. Write program that counts these numbers, and returns the result in register A (the result means the number of elements of this group, not counting the last negative number) Use digits of your student ID number as data and show registers snapshot for first few iterations of the program 7.7. Problem 7 Block of positive (i.e. geq 0) numbers is stored in data section of memory, starting from address 100. This group is terminated by negative number. Write program that finds the smallest and the largest elements of this group and stores these elements in registers A and B. Don't count the last negative number) Use digits of your student ID number as data and show registers and memory snapshot for first few iterations of the program 7.8. Problem 8 Block of positive (i.e. geq 0) numbers is stored in data section of memory, starting from address 100. This group is terminated by negative number. Write program that sorts this block in ascending order Use digits of your student ID number as data and show registers and memory snapshot for first few iterations of the program Comment: Solution that creates sorted data block by copying data to other memory location is correct and deserves (if there are no errors) full grade. However, 10 bonus points will be given for solution that makes sorting in place, i.e. without copying data to new locationExplanation / Answer
It is however a very short solution.
Expects input in r0, and returns output in r0
The main work is done in the vcnt.8 instruction which counts the bits of each byte in a NEON register and stores the bitcount back into the bytes of D0.
The rest of the code is just adding the four bytes together.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.