Building a CPU from first principles