Synchronization issue with clock in D Flip-Flop


I am facing an issue. Could you help me figure out why dout is not synchronized with clk when using both posedge and negedge in the always block even when I give posedge separately. But its working when I use combinational statement like
assign dout = (rst) ? 0 : din;
What might be the issue?

Very hard to debug your issue without seeing all the code as text (not a picture of it) or even a link to the code.

One think I do see is your stimulus is in a race condition with the clock. Use the negative edge to apply stimulus.

1 Like

Okay Sir. In that case let me share you my code link.
Link – EDA Playground