I need to create a clock divider which has 2 inputs: n(12 bit) , clock. For every even N it needs to divide the clock frequency by that number. (2,4,6,8 etc). However I have run into some problems. First of all I created the following divider.
However if I need to do this for 12 bits its going to be too much work. It feels like so much work that there has to be a better way. Also this doesn't cover a lot of values. I do have a question about this design which is: Are you supposed to connect ~Q to the clock input of the next flip flop or should I have connected Q to the clock input?
I thought about a better design and came up with the following. 
I will give some explanation: I used a counter which counts untill it equals a number X in the comparator. Then the Comparator sends a 1 to the flip flop and the flip flop outputs this. But here I have the following problems: - Doesn't auto reset. - It turns on the flipflop after lets say 4 ticks, but it doesn't switch it off.
The auto reset should be easy to fix. But the fact that my flipflop does not turn off after x ticks is less great. My question is am I on the right course or do I need a new approach? If my second design has the right idea please give me some advice on how to get it working.

