In reply to sasi_8985:
In your code, you are trying to write d=1 at T=2 and also, reading its value via q at T=2 for the first time. So, this is a race-condition. To avoid such cases, you can use non-blocking assignments and try to assign the value of d somewhat prior to triggering clock edge.
@ based events are executed in active region as are all other constructs. Think of @ as a scheduler, which waits for a change to happen.