What circuit creates this waveform?
As a first try, I recommend you use 2 AND, 1 OR, and an edge-triggered D type flip-flop.  Connect signals 1 and 2 to input of one AND, 2 and 3 to inputs of other AND.  Connect the outputs of the AND gates to inputs of OR gate.  Connect output of OR gate to reset pin of flip-flop.  Connect output of flip-flop to set pin of flip-flop and to the signal 2 inputs of the AND gates. Connect the clk signal to the flip-flop.