In comp.arch.fpga Nick Maclaren said:
|> Can anyone help me design a 4 bit divisor using flip flops. I want to
|> design a circuit that devides two BCD numbers (for example 8 / 3 = 2
|> and 2 for rest).
|> Can anyone helps ?
This is a FAQ. Collect together a large number of flip-flops in
various colours. Create a pile of (say) pink ones the side of
your divisor, and a pile of (say) blue ones the size of your
dividend. Keep a pile of (say) yellow ones to hand.
Match up each pink one with a blue one, discard the blue ones,
and put one yellow one in another pile. Then repeat. When there
aren't enough pink ones to match the blue ones, the number of
yellow ones you have collected in the target pile is the quotient
and the number of blue ones left is the remainder.
Simple, isn't it?
Regards,
Nick Maclaren.
Seriously speaking this is not too far from the truth. I won't actually
design one for you but I can give you some pointers on how to get started.
From the basics.
1. Consider the process of division, and I mean REALLY consider it.
Look at how the process of long division works.
2. Look at the stages of division and divide them up to the point where
you are only doing one operation( think FSMs) also consider points where
decisions are made and also look at ending conditions(think in terms of
programming and algorithms).
3. Take to pencil and paper and sit down to a big cup of coffee and work
out a state diagram.
4. From there go through the usual steps to reduce it to equations.
If this all seems too much for you just try a bit of googling, I'm
sure someone out there should have a ready made solution. Alternatively
Just shove it into a vhdl sim and then examine the eqns.
P.S. if this sounds a lot like a load of BS, it prolly is. It 12:30 am
here and I'm just a little sleepy.