What is a datapath and how does it work in a computer system?