# Program counter possibly counting twice

I have been watching Ben Eater's Building an 8-Bit Breadboard Computer.

Let's say that I use the following version of a positive edge-triggered program counter, taken from the book Digital Logic and Computer Design, by M. Morris Mano -

The following image shows the negative edge-triggered master-slave JK flip-flops used in the counter.

Initially, the Y outputs of all master gated latches and the Q outputs of all slave gated latches are 0's.

Now, let's say that control signals are generated via an EEPROM (i.e. the control unit is microprogrammed).

The control unit generates new signals when the master clock becomes 0 and the step counter counts up.

Now, the master clock (i.e. the CP input) becomes 0 and according to the current control word, the count input becomes 1 and the load input stays 0. This causes the Y output of the topmost flip-flop's master latch to become 1.

Now, the master clock becomes 1, which causes the Q output of the topmost flip-flop's slave latch to become 1.

Finally, when the master clock becomes 0 again, then according to the next control word, the count input becomes 0, ideally preventing the counter from counting anymore.

But, since the control words need time to get generated, wouldn't the Y output of the topmost flip-flop's master latch become 0 while the count input is still at 1 due to the previous control word?

Here is the timing diagram -

CP, Load and Count are inputs to the counter, and the outputs Y and Q are of the topmost flip-flop's master and slave gated latches.

• You could double check this using a simulator very easily at no cost to you except a little time learning to use a very, very important tool. Oct 11, 2023 at 17:50
• That's a lot of words. Can you draw a timing diagram that illustrates the relationships you're talking about? Be clear about which node in the diagram is represented by each waveform. While you're at it, please rotate your image 90° so that we all don't need to strain our necks trying to read it. Oct 11, 2023 at 18:37
• @DaveTweed, I'm sorry. Will do once I reach home. Oct 11, 2023 at 18:43
• @DaveTweed, I've edited my question. Could you please take a look at it now? Oct 12, 2023 at 11:09