0
\$\begingroup\$

I am designing two synchronous counters one mod 21 and the other one mod 30. Is there a way to know which kind of flip flop (D, SR, JK, T) will use the smallest number of logic gates? I know we can build all of them and then check for the answer but that will be a lot of work. I am just wondering if there is a simple way to know that before design.

\$\endgroup\$
2
  • \$\begingroup\$ Thinnk that the nr of extern logic gates depends on the truth table of counter states, state(n) vs state(n+1), if there is a binary pattern then you will require minimal gates. \$\endgroup\$ Jan 17 '16 at 23:38
  • \$\begingroup\$ I assume you are asking about logic gates outside the flops, because flops themselves are made up of logic gates? \$\endgroup\$
    – mattgately
    Jan 19 '16 at 1:55
2
\$\begingroup\$

D, JK or T flip flops can all be configured such that they divide by 2. SR flip-flops, by themselves, can not be wired to toggle that way. So they are not applicable.

There are really only two types of counters you can build; a ripple counter, which divides by 2\$^N\$ using N flip-flops, and a ring counter, which divides by N using N flip-flops. The ripple counter's output can be short-circuited to divided by a number less than 2\$^N\$, for example a decade counter using four flip-flops. So we just need ripple counters, the ring counter will always use more flip-flops and can be discarded.

So to minimize the number of flip-flops, you need to break the counter value into prime factors, e.g. 21 breaks up into 3 x 7, and 30 breaks up into 2 x 3 x 5.

In the first case (21), since it doesn't divide by two you can't use a single flip-flop to divide the input by half. But you can cascade two ripple counters, one counting to 3 and the other counting to 7 (the output of the first fed into the input of the second). The total number of flip-flops needed would be 2 + 3 = 5.

In the second case (30), you can divide the input by two using a single flip-flop, and once again cascade two ripple counte3rs, one counting to 3 and the other counting to 5. The total number of flip-flops needed would be 1 + 2 + 3 = 6. (Or, you could use one ripple counter counting to 5, and another counting to 6, using the same number of flip-flops.)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.