Issue:
- The circuit uses a D latch (level-triggered) with the push button connected to its Enable input.
- While the button is held, the latch remains transparent and continuously captures changing counter values.
- The stored value becomes the counter value at button release instead of the first button press.
Fix:
- Replace the D latch with a positive edge-triggered D flip-flop.
- The flip-flop captures the counter value only at the rising edge of the button signal.
- This ensures one random hex number is stored for each button press.
Difference Between Latches and Flip-Flops:
- Latch: Level-triggered; output can change while the enable signal is active.
- Flip-Flop: Edge-triggered; output changes only at a rising or falling clock/trigger edge.