CPU (software) and hardware interaction (this is what you want) will work through status and control registers. For example you can instance a control register which will provide an api for cpu access and a digital out bus on the hardware side.