1
\$\begingroup\$

enter image description here

My thoughts:

Here price of chocolate is increasing in Geometric progression with common ratio 2 and first term 1, so on nth day price of chocolate will be $T_{n}=2^{n-1}$\ irrespective of wheather child comes to buy it or not. But reward he gets is on basis of what net total sum of amount he had child has spent on purchasing chocolate if it is divisible by 3 then he will get reward else not. He can skip some days too, if sick.

Suppose on day one child went to buy chocolate he spent 1 dollar, on second day he went again and spent 2 dollar, now total cumulative dollar spent is 3 dollar for first two days which is divisible by 3 , so child will get reward on second day itself.

Also if he go to shop on first day and 4th day respectively skipping second, and third day (due to being sick) then total amount spent on the chocolate upto 4th day will be 9 dollar(1dollar on first day+ 8dollar on 4th day) which again is divisible by 3.

Also he will get reward if he goes to buy chocolate on 2nd and 3rd day, skipping 1st and day,then his total spend upto 3rd day will be 6 dollars ,then he will get reward on 3rd day as 6 is divisible by 3.

But i don't know how to generalise it, because there is no upper limit on number of days he went(like week/month/year anything). there are so many sample points. And instructor wants us to design Digital Sequential circuit for it. So, If possible give hints , or some of your thoughts. I would be very grateful. Thanks in advance.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You should ask your instructor for help. That's really the best idea. \$\endgroup\$ Feb 27 at 13:03
  • 1
    \$\begingroup\$ Instead of thinking what kind of circuit you need, why don't you code it behaviourally ? You have one input: sick or not sick. One output: reward or no reward. Consider that the logic is clocked by a clock which counts one day on every clock cycle. Also counts the amount spent. \$\endgroup\$
    – Mitu Raj
    Feb 27 at 13:05
1
\$\begingroup\$

Just my thoughts, without any claim to be correct:

  • 3 inputs:
    • reset to restart the logic
    • clock to mark the change of days (each day is one cycle)
    • sick is active on the edge of clock, if the kid is sick
      (take setup time into account)
  • 1 output:
    • reward will be become active after the edge of clock, if the condition for the reward is met
      (it will become inactive the next day, if the condition is not met any more)
  • a register to know the price of the chocolate
  • an accumulator for the amount spent so far (a register and an adder)
  • a divider by "3" to realize the condition check

Please consider that a combinatorial output can glitch. If this is not correct, the output reward needs to be clocked, too.

You might like to look up "Moore automat" to learn more.

\$\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.