Questions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

MICROPROCESSOR AND COMPUTER

ARCHITECTURE
LAB - 6
Nidhi Singh

PES1UG21C382

G-SECTION

1)Implementation of ARM7TDMI code to generate Fibonacci series

.text

mov r10, #5

mov r1, #0

mov r2, #1

fib:

add r3, r1, r2

mov r1, r2

mov r2, r3

subs r10, r10, #1

beq e

bal f

e:

mov r0, r3

mov r7, #1

swi 0x11
2) Implementation of ARM7TDMI code to find smallest and largest element in an array

.text

start:

ldr r2, =list

mov r3, #5

mov r5, #0

mov r6, #0

loop:

cmp r3, #0

blt small

ldr r4, [r2,r5]

sub r3, r3, #1

add r5, r5, #4

cmp r4, r6

bgt grt

bl loop

small:
ldr r2, =list

mov r3, #5

mov r5, #0

mov r7, #100

loop1:

cmp r3, #0

beq exit

ldr r4, [r2,r5]

sub r3, r3, #1

add r5, r5, #4

cmp r4, r7

blt less

bl loop1

swi 0x11

less:

mov r7, r4

bl loop1

grt:

mov r6, r4

bl loop

exit:

swi 0x11

.data

list:.word 31,24,65,6,77
3) Implementation of ARM7TDMI code to find no.of 1’s & 2’s

.text

mov r0,#0 ;for 0

mov r1,#0 ;for 1

mov r2,#0x8800

check:movs r2,r2,lsr #1

bcs zero

add r0,r0,#1
b skip

zero:

add r1,r1,#1

skip:

cmp r2,#0

bne check

swi 0x11

4) ALP to check odd and even parity

.text

mov r0,#29

movs r0,r0,lsr #1

bcs nxt

ldr r0,=e

swi 0x02

swi 0x11
nxt:

ldr r0,=o

swi 0x02

swi 0x11

.data

e:.asciz"Even Number"

o:.asciz"Odd Number"

You might also like