Dual Inputs Frequency Counter

I did. Is that wrong?

In fact, the top signal rises when the bottom two are high. But it looks like this because there is some delay.