C7 Digital logic · Practice
Division in hardware
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
0 solved
0 in a row
0 of 7 kinds solid
Check
A restoring divider computes 104 ÷ 4. What quotient does it produce?
Check
What remainder does the divider leave for 125 ÷ 7?
Check
A restoring divider produces one quotient bit per step. How many steps does a 16-bit by 16-bit division take, not counting setup?
Check
In C, what is −13 / 2 for signed integers?
Check
Write divide(N, Dv) returning (q, r) by the restoring algorithm for n-bit unsigned N (12 bits), counting the steps in a global list steps (append 1 per quotient bit). Then find the smallest shift s (search from n upward) such that M = ceil(2**s / D) gives (x*M) >> s == x // D for every n-bit x, with D = 3, and set s_min and M_min.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
What quotient does 122 ÷ 3 give in hardware?
Check
Before arithmetic-shifting a negative number right by 2 bits to divide by with C's rounding, what should be added to it?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C7