Skip to content

Dynamic parameters

Michael Adler edited this page Mar 4, 2015 · 1 revision

Dynamic parameters

Dynamic parameters provide a simple interface for setting hardware configuration at run time.

Dynamic parameters are guarded – dynamic parameters cannot be read by the hardware until they have been initialized.


The creation of a dynamic parameter requires declarations in both an AWB file and in the program source.

%param --dynamic SLEEP_TIME 128  "Time between attempts to transmit"
%param --dynamic VERBOSE 0       "Turn on all print outs"

Here, two parameters are declared: SLEEP_TIME and VERBOSE. These parameters have default values or 128 and 0 respectively.

   `include "awb/dict/PARAMS_CONNECTED_APPLICATION.bsh" // Include parameter id.  Headers are generated per awb type


   PARAMETER_NODE paramNode  <- mkDynamicParameterNode();
   Param#(8) sleepTime <- mkDynamicParameter(`PARAMS_CONNECTED_APPLICATION_SLEEP_TIME,paramNode);
   Param#(1) verbose   <- mkDynamicParameter(`PARAMS_CONNECTED_APPLICATION_VERBOSE,paramNode); // Yes! Hardware can have a verbose mode.

Dynamic parameters require two separate modules: parameter node and parameter. Parameter nodes instantiate a chain endpoint, and receive a broadcast for all dynamic parameters. Parameters witness these broadcasts and act as a filter. If the broadcast parameter matches the parameter of the node, then the parameter will update its value. Parameter identification numbers are assigned by the LEAP compiler, and are referenced by awb type. In the example above, a parameter ID is `PARAMS_CONNECTED_APPLICATION_VERBOSE. The name of the parameter is VERBOSE, while CONNECTED_APPLICATION refers to the awb type of the .awb file declaring the parameter.

In the case that multiple parameters are be configured off a single parameter node, overall design area is reduced.

Command line parameters

> ./run --parameter VERBOSE=1 --parameter SLEEP_TIME=0

Dynamic parameters also support a command-line interface. If a parameter is not overridden at the command line, then the hardware will receive the default parameter value, as declared in the .awb file.

You can’t perform that action at this time.