Source: https://openlab.citytech.cuny.edu/wang-cet4805/files/2019/07/Design-A-Counter-Using-State-Machine-Design-and-Programming-a-FPGA.pdf