Code generation tool for control and status registers