A method and circuit QED implementation of a control-phase quantum logic gate UCP(θ) = diag[1,1,1, eiθ]. Two qubits Qi, two resonators Ra, Rb and a modulator. Q1 and Q2, each has a frequency ωqi and characterized by ðzi. Ra is associated with Q1 and defined by a quantum non-demolition (QND) longitudinal coupling g1zð1z(â† + â). Rb is integrated into Ra, the QND second longitudinal coupling is defined by Ra as g2zð2z(b̂†+b̂) or, when Rb is integrated into Ra, the QND second longitudinal coupling is defined by Ra as g2zð2z(â† + â) The modulator periodically modulates, at a frequency ωm during a time t, the longitudinal coupling strengths g1z and g2z with respective signals of respective amplitudes g̃1 and g̃2. Selecting a defined value for each of t, g1z and g2z determines θ to specify a quantum logical operation performed by the gate. Q1 and Q2 are decoupled when either one of g1z and g2z is to set to 0.