This should work
how it works:
You have, A/B
You decrease B to 0 with a binary countdown, simultaneously decreasing it from A too.
You need to store B's value to a C one during the countoff. You might need to store your original numerator as well (A->D).
With this you can count, how many times (E) this can be executed (till A reaches 0).
You restore C's value to B and start again.
S2 is set, S1 is cleared, DC1 & DC2 >= 32 => DC1 & DC2 : -32 , DC3 & DC4 : +32
S2 is set, S1 is cleared, DC1 & DC2 >= 16 => DC1 & DC2 : -16 , DC3 & DC4 : +16
more required: 8,4,2,1, and additionally you can go up to 64,128,256,512.....etc.
but in decreasing order.
S2 is set, S1 is cleared, DC2 = 0 => DC5++ , set S1
S2 is set, S1 is set, DC3 >= 32 => DC2 : +32 , DC3 : -32
S2 is set, S1 is set, DC3 >= 16 => DC2 : +16 , DC3 : -16
more required: 8,4,2,1, and additionally you can go up to 64,128,256,512.....etc.
S2 is set, S1 is set, DC3 = 0 => clear S1.
S2 is set, S1 is cleared, DC1 = 0, DC2 >= 0 => clear S2
S2 is cleared : DC5 = quotient, DC4 = original numerator, DC2 = should stay whatever it is.
S1 is set when you count the denominator and check if it is lower than the numerator, if yes you increase quotient by 1 and reset denominator (S1 is cleared)
S2 is cleared when operation has finished. Set S2 to start the operation.
Required amount of trigger cycles is the quotient (these must be run as many times as that is)
17123 / 3 will take a long time, while 400/31 takes only 13 cycles.
None.