forked from nasa/fprime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFpySequencerDirectives.fppi
More file actions
262 lines (199 loc) · 7.77 KB
/
FpySequencerDirectives.fppi
File metadata and controls
262 lines (199 loc) · 7.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
@ sleeps for a relative duration from the current time
struct WaitRelDirective {
# pops U32, U32 off stack
_empty: U8
}
@ sleeps until an absolute time
struct WaitAbsDirective {
# pops U32, U32, FwTimeContextStoreType, FwTimeBaseStoreType off stack
_empty: U8
}
@ sets the index of the next directive to execute
struct GotoDirective {
@ the statement index to execute next
statementIndex: U32
}
@ branches based off of the top byte of the stack
struct IfDirective {
# pops U8 off stack
@ the statement index to go to if the top of the stack is false
falseGotoStmtIndex: U32
# this directive will not goto anywhere if the variable is true
}
@ does nothing
struct NoOpDirective {
# fpp requires we have something in a struct
_empty: U8
}
@ pushes a tlm buf to the stack
struct PushTlmValDirective {
@ the tlm channel id to get the time of
chanId: FwChanIdType
}
@ pushes a tlm buffer to the stack, and then pushes the time
@ of the tlm meas to the stack
struct PushTlmValAndTimeDirective {
@ the tlm channel id to get the time and value of
chanId: FwChanIdType
}
@ pushes a prm buf to the stack
struct PushPrmDirective {
@ the param id to get the value of
prmId: FwPrmIdType
}
@ executes a cmd with const args
struct ConstCmdDirective {
opCode: FwOpcodeType
@ the arg buf of the cmd
argBuf: [Fpy.MAX_DIRECTIVE_SIZE] U8
@ the length of the arg buf byte array
_argBufSize: FwSizeType
}
@ generic stack operation handler
struct StackOpDirective {
@ which stack op to perform
_op: Fpy.DirectiveId
}
@ ends the sequence
struct ExitDirective {
# pops U8 off the stack
_empty: U8
}
@ pushes some empty bytes to the stack
struct AllocateDirective {
$size: Fpy.StackSizeType
}
@ stores a value to a local variable at a compile-time-known offset relative to the current stack frame
struct StoreRelConstOffsetDirective {
@ signed byte offset relative to stack_frame_start
lvarOffset: Fpy.SignedStackSizeType
$size: Fpy.StackSizeType
}
@ loads a value from a local variable at a compile-time-known offset relative to the current stack frame
struct LoadRelDirective {
@ signed byte offset relative to stack_frame_start
lvarOffset: Fpy.SignedStackSizeType
$size: Fpy.StackSizeType
}
@ pushes a const byte array onto stack
struct PushValDirective {
@ the byte array to push
val: [Fpy.MAX_DIRECTIVE_SIZE] U8
@ the length of the val buf
_valSize: FwSizeType
}
@ pops bytes off the top of the stack and does nothing with them
struct DiscardDirective {
@ how many bytes to pop off the stack
$size: Fpy.StackSizeType
}
@ pop two byte arrays off the top of the stack, call memcmp, push 1 if they were equal, 0 otherwise
struct MemCmpDirective {
@ how big a single byte array is. note, we pop 2x this amount off the stack
$size: Fpy.StackSizeType
}
@ pop an opcode and arg buf off the stack, send to cmd dispatcher and await response
struct StackCmdDirective {
@ how big the argument buffer is
argsSize: Fpy.StackSizeType
}
@ pushes the current Fw.Time struct to the stack
struct PushTimeDirective {
_empty: U8
}
@ pops a U32 from the stack and uses it to seed the RNG used by PushRandDirective
struct SetSeedDirective {
_empty: U8
}
@ pushes the next RNG value to the stack
struct PushRandDirective {
_empty: U8
}
@ pops a bool off the stack, sets a flag with a specific index to that bool
struct SetFlagDirective {
flagIdx: U8
}
@ gets a flag and pushes its value as a U8 to the stack
struct GetFlagDirective {
flagIdx: U8
}
@ grabs a specified region from a struct, pushes it to the stack, removing
@ the rest of the struct
struct GetFieldDirective {
# pops an Fpy.StackSizeType offset in the parent off the stack
@ total size of the struct
parentSize: Fpy.StackSizeType
@ size of the member to extract
memberSize: Fpy.StackSizeType
}
@ peeks at N bytes from the stack, starting from an offset relative to the top of the stack
struct PeekDirective {
# pops two StackSizeType off the stack
_empty: U8
}
@ stores a value to a local variable at a runtime-determined offset relative to the current stack frame
struct StoreRelDirective {
# pops a SignedStackSizeType lvar_offset off of stack
@ size of data to pop off stack
$size: Fpy.StackSizeType
}
@ performs a function call
struct CallDirective {
# pops a U32 target directive index off stack
_empty: U8
}
@ returns from a function call
struct ReturnDirective {
@ size of return value in bytes, 0 for void functions
returnValSize: Fpy.StackSizeType
@ total size of function arguments in bytes
callArgsSize: Fpy.StackSizeType
}
@ loads a value from an absolute address in the stack (for global variables)
struct LoadAbsDirective {
@ absolute byte offset from the start of the stack
globalOffset: Fpy.StackSizeType
$size: Fpy.StackSizeType
}
@ stores a value to an absolute address in the stack (for global variables), offset from stack
struct StoreAbsDirective {
# pops an Fpy.StackSizeType global_offset off of stack
$size: Fpy.StackSizeType
}
@ stores a value to an absolute address in the stack (for global variables), const offset
struct StoreAbsConstOffsetDirective {
@ absolute byte offset from the start of the stack
globalOffset: Fpy.StackSizeType
$size: Fpy.StackSizeType
}
internal port directive_waitRel(directive: WaitRelDirective) priority 6 assert
internal port directive_waitAbs(directive: WaitAbsDirective) priority 6 assert
internal port directive_goto(directive: GotoDirective) priority 6 assert
internal port directive_if(directive: IfDirective) priority 6 assert
internal port directive_noOp(directive: NoOpDirective) priority 6 assert
internal port directive_pushTlmVal(directive: PushTlmValDirective) priority 6 assert
internal port directive_pushTlmValAndTime(directive: PushTlmValAndTimeDirective) priority 6 assert
internal port directive_pushPrm(directive: PushPrmDirective) priority 6 assert
internal port directive_constCmd(directive: ConstCmdDirective) priority 6 assert
internal port directive_stackOp(directive: StackOpDirective) priority 6 assert
internal port directive_exit(directive: ExitDirective) priority 6 assert
internal port directive_allocate(directive: AllocateDirective) priority 6 assert
internal port directive_storeRelConstOffset(directive: StoreRelConstOffsetDirective) priority 6 assert
internal port directive_loadRel(directive: LoadRelDirective) priority 6 assert
internal port directive_pushVal(directive: PushValDirective) priority 6 assert
internal port directive_discard(directive: DiscardDirective) priority 6 assert
internal port directive_memCmp(directive: MemCmpDirective) priority 6 assert
internal port directive_stackCmd(directive: StackCmdDirective) priority 6 assert
internal port directive_pushTime(directive: PushTimeDirective) priority 6 assert
internal port directive_setSeed(directive: SetSeedDirective) priority 6 assert
internal port directive_pushRand(directive: PushRandDirective) priority 6 assert
internal port directive_setFlag(directive: SetFlagDirective) priority 6 assert
internal port directive_getFlag(directive: GetFlagDirective) priority 6 assert
internal port directive_getField(directive: GetFieldDirective) priority 6 assert
internal port directive_peek(directive: PeekDirective) priority 6 assert
internal port directive_storeRel(directive: StoreRelDirective) priority 6 assert
internal port directive_call(directive: CallDirective) priority 6 assert
internal port directive_return(directive: ReturnDirective) priority 6 assert
internal port directive_loadAbs(directive: LoadAbsDirective) priority 6 assert
internal port directive_storeAbs(directive: StoreAbsDirective) priority 6 assert
internal port directive_storeAbsConstOffset(directive: StoreAbsConstOffsetDirective) priority 6 assert