# Wrapper for Moku Compile

Wrapper changes

From MokuOS version 4.1.1 and above, we recommend users use the CustomInstrument entity wrapper. This change mainly affects the Control register definition and the availability of Status registers. For legacy purposes, CustomWrapper is still available but will be deprecated soon.

To implement your custom design, Moku Compile requires an entity to define the interface and a simple abstraction from the instrument slot. The wrapper is provided in both VHDL and Verilog (SystemVerilog).

Note when using Verilog: the wrapper needs to be declared before defining the custom architecture. For ease of use, this wrapper declaration is automatically generated whenever a new Verilog file is created.

# Implementing the wrapper

This wrapper is implemented either as CustomInstrument or CustomWrapper (for MokuOS versions older than 4.1.1). Implementing the wrapper interface simply requires defining an architecture using either CustomInstrument or CustomWrapper.

Wrapper Implementation

  1. Only one architecture should exist in your project, using either the CustomWrapper or CustomInstrument entity. If multiple architectures exist, the one that is synthesized could be undefined.
  2. It is recommended not to modify the Verilog module declaration. While a bitstream may still be generated if the module definition is changed, it might not behave as expected.

# CustomInstrument Architecture

For Moku devices running MokuOS versions 4.1.1 and newer, the CustomInstrument entity can be used to define the architecture. This entity allows the use of status registers for Custom Instrument designs.

# CustomWrapper Architecture

For Moku devices running MokuOS versions 4.0.3 and older, the legacy CustomWrapper must be defined in the architecture. Note that this wrapper architecture will be deprecated in the future. While it is currently supported, we recommend updating projects to implement the CustomInstrument.

# Wrapper Ports

The details of input, output and clock use are platform specific. For details, see input and output.

# Control Registers

These provide control of custom designs at runtime. See control registers.

# Status Registers

These registers can be used as indicators in custom designs during runtime. See status registers.