Source: https://www.unilim.fr/pages_perso/vahid/VHDL/exam2011-2012.pdf