kqian wrote
Thanks for the reply. I wonder how engineers solve problems like this in the real hardware. Where can I read more about it?
For an example of a timing problem in hardware and how to mitigate it, see my page on
hazards.
Here's a sample
DFF IC datasheet.
A quick search didn't turn up any free ebooks on digital design. You might try searching google books for terms like "microelectronic design". If you find a book that looks interesting, try searching for an older edition using
bookfinder.com. It often turns up cheap copies of older books.
--Mark