Documentation

Index

Constants

View Source
const (
	ReadOnly = iota
	WriteOnly
	ReadWrite
)

Constants for opening RAM on the FGPA

Variables

This section is empty.

Functions

This section is empty.

Types

type Kernel

type Kernel struct {
	// contains filtered or unexported fields
}

Kernel is a a function that runs on an FGPA.

func (*Kernel) Release

func (kernel *Kernel) Release()

Release a previously acquired Kernel

func (*Kernel) Run

func (kernel *Kernel) Run(_ ...uint)

Run will start execution of the Kernel with the number of dimensions. Most uses of this should be called as

kernel.Run()

func (*Kernel) SetArg

func (kernel *Kernel) SetArg(index uint, val uint32)

SetArg passes the uint32 as an argument to the Kernel. The resulting type on the kernel will be a uint32.

func (*Kernel) SetMemoryArg

func (kernel *Kernel) SetMemoryArg(index uint, mem *Memory)

SetMemoryArg passes the pointer to Memory as an argument to the Kernel. The resulting type on the kernel will be a uintptr.

type Memory

type Memory struct {
	// contains filtered or unexported fields
}

Memory represents a segment of RAM on the FGPA

func (*Memory) Free

func (mem *Memory) Free()

Free a previously allocated Memory.

func (*Memory) Reader

func (mem *Memory) Reader() *MemoryReader

Reader constructs a one-time use reader for a Memory. This has the standard io.Reader interface. For example, to copy from the FPGA with the binary package:

    var input [256]uint32
	err := binary.Read(buff.Reader(), binary.LittleEndian, &input)

func (*Memory) Writer

func (mem *Memory) Writer() *MemoryWriter

Writer constructs a one-time use writer for a Memory. This has the standard io.Writer interface. For example, to copy data to the FPGA with the binary package:

    var input [256]uint32
	err := binary.Write(buff.Writer(), binary.LittleEndian, &input)

type MemoryReader

type MemoryReader struct {
	// contains filtered or unexported fields
}

MemoryReader is an io.Reader to RAM on the FPGA

func (*MemoryReader) Read

func (reader *MemoryReader) Read(bytes []byte) (n int, err error)

type MemoryWriter

type MemoryWriter struct {
	// contains filtered or unexported fields
}

MemoryWriter is an io.Writer to RAM on the FPGA

func (*MemoryWriter) Write

func (writer *MemoryWriter) Write(bytes []byte) (n int, err error)

type Program

type Program struct {
	// contains filtered or unexported fields
}

Program ways to lookup kernels

func (*Program) GetKernel

func (program *Program) GetKernel(kernelName string) *Kernel

GetKernel will return the specific Kernel from the Program. The input argument is the name of the Kernel in the Program (typically "reconfigure_io_sdaccel_builder_stub_0_1").

This needs to be released when done.

kernel := program.GetKernel("reconfigure_io_sdaccel_builder_stub_0_1")
defer kernel.Release()

func (*Program) Release

func (program *Program) Release()

Release a previously acquired Program.

type World

type World struct {
}

World is an opaque structure that allows communication with FPGAs.

func NewWorld

func NewWorld() World

NewWorld creates a new World. This needs to be released when done. This can be done using `defer`

world := xcl.NewWorld()
defer world.Release()

func (World) Import

func (world World) Import(program string) *Program

Import will search for an appropriate xclbin and load their contents, either in a simulator for hardware simulation, or onto an FPGA for actual hardware. The input argument is the name of the program from the build procedure (typically "kernel_test"). The returned value is the program used for interacting with the loaded xclbin.

This needs to be released when done. This can be done using defer.

program := world.Import("kernel_test")
defer program.Release()

func (*World) Malloc

func (world *World) Malloc(flags uint, size uint) *Memory

Malloc allocates a number of bytes on the FPGA. The resulting structure represents a pointer to Memory on the FGPA.

This needs to be freed when done.

buff := world.Malloc(xcl.WriteOnly, 512)
defer buff.Free()

func (*World) Release

func (world *World) Release()

Release cleans up a previously created World.

Source Files