# Need help with RTL (Register Transfer Level) circuit implementation - Euclidian GCD algorithm

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.

-
Format your code, please. –  Brian Carlton Apr 2 '12 at 23:54
Probably not worth it to top the list again: OP hasn't been here since he asked the question. –  Federico Russo May 12 '12 at 14:38