Design a generator, to produce the following sequence:

0 → 1 → 1 → 1 → 2 → 2 → 3 → 4 → 5 → 7 → 9 → 12 → 16 → 21 → 28 → 37 → 0 → 1 → 1 → 1 → 2 → …

The diagram below shows the generator circuit. Note the circuit is reset when output reaches 37

2 Comments

    1. Have you noticed that x[N] = x[N-2] + x[N-3]? If so, you have establish the essence of this interview question.

      Obviously, N-3 >= 0, i.e., N has to be at least 3. This also implies we need 3-stage pipeline.

      Upon reset, these 3 stages will be initialized to 0, 1, 1. In addition, when output reaches 37, all stages will be reset again.

      Hope you get the point 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.