For example take positive edge triggered D flip flop.If input (D) changes from 1 to 0 at the same time when clock pulse goes from 0 to 1(positive edge of clock pulse), what will be the output (Q).Will it be 1 or 0?
Assume setup time and hold time to be zero
Best Answer
Look in the datasheet for the flipflop, and there will be two specs that address this issue: Setup time and hold time. The setup time is how long the input data needs to be held fixed before the clock, and hold time is how long it needs to remain fixed after the clock. If either of these specs is violated, then the answer is you don't know what state the output will settle at.
Some flipflops have either a 0 setup time or 0 hold time. In that case, the input timing you show would work and be valid. In the case of 0 setup time, the output will take on the input value after the clock, and opposite for 0 hold time.
If your data changes within the time window defined by the combination of setup and hold time, then you get garbage out.