Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me to code this ARM assembly program that can compute the convolution between two matrices? The convolution is computed by the sum
Can someone help me to code this ARM assembly program that can compute the convolution between two matrices? The convolution is computed by the sum of the result of an element-wise multiplication method. The method of convolution is shown below.
The two matrices have been initialized by a C program. The asm_func in the c program is the ARM assembly program that requires to be finished, its structure is also shown below.
This is the structure of asm_func, it should be designed with ARM assembly language to perform the convolution of two matrices.
Figure 3 (a) explains how the sum of the result of an element-wise multiplication method works for the first section of the input matrix. The single node value of 174 in the output matrix is calculated from the elements of kernel and input matrix as follow: 1 x 9 + 2 x 1 + 4 x 1 + 5 x 4 + 5 x 3 + 7 x 1 + 8 x 5 + 9 x 8 + 1 x 5 = 174. In the subsequent step of convolution, the section of the input matrix is shifted to the right by one column and another node value of output matrix is calculated. (Figure 3 (b)). In the subsequent steps, another two nodes of the output matrix are calculated accordingly (Figure 3(C) and Figure 3(d)). (a) (b) Kernel Matrix Kernel Matrix Input Matrix Output Matrix Input Matrix Output Matrix 12 4 2. 0 o 0 0 1 2 4 1 5 2 5 0 0 0 0 55 7 * * .... o 0 557 89 1 8 9 1 4 317 o 174 0 0 174 206 0 5 8 51 5 8 5 1 0 0 0 0 ***** 0 0 0 (c) (d) Kernel Matrix Input Matrix Output Matrix Kernel Matrix Input Matrix Output Matrix 1 5 2 5 0 0 0 1 2 4 0 0 0 0 1 2 4 5 5 7 8 9 1 * 0 0 121 0 5 5 7 1 52 5 9 1 1 6 43 17. 0 136 121 0 *** 174 2060 8 9 1 0 174 206 0 5 8 51 0 0 0 0 5 85 1 0 0 0 0 Figure 3. The four steps showing the convolution between Kernel and Input Matrix #include "stdio.h" #define K 3 #define D4 extern void asm_func(int* argi, int* arg2, int* arg3); extern void initialise_monitor_handles (void); int main(void) { initialise_monitor_handles(); int i, j; int kernel[K][K] = {{8,9,1},{5,5,7},{1,2,4}}; //kernel matrix int input[D][D] = {{5,8,5,1},{4,3,1,7},{9,1,1,6},{1,5,2,5}}; int output[D][D] = {{K,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,05}; // input matrix (image matrix) to be treated by kernel // output matrix where newly computed features are to be stored // function used to generate the resulted patient distribution by this week and store it into result[][] asm_func((int*)kernel, (int*) input, (int*)output); // refresh building[][] and print out printf("Final output matrix: "); for (i=D-1; i>-1; i--) { for (j=0; jStep 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