I'm looking for help regarding the following algorithm and implementing the logic circuit. Here it is in pseudocode:
if b = 0
swap values of a and b. b has the GCD. done.
if a = 0
b has the GCD. done.
if a < b
swap values of a and b.
Loop: a = a - b
if a >= b
go back to Loop.
if a > 0
swap values of a and b
go back to Loop
b has the GCD. done.
I've written some RTL code and it doesn't seem to be an issue; the real issue is my circuit design!
I suppose one would use a shift-subtract division implementation? I suppose I really just need help deciding what registers and arithmetic chips I'd use. Going to use Logisim.