fpp/docs/users-guide/Defining-Framework-and-Dictionary-Definitions.adoc

57 lines
1.5 KiB
Plaintext

== Defining Framework and Dictionary Definitions
=== Framework Definitions
*Framework definitions* are type and constant definitions that
are specially used by the F Prime Framework. If a model defines
framework definitions, they must conform to the rules described
in the the _FPP Specification_.
To write a framework definition, we write the type or constant
and ensure that the definition follows the rules for that
framework definition.
For example, to write the `FwDpIdType` framework definition,
we would write an alias `FwDpIdType` that represents an
integer type:
[source,fpp]
----
type FwDpIdType = U32
----
To write the `Fw.DpCfg.CONTAINER_USER_DATA_SIZE` framework definition,
we would define modules `Fw` and `DpCfg` and write a constant
`CONTAINER_USER_DATA_SIZE` with an integer type:
[source,fpp]
----
module Fw {
module DpCfg {
constant CONTAINER_USER_DATA_SIZE = 1
}
}
----
=== Dictionary Definitions
An FPP model may include type and constant definitions
that are *dictionary definitions*. These definitions describe
type and constant definitions that will be output to the
dictionary.
To write a dictionary definition, prefix an array, struct,
alias, or constant definition with the `dictionary` keyword.
For example, to define a constant dictionary definition
we write the following:
[source,fpp]
----
dictionary constant a = 1
----
To define an array dictionary definition, we write the following:
[source,fpp]
----
dictionary array a = [3] U32
----