Why use this?

In short, Bits accelerates development time for programming hardware registers.  It saves time and saves money.

But how?

When you use Bits you enter the format information for each register, and Bits does the tedious work of generating the necessary macros to access the registers, memory regions, and bit fields defined for these. You can then spend your energy focussing on how your hardware works.

Here is how bits can be effective:

  • Maintainability. By using Bits across a project(s) you get a consistent method by which hardware is programmed. Software developers maintaining the code base will appreciate a similar look and feel for programming devices across the entire project.
  • The code generated by Bits uses similar macros for all register accesses.  The implication of this is what makes Bits powerful.  By having all register accesses go through similar macros the following can easily be achieved.
    • Stubbing out of code when hardware is not ready. This allows you to run your application in a host mode while waiting for hardware to be completed. Often, developers have hardware accesses sprinkled throughout their code base, and code can look a bit ugly with lots of #IFDEFs to stub out the hardware.  Using Bits, stubbing out code for hardware accesses can be done in one place.
    • Ability to simulate hardware.  Since all register accesses funnel through one area, writing a simulator for hardware becomes much easier.
    • Debugging in ways not possible otherwise.  Consider being able to trace hardware interactions in one place in software, or being able to log accesses to memory for later viewing.
  • No need to define register masks by hand.  Bits accepts information by bit numbers, the same way specified in many data sheets or programming references.
  • Ever forget to use the keyword “volatile” and spend forever (well, an hour or two) debugging the problem? With Bits, since code generation is template based, you wont have this problem.

Below is an example of register field definitions that can be set for each register.

Each field has a name, bit location and size, and indications of whether read and/or write accessors are to be generated for the field.