added cycle counter, and increment cycle counter on each clock pulse