An implantable medical device includes a memory storing criteria for transitioning between states of a cardiac cycle model, the states including a P-wave state. The device also includes sensing circuitry that senses a cardiac signal that varies as a function of a cardiac cycle of a patient, and also includes processing circuitry coupled to the sensing circuitry. The processing circuitry is configured to detect an R-wave in the sensed cardiac signal, to determine an elapsed time since the detection of the R-wave, to determine one or more morphological values of a post-R-wave segment of the cardiac signal to compare the elapsed time and the one or more morphological values to the stored criteria for transitioning between the plurality of states of the cardiac cycle model, and to detect a P-wave in the sensed cardiac signal in response to a transition to the P-wave state of the cardiac cycle model.