A flip-flop is a basic digital memory circuit that can store one bit of state data. Its inputs are a 1-bit data value (D) and a one-bit clock value (clk/Δ) that synchronizes the register to the system. Its output is a one-bit value Q:
On the rising edge of the clock, the output Q is set to the value of the input D (though D may be the same across multiple clock rising edges if no new value is passed). The speed at which the clock sets Q=D is dependent on its clk-to-q delay, which is the time a flip-flop takes for its output to change. At all other times, the output Q remains steady. This means that the flip-flop can store data, as it will be able to maintain its value between time steps.
Note! n-bit register simply consists of n flip-flops, each storing 1 bit of data, bundled together.
An
Examples
Plotting Q's Waveform
Suppose we have the following SDS diagram of the clock and a flip-flop input D:
We can then figure out the output waveform Q by looking at clk and D. Remember that the clock only syncs D=Q at rising edges. In this case, at x=kT+2 for some k and a clock period T=4. The flip-flop in question has a clk-to-q delay of 1 ns.
Since the clock signal is at 0 until t=2, we are unsure of Q‘s value in that time frame. Q may be 1 if D was 1 before t=0, or 0 otherwise.
(t=2): The clock updates, and the output syncs with the input 1 ns later due to clk-to-q delay.