Static parameters

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

Static parameters

Awb model can support static, build-time, parameters that are specified in a module’s .awb file as follows:


%param [--global] <PARAMETER-NAME> <NUMERIC-PARAMETER-VALUE> "<PARAMETER-DESCRIPTION>"

or 

%param [--global] <PARAMETER-NAME> "<STRING-PARAMETER-VALUE>" "<PARAMETER-DESCRIPTION>"

For example, in the module with awb-type foo, one would define a trace parameter as follows:

.
.
%provides foo

%param ENABLE_TRACE 0 "Enable an output debug trace"
%param TRACE_FILE "trace.out" "Trace file name"

.
.

Using the parameter

The example parameter can be used by including a file that is synthesized as part of the configuration process in a directory tree awb/provides/. The details are language specific:

C/C++

The parameter is made available with the following #include directive:


#include "awb/provides/foo.h"

Then you will get a line that looks like:


#define ENABLE_TRACE 0
#define TRACE_FILE "trace.out"

Bluespec

The parameter is made available with the following `include directive:

`include awb/provides/foo.bsh

Then you will get a some lines that look like:

`define ENABLE_TRACE 0
`define ENABLE_TRACE_Z 0
`define TRACE_FILE "trace.out"

(I don’t know what the _Z convention is for).

Note: there are lots of `ifdef guards in foo.bsh so that you don’t try to recursively import the module being defined, so
you can even use the `include of foo.bsh in Foo.bsv.

Changing the value of the parameter

Parameters are specified in a model’s .apm file and can be set using the apm-edit program. Example needed…

The —global switch to the %param directive cause the parameter to be visible in the parent model when the module is part of a submodel in that model.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.