Skip to content

Commit ff091f1

Browse files
authored
Merge pull request #854 from jwest115/docs/dict-spec-users-guide
User guide updates for dictionary specifier
2 parents 3addd18 + 26c956f commit ff091f1

File tree

11 files changed

+976
-340
lines changed

11 files changed

+976
-340
lines changed

docs/fpp-spec.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,10 +4391,6 @@ <h3 id="Definitions_Dictionary-Definitions">5.16. Dictionary Definitions</h3>
43914391
<div class="sect3">
43924392
<h4 id="Definitions_Dictionary-Definitions_Semantics">5.16.1. Semantics</h4>
43934393
<div class="paragraph">
4394-
<p>If a type definition <em>D</em> is a dictionary definition, then the type
4395-
defined by <em>D</em> must be a <a href="#Types_Displayable-Types">displayable type</a>.</p>
4396-
</div>
4397-
<div class="paragraph">
43984394
<p>If a constant definition <em>D</em> is a dictionary definition, then the
43994395
expression appearing in <em>D</em> must have one of the following types:</p>
44004396
</div>
@@ -4414,6 +4410,10 @@ <h4 id="Definitions_Dictionary-Definitions_Semantics">5.16.1. Semantics</h4>
44144410
</li>
44154411
</ul>
44164412
</div>
4413+
<div class="paragraph">
4414+
<p>If a type definition <em>D</em> is a dictionary definition, then the type
4415+
defined by <em>D</em> must be a <a href="#Types_Displayable-Types">displayable type</a>.</p>
4416+
</div>
44174417
</div>
44184418
<div class="sect3">
44194419
<h4 id="Definitions_Dictionary-Definitions_Examples">5.16.2. Examples</h4>
@@ -12037,7 +12037,7 @@ <h3 id="Analysis-and-Translation_Translation-Tools">22.4. Translation Tools</h3>
1203712037
</div>
1203812038
<div id="footer">
1203912039
<div id="footer-text">
12040-
Last updated 2025-10-29 18:57:16 -0700
12040+
Last updated 2025-11-02 13:05:24 -0800
1204112041
</div>
1204212042
</div>
1204312043
<script src="code-prettify/run_prettify.js"></script>

docs/fpp-users-guide.html

Lines changed: 677 additions & 323 deletions
Large diffs are not rendered by default.

docs/spec/Definitions/Dictionary-Definitions.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ the definition in the ground dictionary.
88

99
==== Semantics
1010

11-
If a type definition _D_ is a dictionary definition, then the type
12-
defined by _D_ must be a <<Types_Displayable-Types, displayable type>>.
13-
1411
If a constant definition _D_ is a dictionary definition, then the
1512
expression appearing in _D_ must have one of the following types:
1613

@@ -19,6 +16,9 @@ expression appearing in _D_ must have one of the following types:
1916
* A <<Types_String-Types,string type>>.
2017
* An <<Types_Enum-Types,enum type>>.
2118

19+
If a type definition _D_ is a dictionary definition, then the type
20+
defined by _D_ must be a <<Types_Displayable-Types, displayable type>>.
21+
2222
==== Examples
2323

2424
[source,fpp]

docs/users-guide/Defining-Components.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,8 @@ for the following:
10511051
. None of the parameters may be a
10521052
<<Defining-Ports_Reference-Parameters,reference parameter>>.
10531053

1054-
. Each parameter must have a *displayable type*, i.e., a
1054+
. Each parameter must have a <<Dictionary-Definitions,displayable type>>, i.e.,
1055+
a
10551056
type that the F Prime ground data system knows how to display.
10561057
For example, the type may not be an
10571058
<<Defining-Types_Abstract-Type-Definitions,abstract type>>.

docs/users-guide/Defining-Constants.adoc

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,3 +737,101 @@ is not legal:
737737
constant
738738
a = 1
739739
--------
740+
741+
=== Framework Constants
742+
743+
Certain constants defined in FPP have a special meaning in the
744+
F Prime framework.
745+
These constants are called *framework constants*.
746+
For example, the constant `Fw.DpCfg.CONTAINER_USER_DATA_SIZE`
747+
defines the size of the user data field in a data product container.
748+
(Data products are an F Prime feature that we describe
749+
<<Defining-Components_Data-Products,in a later section of this manual>>.)
750+
You typically set these constants by overriding configuration
751+
files provided in the directory `default/config` in the F Prime repository.
752+
For example, the file `default/config/DpCfg.fpp` provides a default value for
753+
`Fw.DpCfg.CONTAINER_USER_DATA_SIZE`.
754+
You can override this default value by providing your own version of
755+
the file `DpCfg.fpp`.
756+
The
757+
https://fprime.jpl.nasa.gov/devel/docs/user-manual/framework/configuring-fprime/[F
758+
Prime User Manual]
759+
explains how to do this configuration.
760+
761+
The FPP analyzer does not require that framework constants be defined
762+
unless they are used.
763+
For example, the following model is valid, because it neither defines nor users
764+
`Fw.DpCfg.CONTAINER_USER_DATA_SIZE`:
765+
766+
[source,fpp]
767+
----
768+
constant a = 0
769+
----
770+
771+
The following model is valid because it defines and uses `Fw.DpCfg.CONTAINER_USER_DATA_SIZE`:
772+
773+
[source,fpp]
774+
----
775+
module Fw {
776+
777+
module DpCfg {
778+
779+
constant CONTAINER_USER_DATA_SIZE = 10
780+
781+
}
782+
783+
}
784+
785+
constant a = Fw.DpCfg.CONTAINER_USER_DATA_SIZE
786+
----
787+
788+
The following model is invalid, because it uses `Fw.DpCfg.CONTAINER_USER_DATA_SIZE`
789+
without defining it:
790+
791+
[source,fpp]
792+
--------
793+
constant a = Fw.DpCfg.CONTAINER_USER_DATA_SIZE
794+
--------
795+
796+
If framework constants are defined in the FPP model, then
797+
then they must conform to certain rules.
798+
These rules are spelled out in detail in the
799+
https://nasa.github.io/fpp/fpp-spec.html#Definitions_Framework-Definitions_Constant-Definitions[_The
800+
FPP Language Specification_].
801+
For example, `Fw.DpCfg.CONTAINER_USER_DATA_SIZE` must have an integer type.
802+
So this model is invalid:
803+
804+
[source,fpp]
805+
--------
806+
module Fw {
807+
808+
module DpCfg {
809+
810+
constant CONTAINER_USER_DATA_SIZE = "abc"
811+
812+
}
813+
814+
}
815+
--------
816+
817+
Here is what happens when you run this model through `fpp-check`:
818+
819+
----
820+
% fpp-check
821+
module Fw {
822+
823+
module DpCfg {
824+
825+
constant CONTAINER_USER_DATA_SIZE = "abc"
826+
827+
}
828+
829+
}
830+
^D
831+
fpp-check
832+
stdin:5.5
833+
constant CONTAINER_USER_DATA_SIZE = "abc"
834+
^
835+
error: the F Prime framework constant Fw.DpCfg.CONTAINER_USER_DATA_SIZE must have an integer type
836+
----
837+

docs/users-guide/Defining-Types.adoc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,3 +691,23 @@ defining `T`; elsewhere, configuration code can define
691691
F Prime uses this method to provide basic type whose definitions
692692
configure the framework.
693693
These types are defined in the file `config/FpConfig.fpp`.
694+
695+
=== Framework Types
696+
697+
Certain types defined in FPP have a special meaning in the F Prime
698+
framework.
699+
These types are called *framework types*.
700+
For example, the type `FwOpcodeType` defines the type of
701+
a command opcode.
702+
(Commands are an F Prime feature that we describe
703+
<<Defining-Components_Commands,in a later section of this manual>>.)
704+
705+
Framework types are like <<Defining-Constants_Framework-Constants,framework
706+
constants>>:
707+
you typically define them by overriding configuration files
708+
provided by F Prime, and if they are defined, then they must
709+
conform to certain rules.
710+
https://nasa.github.io/fpp/fpp-spec.html#Definitions_Framework-Definitions_Type-Definitions[_The
711+
FPP Language Specification_] has all the details.
712+
713+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
== Dictionary Definitions
2+
3+
One of the artifacts generated from an FPP model is a *dictionary*
4+
that tells the ground data system how to interpret and display
5+
the data produced by the FSW.
6+
By default, the dictionary contains representations of the following
7+
types and constants defined in FPP:
8+
9+
* Types and constants that are known to the framework and that are
10+
needed by every dictionary, e.g., `FwOpcodeType`.
11+
12+
* Types and constants that appear in the definitions of the data produced
13+
by the FSW, e.g., event specifiers or telemetry specifiers.
14+
(In later sections of this manual we will explain how to define
15+
<<Defining-Components_Events,event reports>> and
16+
<<Defining-Components_Telemetry,telemetry channels>>.)
17+
18+
Sometimes you will need the dictionary to include the definition of a type or
19+
constant
20+
that does not satisfy either of these conditions.
21+
For example, a downlink configuration parameter may be
22+
shared by the FSW implementation and the GDS and may be otherwise unused
23+
in the FPP model.
24+
25+
In this case you can mark a type or constant definition as a *dictionary
26+
definition*.
27+
A dictionary definition tells the FPP analyzer two things:
28+
29+
. The definition should be included in the model, even if it
30+
isn't used anywhere in the model.
31+
32+
. Whenever a dictionary is generated from the model, the definition should be
33+
included in the dictionary.
34+
35+
To write a dictionary definition, you write the keyword `dictionary`
36+
before the definition.
37+
You can do this for a constant definition, a type definition,
38+
or an enum definition.
39+
For example:
40+
41+
[source,fpp]
42+
----
43+
dictionary constant a = 1
44+
dictionary array A = [3] U32
45+
dictionary struct S { x: U32, y: F32 }
46+
dictionary type T = S
47+
dictionary enum E { A, B }
48+
----
49+
50+
Each dictionary definition must observe the following rules:
51+
52+
. A dictionary constant definition must have a numeric value (integer or
53+
floating point),
54+
a Boolean value (true or false), a string value such as `"abc"`, or an
55+
enumerated constant value such as `E.A`.
56+
57+
. A dictionary type definition must define a *displayable type*, i.e., a
58+
type that the F Prime ground data system knows how to display.
59+
For example, the type may not be an
60+
<<Defining-Types_Abstract-Type-Definitions,abstract type>>.
61+
Nor may it be an array or struct type that has an abstract type
62+
as a member type.
63+
64+
For example, the following dictionary definitions are invalid:
65+
66+
[source,fpp]
67+
--------
68+
dictionary constant a = { x = 1, y = 2.0 } # Error: a has struct type
69+
dictionary type T # Error: T is an abstract type
70+
--------

docs/users-guide/Specifying-Models-as-Files.adoc

Lines changed: 96 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,20 +279,62 @@ definitions>>.
279279

280280
==== Syntax
281281

282-
A location specifier consists of the keyword `locate`, a kind of definition,
282+
In general, a location specifier consists of the keyword `locate`, a kind of
283+
definition,
283284
the name of a definition, and a string representing a file path.
284-
For example, to locate the definition of constant `a` at `a.fpp`,
285-
we would write
285+
For type and constant specifiers, there is also an optional `dictionary`
286+
specifier, which we will describe
287+
<<Specifying-Models-as-Files_Location-Specifiers_Dictionary-Definitions,below>>.
288+
289+
For example, to locate the definition
290+
291+
[source,fpp]
292+
----
293+
constant a = 0
294+
----
295+
296+
appearing in the file `a.fpp`, we would write
286297

287298
[source,fpp]
288299
----
289300
# Locating a constant definition
290301
locate constant a at "a.fpp"
291302
----
292303

293-
For the current version of FPP, the kind of definition can be `constant`,
294-
`type`, or `port`.
295-
To locate a type `T` in a file `T.fpp`, we would write the following:
304+
The kind of definition must be one of the following:
305+
306+
[[location-specifier-kinds]]
307+
.Location Specifier Kinds
308+
|===
309+
|Keyword|Meaning
310+
311+
|`component`
312+
|A <<Defining-Components,component definition>>
313+
314+
|`constant`
315+
|A <<Defining-Constants,constant definition>>
316+
317+
|`instance`
318+
|A <<Defining-Component-Instances,component instance definition>>
319+
320+
|`interface`
321+
|A <<Defining-and-Using-Port-Interfaces_Defining-Port-Interfaces,port interface definition>>
322+
323+
|`port`
324+
|A <<Defining-Ports,port definition>>
325+
326+
|`state` `machine`
327+
|A <<Defining-State-Machines,state machine definition>>
328+
329+
|`topology`
330+
|A <<Defining-Topologies,topology definition>>
331+
332+
|`type`
333+
|A <<Defining-Types,type>> or <<Defining-Enums,enum>> definition
334+
|===
335+
336+
As a further example, to locate a type `T` in a file `T.fpp`, we would write the
337+
following:
296338

297339
[source,fpp]
298340
----
@@ -318,6 +360,8 @@ constants are then implied:
318360
locate type E at "E.fpp"
319361
----
320362

363+
The other kinds operate similarly.
364+
321365
==== Path Names
322366

323367
As with
@@ -397,6 +441,52 @@ and suppose that file `b.fpp` contains the include specifier `include "a.fppi"`.
397441
When analyzing `b.fpp`, the location of the definition of the constant `a`
398442
is `b.fpp`, not `a.fppi`.
399443

444+
==== Dictionary Definitions
445+
446+
For type and constant specifiers only, if the definition being located
447+
is a
448+
<<Dictionary-Definitions,dictionary definition>>, then you must
449+
write the keyword `dictionary` after the keyword `locate`
450+
and before the definition kind.
451+
For example, to locate the dictionary definition
452+
453+
[source,fpp]
454+
----
455+
dictionary constant b = 1
456+
----
457+
458+
appearing in the file `b.fpp`, we would write
459+
460+
[source,fpp]
461+
----
462+
# Locating a dictionary constant definition
463+
locate dictionary constant b at "b.fpp"
464+
----
465+
466+
The `dictionary` keyword tells the analyzer that the definition is a dictionary
467+
definition and so should be included in the dependency files of the model,
468+
regardless of whether the definition is used in the model.
469+
470+
If a definition is a dictionary definition and the corresponding location
471+
specifier does not specify `dictionary` (or vice versa), then the analyzer
472+
will report an error.
473+
474+
==== Repeated Location Specifiers
475+
476+
An FPP model may contain any number of location specifiers for the same
477+
definition, so long as the following conditions are met:
478+
479+
. All the specifiers must be consistent.
480+
This means that all the specifiers for the same definition
481+
provide the same location, and either they all specify `dictionary`
482+
or none of them does.
483+
484+
. All the specifiers must agree with the definition, if it exists
485+
in the model.
486+
This means that the location specifiers specify the location
487+
of the definition, and the specifiers specify `dictionary`
488+
if and only if the definition is a dictionary definition.
489+
400490
=== Locating Definitions
401491

402492
Given a collection of FPP source files _F_, you can generate location specifiers

0 commit comments

Comments
 (0)