Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

You can make a divider with multiple subtractions. The method is simple: first you try to subtract dividend by divisor x nth power of 2. In here n is the bit number (4-bit, 8-bit or else) then if you can subtract the first bit of solution is 1 else 0 (1xxx or 0xxx for 4-bit for example). Than if it's 1 you alsa make subtraction else don't do it. At the end decrease n by one by one and do this every time. For example:

4-Bit Divison (15 divided by 3):

  • Is 15 can be subtract by 3 x 8: No. Then our answer is 0xxx,
  • Is 15 can be subtract by 3 x 4: Yes. Then our answer is 01xx and now 15 goes to 3.
  • Is 3 can be subtract by 3 x 2: No. Then it's 010x
  • Is 3 can be subtract by 3 x 1: Yes. Then our final answer is 0101 => Decimal 5 and it's true.

thanks bro
i'll try it

I made this chip with that algorithm. First, at left there are NOT gates (with blue outputs) they calculate negative of divider without adding one (that one add with carry input) . And the bottom there are OR and NOT gates (with yellow outputs) they calculate overflow for example 1101 divide by 0011 with 3 shift: 1101-0011000 but that 001 can't be in calculation so if there are any 1's in 001 so it's overflow. It can't be subtract. And if it can be subtract so we subtract for next steps, I do it with MUX. I think it can help you with your project but maybe you can optimize it. Because it works with 1000 ticks per second (In normal mode 250-1000) but maybe in CPU's it can slow down CPU much more.

thanks bro