This is the VHDL used for my third year dissertation