Digital quantum Rabi and Dicke models in superconducting circuits