The Worker Source Files
The worker source files must be written according to the authoring model. As a starting point the ocpidev tool creates an empty skeleton of a worker implementation that will compile, build and execute, doing nothing.
How Parameter Value Settings Appear in Source Code
Parameter values are compile-time constants in all authoring models. The precise way that parameters and their values appear in source code varies by authoring model and programming language. There are standard data types for properties (see Scalar Data Types for Properties), and constants are defined that specify these values. Examples are:
C and C++: A
static constvariable is defined which is initialized to the parameter value. The name of the variable is the property name prefixed withOCPI_PARAM_.VHDL: A generic with the parameter’s name is set to the value.
Verilog: A parameter with the parameter’s name is set to the value.
Building Workers
Workers are normally built as part of building a whole component library, or as part of building a whole project. To simply compile new code and locate syntax errors, a worker can be built in the worker’s directory, by typing ocpidev build worker.
Building OpenCPI Workers
ocpidev build worker
Build an OpenCPI Worker.
Usage:
$ ocpidev build worker [OPTIONS] [Worker]
Arguments:
[Worker]
Options:
-l, --library Library: Specify the Library that the asset resides in.-p, --project Project: Specify the Project that the asset resides in.--rcc-platform RCC Platform: RCC Platform(s) to apply the command for.--hdl-platform HDL Platform: HDL Platform(s) to apply the command for.--hdl-target HDL Target: HDL Targets(s) to apply the command for.--doc-only: Only build docs.--no-doc: Do not build docs.--artifacts-only: Clean up intermediate build files.--optimize: Build rcc assets with compiler optimization enabled.--report-format [junit]: Format of report(s). [default: junit]--report-path FILE: Path of file to write report(s) to.--builder [make]: Specify the Builder to use to run the asset(s). [default: make]--help: Show this message and exit.
The target or platform of a worker build is specified in several ways. For software authoring models the default target is always the local development machine on which the building is taking place. For other authoring models, there is no default.
Default target and platform settings can also be set in project’s Project.xml file or the library’s <library-name>.xml file. In this case the syntax is setting XML attributes of the form:
<Model>Target(s)
Some examples are:
HdlTargets='zynq artix7'
HdlPlatforms='zed zcu104'
RccPlatforms='rocky9 xilinx24_1_aarch32'
Workers can be built for multiple targets with one command. This can be useful to check whether the source code is acceptable to all the different compilers.
The worker build process has make-style dependencies such that rebuilds will only happen if any dependent files are changed, including the OCS/OPS/OWD XML files.