Write an AVR program that counts of one bits in R16 If R1652

Write an AVR program that counts of one bits in R16. If R16=52, the number of one bits is 3 and the number of zero bits is 5.

Solution

.file \"example.cpp\"
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__CCP__ = 0x34
__tmp_reg__ = 0
__zero_reg__ = 1
.stabs \"/gcc-explorer/\",100,0,4,.Ltext0
.stabs \"/tmp/gcc-explorer-compiler116924-99-4bx97/example.cpp\",100,0,4,.Ltext0
.text
.Ltext0:
.stabs \"gcc2_compiled.\",60,0,0,0
.stabs \"__builtin_va_list:t(0,1)=*(0,2)=(0,2)\",128,0,0,0
.stabs \"complex long double:t(0,3)=R3;8;0;\",128,0,0,0
.stabs \"complex double:t(0,4)=R3;8;0;\",128,0,0,0
.stabs \"complex float:t(0,5)=R3;8;0;\",128,0,0,0
.stabs \"complex int:t(0,6)=s4real:(0,7)=r(0,7);-32768;32767;,0,16;imag:(0,7),16,16;;\",128,0,0,0
.stabs \"long long unsigned int:t(0,8)=@s64;r(0,8);0;01777777777777777777777;\",128,0,0,0
.stabs \"long unsigned int:t(0,9)=@s32;r(0,9);0;037777777777;\",128,0,0,0
.stabs \"unsigned int:t(0,10)=r(0,10);0;0177777;\",128,0,0,0
.stabs \"unsigned char:t(0,11)=@s8;r(0,11);0;255;\",128,0,0,0
.stabs \"long long int:t(0,12)=@s64;r(0,12);01000000000000000000000;0777777777777777777777;\",128,0,0,0
.stabs \"long int:t(0,13)=@s32;r(0,13);020000000000;017777777777;\",128,0,0,0
.stabs \"int:t(0,7)\",128,0,0,0
.stabs \"signed char:t(0,14)=@s8;r(0,14);-128;127;\",128,0,0,0
.stabs \"char:t(0,15)=r(0,15);0;127;\",128,0,0,0
.stabs \"signed:t(0,7)\",128,0,0,0
.stabs \"unsigned long:t(0,9)\",128,0,0,0
.stabs \"long long unsigned:t(0,8)\",128,0,0,0
.stabs \"short int:t(0,16)=r(0,16);-32768;32767;\",128,0,0,0
.stabs \"short unsigned int:t(0,17)=r(0,17);0;0177777;\",128,0,0,0
.stabs \"unsigned short:t(0,17)\",128,0,0,0
.stabs \"float:t(0,18)=r(0,7);4;0;\",128,0,0,0
.stabs \"double:t(0,19)=r(0,7);4;0;\",128,0,0,0
.stabs \"long double:t(0,20)=r(0,7);4;0;\",128,0,0,0
.stabs \"void:t(0,2)\",128,0,0,0
.stabs \"wchar_t:t(0,21)=r(0,21);-32768;32767;\",128,0,0,0
.stabs \"bool:t(0,22)=@s8;-16;\",128,0,0,0
.stabs \"__vtbl_ptr_type:t(0,23)=*(0,24)=f(0,7)\",128,0,0,0
.stabs \"countSetBits(unsigned int):F(0,7)\",36,0,2,countSetBits(unsigned int)
.stabs \"n:p(0,10)\",160,0,2,3
.global countSetBits(unsigned int)
.type countSetBits(unsigned int), @function
countSetBits(unsigned int):
.stabd 46,0,0
.stabn 68,0,3,.LM0-.LFBB1
.LM0:
.LFBB1:
push r29
push r28
rcall .
rcall .
in r28,__SP_L__
in r29,__SP_H__
.L__stack_usage = 6
std Y+4,r25
std Y+3,r24
.LBB2:
.stabn 68,0,5,.LM1-.LFBB1
.LM1:
std Y+2,__zero_reg__
std Y+1,__zero_reg__
rjmp .L2
.L4:
.stabn 68,0,6,.LM2-.LFBB1
.LM2:
ldd r24,Y+1
ldd r25,Y+2
adiw r24,1
std Y+2,r25
std Y+1,r24
.stabn 68,0,5,.LM3-.LFBB1
.LM3:
ldd r24,Y+3
ldd r25,Y+4
sbiw r24,1
ldd r18,Y+3
ldd r19,Y+4
and r24,r18
and r25,r19
std Y+4,r25
std Y+3,r24
.L2:
.stabn 68,0,5,.LM4-.LFBB1
.LM4:
ldi r18,lo8(1)
ldd r24,Y+3
ldd r25,Y+4
sbiw r24,0
brne .L3
ldi r18,lo8(0)
.L3:
tst r18
brne .L4
.stabn 68,0,8,.LM5-.LFBB1
.LM5:
ldd r24,Y+1
ldd r25,Y+2
.LBE2:
.stabn 68,0,9,.LM6-.LFBB1
.LM6:
pop __tmp_reg__
pop __tmp_reg__
pop __tmp_reg__
pop __tmp_reg__
pop r28
pop r29
ret
.size countSetBits(unsigned int), .-countSetBits(unsigned int)
.stabs \"c:(0,10)\",128,0,4,1
.stabn 192,0,0,.LBB2-.LFBB1
.stabn 224,0,0,.LBE2-.LFBB1
.Lscope1:
.stabs \"\",36,0,0,.Lscope1-.LFBB1
.stabd 78,0,0
.stabs \"countSeBits(unsigned int):F(0,7)\",36,0,10,countSeBits(unsigned int)
.stabs \"n:p(0,10)\",160,0,10,3
.global countSeBits(unsigned int)
.type countSeBits(unsigned int), @function
countSeBits(unsigned int):
.stabd 46,0,0
.stabn 68,0,11,.LM7-.LFBB2
.LM7:
.LFBB2:
push r29
push r28
rcall .
rcall .
in r28,__SP_L__
in r29,__SP_H__
.L__stack_usage = 6
std Y+4,r25
std Y+3,r24
.LBB3:
.stabn 68,0,13,.LM8-.LFBB2
.LM8:
ldi r24,lo8(1)
ldi r25,hi8(1)
std Y+2,r25
std Y+1,r24
rjmp .L6
.L8:
.stabn 68,0,14,.LM9-.LFBB2
.LM9:
ldd r24,Y+1
ldd r25,Y+2
adiw r24,1
std Y+2,r25
std Y+1,r24
.stabn 68,0,13,.LM10-.LFBB2
.LM10:
ldd r24,Y+3
ldd r25,Y+4
sbiw r24,1
ldd r18,Y+3
ldd r19,Y+4
and r24,r18
and r25,r19
std Y+4,r25
std Y+3,r24
.L6:
.stabn 68,0,13,.LM11-.LFBB2
.LM11:
ldi r18,lo8(1)
ldd r24,Y+3
ldd r25,Y+4
sbiw r24,0
brne .L7
ldi r18,lo8(0)
.L7:
tst r18
brne .L8
.stabn 68,0,16,.LM12-.LFBB2
.LM12:
ldd r24,Y+1
ldd r25,Y+2
.LBE3:
.stabn 68,0,17,.LM13-.LFBB2
.LM13:
pop __tmp_reg__
pop __tmp_reg__
pop __tmp_reg__
pop __tmp_reg__
pop r28
pop r29
ret
.size countSeBits(unsigned int), .-countSeBits(unsigned int)
.stabs \"c:(0,10)\",128,0,12,1
.stabn 192,0,0,.LBB3-.LFBB2
.stabn 224,0,0,.LBE3-.LFBB2
.Lscope2:
.stabs \"\",36,0,0,.Lscope2-.LFBB2
.stabd 78,0,0
.stabs \"main:F(0,7)\",36,0,18,main
.global main
.type main, @function
main:
.stabd 46,0,0
.stabn 68,0,19,.LM14-.LFBB3
.LM14:
.LFBB3:
push r29
push r28
in r28,__SP_L__
in r29,__SP_H__
.L__stack_usage = 2
.stabn 68,0,23,.LM15-.LFBB3
.LM15:
ldi r24,lo8(52)
ldi r25,hi8(52)
rcall countSetBits(unsigned int)
.stabn 68,0,24,.LM16-.LFBB3
.LM16:
ldi r24,lo8(52)
ldi r25,hi8(52)
rcall countSeBits(unsigned int)
.stabn 68,0,0,.LM17-.LFBB3
.LM17:
ldi r24,lo8(0)
ldi r25,hi8(0)
.stabn 68,0,27,.LM18-.LFBB3
.LM18:
pop r28
pop r29
ret
.size main, .-main
.Lscope3:
.stabs \"\",36,0,0,.Lscope3-.LFBB3
.stabd 78,0,0
.stabs \"\",100,0,0,.Letext0
.Letext0:

 Write an AVR program that counts of one bits in R16. If R16=52, the number of one bits is 3 and the number of zero bits is 5.Solution.file \
 Write an AVR program that counts of one bits in R16. If R16=52, the number of one bits is 3 and the number of zero bits is 5.Solution.file \
 Write an AVR program that counts of one bits in R16. If R16=52, the number of one bits is 3 and the number of zero bits is 5.Solution.file \
 Write an AVR program that counts of one bits in R16. If R16=52, the number of one bits is 3 and the number of zero bits is 5.Solution.file \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site