<aside> 🐬 Toggle flip flop: built using a DFF. Toggles ints output state (from 0 → 1 or 1 → 9( with each clock pulse if the T input is high. Maintains previous state if T input is 0.

Untitled

</aside>

$T$ $Q$ D
0 0 0
0 1 1
1 0 1
1 1 0

Example: Synchronous Binary Up Counter

Input to first TFF is kept constant at 1

State at $Q_0$ (TFF 1) is reversed at every clock tick

State at $Q_0$ (TFF 1) is reversed at every clock tick

Untitled

Timing Diagram for the Counter

Untitled

Adding Enable and Reset to Synchronous Counter

Untitled

input reset_m, clock enable;
output reg[3:0] Q;
always @ (posedge clock, negedge reset_m)
	if(!reset_m)
		Q <= 0;
	else if(enable)
		Q <= Q+1; //4 bits increment by 1

Asynchronous (Ripple) Counter

Untitled

Register Enable

Untitled