the key is to use a (binary) counter.
SET/RESET the pulse output at counter = 0
clear the pulse output at counter = pulse width
clear the counter at counter = pulse width.
This should help you to do some drawings (state machine, timing diagram, truth table...whatever you need), then try coding it on your own. Show your ideas, your code ... so we can comment on it.