SAR Logic

The fig shown is taken from " Data converers", by Razzavi. It shows the SAR logic for 8-bits SAR ADC. Design SAR logic for 4-bits.

The submission should have an explanation about the working of SAR logic and a timing diagram with set,reset,clock, comparator output and the digital outputs.