EHLS.SoC.LiteX (Elixir HLS v0.1.0)

Copy Markdown View Source

The LiteX SoC backend (priv/backend/litex). A target's SoC script puts the circuits of <out>/hw into its LiteX SoC with

sys.path.insert(0, os.path.join(elixir_hls, "priv", "backend", "litex"))
import hls_litex
hls_litex.add_hls(soc, hw_dir, package_dirs)

which adds soc.hwstream:

  • each instance its stages linked by registered streams, running from reset (a CSR bit stops it), its ends towards the CPU a LiteDRAM DMA engine each; a kernel's level arguments wired to instances of levels or pins; instances of levels; the state of named stages readable word by word;
  • the blocks and peripherals of the block packages (their gateware/ Python modules, EHLS.Blocks), configured with the application's options.

CSRs: hwstream_* (the AtomVM runtime's NIFs use them). Built-in blocks: EHLS.SoC.LiteX.Blocks.

A block package for LiteX (EHLS.Blocks, soc/0 = :litex) has its gateware as a Python module (gateware/0) in the package's gateware/ directory with BLOCKS (name -> LiteX module class, built as cls(soc, enable, *args), with a sink and / or source stream endpoint, 32-bit data; optionally source_width / source_signed), PERIPHERALS (name -> function f(soc) adding it to the SoC) and optionally configure(options), called first with the options the application gives the package (as a dict), and optionally add_to_soc(soc), adding a circuit that is no pipeline stage. Its registers (EHLS.Blocks.registers/0) are the CSRs <gateware>_<name>: the module added as soc.<gateware>. EHLS.GPIO is such a package, in this backend (priv/backend/litex/ehls_gpio.py).