Refactor configuration register value calculations

* Also add test for calculation
* Improve documentation and function specifications
* Add and improve type definitions
* Prepare for quick-check-testing of calculation methods