During up-counting, the stage-n flipflop should toggle when all lower flipflops are 1. Therefore, in each stage, one AND gate is used to calculate this carry signal for the next stage flipflop. Similarly, during down-counting, the stage-n flipflop should toggle when all lower flipflops are 0. This is calculated using AND gates connected to the NQ outputs of the flipflops. Each AND gate has one additional input that takes the corresponding up or down enable signal. The outputs of both AND gates are then ORed together to enable the J=K=1 inputs to toggle the JK flipflops.
Exercise: Design the logic required to control the carry-out (or 5th bit) for this counter. Run the applet | Run the editor (via Webstart)