Introducing our Fixed Point Number Library

We’ve recently released a fork of the Go fixed point number library, which is designed to work well on FGPAs: fixed.

We’ve had a lot of users wanting to target statistics applications, and our lack of floating point support has been a limitation for them. Floating point is possible on an FGPA, but uses a large proportion of the available logic on the FGPA and is hard to optimize to be faster than a CPU. Fixed point arithmetic has a runtime and area characteristics on par with integer arithmetic, but can model a limited amount of fractional values.

Internally, we’ve been using fixed point representations for our own statistics examples, and it’s been working well. Because of user demand, we decided to officially support this as a package. In the process, we’ve ensured it’s optimized to have the best runtime and area performance our compiler can provide.

Using it in your kernels supports including vendor packages, including our fixed point library, in your kernels. You can use your favorite Go dependency manager to add it to your kernel. We use glide for our code.

$ glide create --non-interactive
[INFO] Generating a YAML configuration file and guessing the dependencies
[INFO] Attempting to import from other package managers (use --skip-import to skip)
[INFO] Scanning code to look for dependencies
[INFO] Writing configuration file (glide.yaml)
[INFO] You can now edit the glide.yaml file. Consider:
[INFO] --> Using versions and ranges. See
[INFO] --> Adding additional metadata. See
[INFO] --> Running the config-wizard command to improve the versions in your configuration
$ glide get
[INFO] Preparing to install 1 package.
[INFO] Attempting to get package
[INFO] --> Gathering release information for
[INFO] --> Adding to your configuration
[INFO] Downloading dependencies. Please wait...
[INFO] --> Fetching updates for
[INFO] Resolving imports
[INFO] Downloading dependencies. Please wait...
[INFO] Exporting resolved dependencies...
[INFO] --> Exporting
[INFO] Replacing existing vendor dependencies

You should now see it in your vendor directory, where you can import it into your kernel and host code.

$ tree vendor
└── ReconfigureIO
└── fixed
├── examples
│ └── mult
│ ├── cmd
│ │ └── test-mult
│ │ └── main.go
│ └── main.go
├── fixed.go
├── Makefile

Check our godoc to see the API, which is compatible with both kernel and host code.

Questions or comments

If you have any feedback on the design of the library, feel free to open an issue. If you are looking for support on integrating it into your own kernel, visit our community forum.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.