;m x n and n x k lattice augmentation
mov r0, #m ;m is number of columns in first grid
mov r1, #n ;n is number of sections in first lattice
mov r2, #n ;n is number of lines in second framework
mov r3, #k ;k is number of sections in second network
;result network is of size m x k
mov r4, #0 ;r4 will be utilized as base location of first
lattice
mov r5, #0 ;r5 will be utilized as base location of second
grid
mov r6, #0 ;r6 will be utilized as base location of result
grid
;instate result lattice to 0
init_result:
mov r7, #0
str r7, [r6]
add r6, #4
cmp r6, #m*k*4
blt init_result
;r8 will be utilized to monitor current column in first
lattice
;r9 will be utilized to monitor current segment in second
framework
;r10 will be utilized as impermanent variable
mov r8, #0
outer_loop:
cmp r8, #m
beq end_outer_loop
mov r9, #0
inner_loop:
cmp r9, #k
beq end_inner_loop
mov r10, #0
duplicate:
cmp r10, #n
beq store_result
ldr r11, [r4, r10*4] ;load component from first lattice
ldr r12, [r5, r9*4] ;load component from second grid
mul r13, r11, r12 ;increase components
add r14, r10, r9 ;add offset
add r14, r14, #n*k ;add offset
ldr r15, [r6, r14*4] ;load component from result grid
add r15, r15, r13 ;add to result
str r15, [r6, r14*4] ;store result
add r10, #1
b duplicate
store_result:
add r9, #1
b inner_loop
end_inner_loop:
add r8, #1
b outer_loop
end_outer_loop:
;track down biggest and most modest number in outcome
lattice
mov r8, #0 ;r8 will be utilized as base location of result
framework
mov r9, #0 ;r9 will be utilized as counter
mov r10, #0 ;r10 will be utilized as biggest number
mov r11, #0 ;r11 will be utilized as most modest number
;instate biggest and most modest number to first component in
outcome lattice
ldr r12, [r8]
mov r10, r12
mov r11, r12
;circle through outcome lattice to see as biggest and most
modest number
circle:
add r9, #1
cmp r9, #m*k
beq end_loop
ldr r12, [r8, r9*4]
cmp r12, r10
blt skip1
mov r10, r12
skip1:
cmp r12, r11
bgt skip2
mov r11, r12
skip2:
b circle
end_loop:
;store biggest and most modest number in R5 and R6
mov r5, r10
mov r6, r11.
Make this a working code .
The code you see is a two matrix multiplication and later ,
finding tow biggest numbers code.
Make it a working code that all
AREA MYCODE, CODE
ALIGN
ENTRY
EXPORT
__main
And run this code in a compiler
;m x n and n x k lattice augmentation mov r0, #m ;m is number of columns in first grid mov r1, #n ;n is number of sectio
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am