MPCA LAB4 Programs
MPCA LAB4 Programs
COMPUTER ARCHITECTURE
LABORATORY
4TH Semester(UE22CS251B)
LAB4
Saturday, March 15, 2025
Prof Deepti C
Computer Science and Engineering
Microprocessor & Computer Architecture Laboratory
ASSIGNMENT QUESTIONS
1.Write an ALP to find whether a given character is present in a string. If
present, find how many times the given character is present in a string.
2. Write a program in ARM7TDMI-ISA to generate a diagonal matrix.
;Note: do not read the matrix elements.
Microprocessor & Computer
Architecture (μpCA)
SWI #
Microprocessor & Computer
Architecture (μpCA)
SWI #
Microprocessor & Computer Architecture Laboratory
PROGRAM 1a,1b
LAB 4 a)Write an ALP to perform Convolution using MUL instruction
(Addition of multiplication of respective numbers of loc A and loc
B) such that the value ∑(a[i]*b[i]) is computed.
Write an ALP to perform Convolution using MLA instruction
(Addition of multiplication of respective numbers of loc A and loc
B).
PROGRAM 2
WEEK
Write an ALP to implement Sum[i]+=a[i][j]
4
Algorithm Algorithm for Subroutine get_addr
1. Declare the array A in .data segment 10.Pop the values of i and j from stack back to registers R4 and R5
2. Let R0 contain address of A 11.Multiply no of columns in r3 with i value(in R4) add with j value( in R5)
3. Let R1=0=initial value of sum Store the result in R7
4. Let R2 contain max number of rows in the matrix,assume=3. 12.Multiply this result in R7 wih 4 to get address of next element.
5. Let R3 contain max number of columns in the matrix,assume=3. Save multiplication result in R6
6. Let R4 contain initial value of i=0 13.Save the values of i ,j and address (in R6) to stack
7. Let R5 contain initial value of j=0 14.Return to subroutine for_i for_j(Step 15)
Deepti C