You misunderstood your problem (and you should not have accepted the answer) - the question is fundamentally not related to βlatchesβ. Your code does not make sense (for synthesis). Quartus knows it, and it basically tells you rewrite your code.
Do you have a combinatorial unit, which increases the number (once) when a change in signal. Two problems: (1) it is certainly not what you want in real (2) the number must remain constant and do not increase when b1 and b2 are not changed. Isue second - the one about which Quartus reports - your circuit needs some memory, which it reports as "latch". This is not smart enough to tell about the first problem that is a real problem.
Try to draw a diagram as a framework with real equipment. What does the change in the b1 and b2 'actually mean? How are you going to maintain the value of the batteries when b1 and b2 are not changed? Driving is not impossible, but it goes beyond the question of SO.
Make synchronization circuit, starting at the edge of the clock, only the clock (and, possibly, reset) in the sensitivity list, and just keep the inside of the same. There is nothing wrong with your statement, if , since you actually want the battery remained intact if anything interesting happens on the b1 / b2.
source share