package module
Version: v0.0.0-...-019e8e9 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2017 License: BSD-3-Clause Imports: 0 Imported by: 5


fixed: a library for fixed-point arithmetic

Build Status Documentation

This is a fork of Go's fixed point library, optimized for FPGAs running on the platform.

It currently provides only Q26:6 and Q52:12 precision¹ types. If you need other precisions, open an issue or a pull request.

¹ See the Wikipedia page on the Q number format for information on this notation.

Using in your kernels supports including vendor packages 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.

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


Pull requests & issues are enthusiastically accepted!

By participating in this project you agree to follow our Code of Conduct.



Package fixed implements fixed-point integer types for FPGAs



This section is empty.


This section is empty.


This section is empty.


type Int26_6

type Int26_6 int32

func I26

func I26(i int32) Int26_6

func I26F

func I26F(i int32, f int32) Int26_6

func (Int26_6) Add

func (x Int26_6) Add(y Int26_6) Int26_6

An alias for the builtin addition operation. It is recommended that you use the primitive + to avoid the overhead of a function call.

func (Int26_6) Ceil

func (x Int26_6) Ceil() int32

The least integer greater than x.

func (Int26_6) Floor

func (x Int26_6) Floor() int32

The greatest integer value ≤ x.

func (Int26_6) Mul

func (x Int26_6) Mul(y Int26_6) Int26_6

The product of x * y. Please note there is no overflow detection at this point.

func (Int26_6) Round

func (x Int26_6) Round() int32

The nearest integer to x.

type Int52_12

type Int52_12 int64

func I52

func I52(x int64) Int52_12

func I52F

func I52F(x int64, f int64) Int52_12

func (Int52_12) Ceil

func (x Int52_12) Ceil() int64

The least integer greater than x.

func (Int52_12) Floor

func (x Int52_12) Floor() int64

The greatest integer value ≤ x.

func (Int52_12) Mul

func (x Int52_12) Mul(y Int52_12) Int52_12

Mul returns x*y in 52.12 fixed-point arithmetic.

func (Int52_12) Round

func (x Int52_12) Round() int64

The nearest integer to x.

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL