__udivmodqi4 Demonstration and confirmation - AVR Assembly division binary software arithmetic

Channel:
Subscribers:
322
Published on ● Video Link: https://www.youtube.com/watch?v=sj3sOBYkR4w



Duration: 2:19
17 views
0


Division using addition. This could be very hard for a normal person to understand, and here it's demonstrated that it works. It seems complicated. How does it really work? Division works on a Pizza as much on a computer with binary data, it works exactly the same.

0b00001111 / 0b00000011

1, b00001111 dividend is shifted to the reminder via the carry-flag or 9-th bit;
2, if reminder is more than or equal to divisor, then C-flag is cleared, and reminder is updated, and a 1 inserted to the bit position of the quotient.
3, 9 loops later, the result is calculated. Why 9 loops. It took 9 shifts to completely shift out 8 bit;

=========================================================
Here is a simplified version for dummies like you!!
0xff/0x0f= 0b11111111/0b00001111

1:
quotient = 0b11111110
remainder = 0b00000001
divisor bigger than remainder? (yes)

2:
quotient = 0b11111100
remainder = 0b00000011
divisor bigger than remainder? (yes)

3:
quotient = 0b11111000
remainder = 0b00000111
divisor bigger than remainder? (yes)

4:
quotient = 0b11110000
remainder = 0b00001111
divisor bigger than remainder? (no) same
remainder = remainder - divisor = 0 (carry-set)

5:
quotient = 0b11100001 (carry saved here)
remainder = 0b00000001
divisor bigger than remainder? (yes))

6:
quotient = 0b11000010
remainder = 0b00000011
divisor bigger than remainder? (yes))

7:
quotient = 0b10000100
remainder = 0b00000111
divisor bigger than remainder? (yes))

8:
quotient = 0b00001000
remainder = 0b00001111
divisor bigger than remainder? (no) same
remainder = remainder - divisor = 0 (carry-set)

9:
quotient = 0b00010001 = 17 (done and done)
remainder = 0b00000000

So you see, the quotient's 9th bit is push to the remainder, and when remainder is equal or more than divisor, the corresponding quotient bit is set, and the remainder is updated. It's fairly simple, and can be applied to bigger bit division.




Other Videos By Flyandance


2024-08-1027-Neon-lamp Thermometer - Perfect PCB making Auto-router high density - High Voltage MCU AVR chaser
2024-08-06PCB Outline Draft: New Neon Chaser design from Start to End - Autocad Love rod Light Tower
2024-08-05New Project - Creating a PCB - uAc - 12 RGB LED - ultra low power clock - Components positioning avr
2024-08-04Edu Section update - In Depth AVR Memories: Register, SRAM, Flash and EEPROM - AVR Core 5.0 - 2024
2024-08-0119uA + 0.1uA - 12 LED Hourglass - Low power AVR MCU - 60 minutes - Sleep mode Atmel ultra battery
2024-07-31Juno Button 6.0 - Simplified and Optimized the World's best button library AVR MCU held burst multi
2024-07-28New Page Xercise - In Depth AVR Assembly Coding Practices - section update
2024-07-21AVR Assembly Section Finalizing - Atmel MCU GCC inline Asm mixing C/C++ syntax reference
2024-07-19AVR interrupt reinvented - main-less - Bare minimal C code - nostartfiles - manual
2024-07-18New Project RTCnA - Create a PCB shape and importing it - dimension Eagle autocad low power nano LED
2024-07-15__udivmodqi4 Demonstration and confirmation - AVR Assembly division binary software arithmetic
2024-07-14Advanced Inline assembly page Update - asm atmel 8-bit AVR MCU GCC - 4.0 Core 2024
2024-07-13Creating perfect sheet for cursive calligraphy English handwriting penmanship practice Free download
2024-07-08Genuinely unclog any inkjet ink cartridge using capillary action - HP 92
2024-07-07New Xample Page: 12 Advanced AVR-GCC Assembler Assembly Examples - 2024 gas asm
2024-06-30Assembly section update -- AVR GCC inline and mixing c Gas C/C++ ASM assembler Mastering atmel MCU
2024-06-27Old Lens turns macro Canon EFs mount
2024-06-25Blitzkrieg - High ground offense and defense - Sudden strike 1 gameplay
2024-06-15Shell Beach - Android phone Night scene video test - Low light
2024-06-11FDxboot 1.63x Test - Atmega128a - Write: 45kB/s; Read: 51kB/s Bootloader AVR109 - AVR MCU fastest
2024-06-10FDxboot 1.63 Test - Atmega16a - Write: 30kB/s; Read: 49kB/s Bootloader AVR109