# Implementing a total sum with logic gates

I'm trying to implement a total sum that looks like this.

TOTAL = TOTAL + INPUT


I'm using binary adders to add and D flip flops to store TOTAL. However, whenever the TOTAL updates, it again updates because the equation is recursive. How can i make it so that whenever i get an INPUT, it only updates TOTAL once. TOTAL and INPUT are both 6 bits and INPUT returns to 0 after any value is passed to it.

Edit: REF are just outputs. The D flip flops are level triggered and are set to 0 at the start.

• Implement a clocking system. Commented Apr 23, 2020 at 9:40
• Could you elaborate a little more? Commented Apr 23, 2020 at 9:54
• Could you elaborate with a logic diagram? Commented Apr 23, 2020 at 9:55
• Added a diagram Commented Apr 23, 2020 at 10:09
• Where is the clock input on your D type flip flops. Commented Apr 23, 2020 at 10:23

You'll notice that your math teacher would have looked very sternly at your "equation"

TOTAL = TOTAL + INPUT

because if $$\a=a+b\$$, then $$\b=0\$$, or something's wrong.

What you mean is "the value of TOTAL in the next time step is the value of TOTAL now, plus the value of INPUT now".

What that implies is a temporal variation of your circuit's state: you can't build this out of combinatorial logic alone. Something has to store the "old" total while you compute the new.

In fact, this even kind of implies you need a clocked system, with registers (usually implemented through flipflops) holding values.

That is really all I think I can tell you without solving your "homework" (or whatever that is) for you – this gets easier if you imagine you have an external signal "clock" that goes high whenever there's a new INPUT.