I am trying to implement magnitude comparators with storage as a D FF. In this picture, if X is equal to 0, second AND gate on magnitude comparator (that comparator in rectangle) will give 1, as Q' > Q. It works as intended, only problem is I cant store the output value. I want to clear the flip flop if input is not equal to 1, so I choose clear input as Q' of third DFF in the picture, but in that case in every clock pulse flip flop always clears. Any help appreciated.