EHLS.Runtime behaviour (Elixir HLS v0.1.0)

Copy Markdown View Source

A runtime backend: what the generated functions call on the CPU to use the hardware.

The generated code calls module(): pipe_enable(pipeline, on), level_start(level, pipeline, words), peek(stage, words), mem_read(stage, addr, count), an instance's CPU ends end_send/5, end_request/5, end_cancel/1, end_push/3, pack(list, layout) and unpack(binary, layout) (as EHLS.pack/2 and EHLS.unpack/2), and block packages reg_read(reg), reg_write(reg, value) (EHLS.Blocks.registers/0), with indices from the generated module :hw_kernels that generate/1 writes (runtime/0 there names module(), reg/2 and data/2 serve the packages). The behaviour assumes no particular VM: a call may block, be served by a process or go through Linux.

Summary

Callbacks

Writes what the application needs at run time (e.g. <out>/gen/hw_kernels.erl) from <out>/hw.

For --target cpu: writes the NIF kernels' table and index (e.g. <out>/gen/ehls_nif_kernels.c) from <out>/cpu.

The module the generated functions call.

The short name (EHLS_RUNTIME).

The SoC backends it works with (their names); []: any.

Callbacks

generate(out)

@callback generate(out :: Path.t()) :: :ok

Writes what the application needs at run time (e.g. <out>/gen/hw_kernels.erl) from <out>/hw.

generate_nif(out)

(optional)
@callback generate_nif(out :: Path.t()) :: :ok

For --target cpu: writes the NIF kernels' table and index (e.g. <out>/gen/ehls_nif_kernels.c) from <out>/cpu.

module()

@callback module() :: module()

The module the generated functions call.

name()

@callback name() :: atom()

The short name (EHLS_RUNTIME).

socs()

@callback socs() :: [atom()]

The SoC backends it works with (their names); []: any.