11 void FpySequencer::sendSignal(
Signal signal) {
30 FW_ASSERT(
false, static_cast<FwAssertArgType>(signal));
36 void FpySequencer::handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err) {
37 this->m_tlm.lastDirectiveError = err;
39 this->m_tlm.directiveErrorIndex = this->currentStatementIdx();
40 this->m_tlm.directiveErrorId = id;
47 cmdBuf.
serializeFrom(static_cast<FwPacketDescriptorType>(Fw::ComPacketType::FW_PACKET_COMMAND));
70 static_cast<U32
>(((this->m_sequencesStarted & 0xFFFF) << 16) | (this->m_statementsDispatched & 0xFFFF));
80 this->sendSignal(this->waitRel_directiveHandler(directive, error));
87 this->sendSignal(this->waitAbs_directiveHandler(directive, error));
94 this->sendSignal(this->goto_directiveHandler(directive, error));
101 this->sendSignal(this->if_directiveHandler(directive, error));
108 this->sendSignal(this->noOp_directiveHandler(directive, error));
116 this->sendSignal(this->pushTlmVal_directiveHandler(directive, error));
124 this->sendSignal(this->pushTlmValAndTime_directiveHandler(directive, error));
131 this->sendSignal(this->pushPrm_directiveHandler(directive, error));
138 this->sendSignal(this->constCmd_directiveHandler(directive, error));
145 this->sendSignal(this->stackOp_directiveHandler(directive, error));
146 handleDirectiveErrorCode(directive.
get__op(), error);
152 this->sendSignal(this->exit_directiveHandler(directive, error));
159 this->sendSignal(this->allocate_directiveHandler(directive, error));
167 this->sendSignal(this->storeRelConstOffset_directiveHandler(directive, error));
174 this->sendSignal(this->pushVal_directiveHandler(directive, error));
181 this->sendSignal(this->loadRel_directiveHandler(directive, error));
188 this->sendSignal(this->discard_directiveHandler(directive, error));
195 this->sendSignal(this->memCmp_directiveHandler(directive, error));
202 this->sendSignal(this->stackCmd_directiveHandler(directive, error));
209 this->sendSignal(this->pushTime_directiveHandler(directive, error));
216 this->sendSignal(this->setSeed_directiveHandler(directive, error));
223 this->sendSignal(this->pushRand_directiveHandler(directive, error));
230 this->sendSignal(this->getField_directiveHandler(directive, error));
237 this->sendSignal(this->peek_directiveHandler(directive, error));
244 this->sendSignal(this->storeRel_directiveHandler(directive, error));
251 this->sendSignal(this->call_directiveHandler(directive, error));
258 this->sendSignal(this->return_directiveHandler(directive, error));
265 this->sendSignal(this->loadAbs_directiveHandler(directive, error));
272 this->sendSignal(this->storeAbs_directiveHandler(directive, error));
280 this->sendSignal(this->storeAbsConstOffset_directiveHandler(directive, error));
287 this->sendSignal(this->popEvent_directiveHandler(directive, error));
295 this->sendSignal(this->popSerializable_directiveHandler(directive, error));
301 if (this->m_runtime.stack.size < 8) {
308 U32 uSeconds = this->m_runtime.stack.pop<U32>();
309 U32 seconds = this->m_runtime.stack.pop<U32>();
311 wakeupTime.
add(seconds, uSeconds);
312 this->m_runtime.wakeupTime = wakeupTime;
317 Signal FpySequencer::waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error) {
323 U32 uSeconds = this->m_runtime.stack.pop<U32>();
324 U32 seconds = this->m_runtime.stack.pop<U32>();
328 this->m_runtime.wakeupTime =
Fw::Time(static_cast<TimeBase::T>(base), ctx, seconds, uSeconds);
333 Signal FpySequencer::goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error) {
339 m_runtime.nextStatementIndex = directive.get_statementIndex();
344 Signal FpySequencer::if_directiveHandler(
const FpySequencer_IfDirective& directive,
DirectiveError& error) {
345 if (this->m_runtime.stack.size < 1) {
355 if (this->m_runtime.stack.pop<
U8>() != 0) {
361 this->m_runtime.nextStatementIndex = directive.get_falseGotoStmtIndex();
365 Signal FpySequencer::noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error) {
369 Signal FpySequencer::pushTlmVal_directiveHandler(
const FpySequencer_PushTlmValDirective& directive,
393 Signal FpySequencer::pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
426 this->m_runtime.stack.push(timeEsb.getBuffAddr(),
static_cast<Fpy::StackSizeType>(timeEsb.getSize()));
430 Signal FpySequencer::pushPrm_directiveHandler(
const FpySequencer_PushPrmDirective& directive,
DirectiveError& error) {
454 Signal FpySequencer::constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error) {
461 if (this->sendCmd(directive.get_opCode(), directive.get_argBuf(), directive.get__argBufSize()) ==
472 if (this->m_runtime.stack.size <
sizeof(
U8) * 2) {
475 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<
U8>() | this->m_runtime.stack.pop<
U8>()));
479 if (this->m_runtime.stack.size <
sizeof(
U8) * 2) {
482 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<
U8>() & this->m_runtime.stack.pop<
U8>()));
486 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
489 this->m_runtime.stack.push(static_cast<U8>((this->m_runtime.stack.pop<I64>() == this->m_runtime.stack.pop<I64>())
495 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
498 this->m_runtime.stack.push(static_cast<U8>((this->m_runtime.stack.pop<I64>() != this->m_runtime.stack.pop<I64>())
504 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
507 U64 rhs = this->m_runtime.stack.pop<
U64>();
508 U64 lhs = this->m_runtime.stack.pop<
U64>();
514 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
517 U64 rhs = this->m_runtime.stack.pop<
U64>();
518 U64 lhs = this->m_runtime.stack.pop<
U64>();
524 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
527 U64 rhs = this->m_runtime.stack.pop<
U64>();
528 U64 lhs = this->m_runtime.stack.pop<
U64>();
534 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
537 U64 rhs = this->m_runtime.stack.pop<
U64>();
538 U64 lhs = this->m_runtime.stack.pop<
U64>();
544 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
547 I64 rhs = this->m_runtime.stack.pop<I64>();
548 I64 lhs = this->m_runtime.stack.pop<I64>();
554 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
557 I64 rhs = this->m_runtime.stack.pop<I64>();
558 I64 lhs = this->m_runtime.stack.pop<I64>();
564 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
567 I64 rhs = this->m_runtime.stack.pop<I64>();
568 I64 lhs = this->m_runtime.stack.pop<I64>();
574 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
577 I64 rhs = this->m_runtime.stack.pop<I64>();
578 I64 lhs = this->m_runtime.stack.pop<I64>();
584 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
587 F64 rhs = this->m_runtime.stack.pop<
F64>();
588 F64 lhs = this->m_runtime.stack.pop<
F64>();
595 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
598 F64 rhs = this->m_runtime.stack.pop<
F64>();
599 F64 lhs = this->m_runtime.stack.pop<
F64>();
606 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
609 F64 rhs = this->m_runtime.stack.pop<
F64>();
610 F64 lhs = this->m_runtime.stack.pop<
F64>();
616 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
619 F64 rhs = this->m_runtime.stack.pop<
F64>();
620 F64 lhs = this->m_runtime.stack.pop<
F64>();
621 this->m_runtime.stack.push(static_cast<U8>(std::islessequal(lhs, rhs) ? static_cast<U8>(
FW_SERIALIZE_TRUE_VALUE)
626 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
629 F64 rhs = this->m_runtime.stack.pop<
F64>();
630 F64 lhs = this->m_runtime.stack.pop<
F64>();
636 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
639 F64 rhs = this->m_runtime.stack.pop<
F64>();
640 F64 lhs = this->m_runtime.stack.pop<
F64>();
641 this->m_runtime.stack.push(static_cast<U8>(std::isgreaterequal(lhs, rhs)
647 if (this->m_runtime.stack.size <
sizeof(
U8)) {
650 this->m_runtime.stack.push(static_cast<U8>((this->m_runtime.stack.pop<
U8>() == 0)
657 if (this->m_runtime.stack.size <
sizeof(
F32)) {
660 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<
F32>()));
665 if (this->m_runtime.stack.size <
sizeof(
F64)) {
668 this->m_runtime.stack.push(static_cast<F32>(this->m_runtime.stack.pop<
F64>()));
672 if (this->m_runtime.stack.size <
sizeof(
F64)) {
675 this->m_runtime.stack.push(static_cast<I64>(this->m_runtime.stack.pop<
F64>()));
679 if (this->m_runtime.stack.size <
sizeof(I64)) {
682 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<I64>()));
686 if (this->m_runtime.stack.size <
sizeof(
F64)) {
689 this->m_runtime.stack.push(static_cast<U64>(this->m_runtime.stack.pop<
F64>()));
693 if (this->m_runtime.stack.size <
sizeof(
U64)) {
696 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<
U64>()));
700 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
703 I64 rhs = this->m_runtime.stack.pop<I64>();
704 I64 lhs = this->m_runtime.stack.pop<I64>();
708 if ((rhs > 0) && (lhs > 0) && ((std::numeric_limits<I64>::max() - rhs) < lhs)) {
716 this->m_runtime.stack.push(static_cast<I64>(lhs + rhs));
720 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
723 I64 rhs = this->m_runtime.stack.pop<I64>();
724 I64 lhs = this->m_runtime.stack.pop<I64>();
729 if ((rhs < 0) && (lhs > 0) && ((std::numeric_limits<I64>::max() + rhs) < lhs)) {
738 this->m_runtime.stack.push(static_cast<I64>(lhs - rhs));
742 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
745 I64 rhs = this->m_runtime.stack.pop<I64>();
746 I64 lhs = this->m_runtime.stack.pop<I64>();
751 if ((rhs > 0) && (lhs > 0) && ((std::numeric_limits<I64>::max() / rhs) < lhs)) {
755 else if ((rhs < 0) && (lhs < 0) && ((std::numeric_limits<I64>::max() / (-1 * rhs)) < (-1 * lhs))) {
768 this->m_runtime.stack.push(static_cast<I64>(lhs * rhs));
772 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
775 U64 rhs = this->m_runtime.stack.pop<
U64>();
776 U64 lhs = this->m_runtime.stack.pop<
U64>();
781 this->m_runtime.stack.push(static_cast<U64>(lhs / rhs));
785 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
789 I64 rhs = this->m_runtime.stack.pop<I64>();
790 I64 lhs = this->m_runtime.stack.pop<I64>();
799 this->m_runtime.stack.push(static_cast<I64>(lhs / rhs));
803 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
806 U64 rhs = this->m_runtime.stack.pop<
U64>();
810 U64 lhs = this->m_runtime.stack.pop<
U64>();
811 this->m_runtime.stack.push(static_cast<U64>(lhs % rhs));
815 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
818 I64 rhs = this->m_runtime.stack.pop<I64>();
822 I64 lhs = this->m_runtime.stack.pop<I64>();
827 I64 res =
static_cast<I64
>(lhs % rhs);
832 if ((res > 0 && rhs < 0) || (res < 0 && rhs > 0)) {
835 this->m_runtime.stack.push(res);
839 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
842 F64 rhs = this->m_runtime.stack.pop<
F64>();
843 F64 lhs = this->m_runtime.stack.pop<
F64>();
844 this->m_runtime.stack.push(static_cast<F64>(lhs + rhs));
848 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
851 F64 rhs = this->m_runtime.stack.pop<
F64>();
852 F64 lhs = this->m_runtime.stack.pop<
F64>();
853 this->m_runtime.stack.push(static_cast<F64>(lhs - rhs));
857 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
860 F64 rhs = this->m_runtime.stack.pop<
F64>();
861 F64 lhs = this->m_runtime.stack.pop<
F64>();
862 this->m_runtime.stack.push(static_cast<F64>(lhs * rhs));
866 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
869 F64 rhs = this->m_runtime.stack.pop<
F64>();
870 F64 lhs = this->m_runtime.stack.pop<
F64>();
871 this->m_runtime.stack.push(static_cast<F64>(lhs / rhs));
875 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
878 F64 rhs = this->m_runtime.stack.pop<
F64>();
879 F64 lhs = this->m_runtime.stack.pop<
F64>();
880 this->m_runtime.stack.push(static_cast<F64>(pow(lhs, rhs)));
884 if (this->m_runtime.stack.size <
sizeof(
F64)) {
887 F64 val = this->m_runtime.stack.pop<
F64>();
891 this->m_runtime.stack.push(static_cast<F64>(log(val)));
895 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
898 F64 rhs = this->m_runtime.stack.pop<
F64>();
899 F64 lhs = this->m_runtime.stack.pop<
F64>();
902 F64 res = std::fmod(lhs, rhs);
906 if ((res > 0 && rhs < 0) || (res < 0 && rhs > 0)) {
909 this->m_runtime.stack.push(res);
913 if (this->m_runtime.stack.size <
sizeof(
I8)) {
916 I8 src = this->m_runtime.stack.pop<
I8>();
917 this->m_runtime.stack.push(static_cast<I64>(src));
921 if (this->m_runtime.stack.size <
sizeof(I16)) {
924 I16 src = this->m_runtime.stack.pop<I16>();
925 this->m_runtime.stack.push(static_cast<I64>(src));
929 if (this->m_runtime.stack.size <
sizeof(I32)) {
932 I32 src = this->m_runtime.stack.pop<I32>();
933 this->m_runtime.stack.push(static_cast<I64>(src));
937 if (this->m_runtime.stack.size <
sizeof(
U8)) {
940 U8 src = this->m_runtime.stack.pop<
U8>();
941 this->m_runtime.stack.push(static_cast<U64>(src));
945 if (this->m_runtime.stack.size <
sizeof(U16)) {
948 U16 src = this->m_runtime.stack.pop<U16>();
949 this->m_runtime.stack.push(static_cast<U64>(src));
953 if (this->m_runtime.stack.size <
sizeof(U32)) {
956 U32 src = this->m_runtime.stack.pop<U32>();
957 this->m_runtime.stack.push(static_cast<U64>(src));
961 if (this->m_runtime.stack.size <
sizeof(
U64)) {
964 U64 src = this->m_runtime.stack.pop<
U64>();
965 this->m_runtime.stack.push(static_cast<U8>(src));
969 if (this->m_runtime.stack.size <
sizeof(
U64)) {
972 U64 src = this->m_runtime.stack.pop<
U64>();
973 this->m_runtime.stack.push(static_cast<U16>(src));
977 if (this->m_runtime.stack.size <
sizeof(
U64)) {
980 U64 src = this->m_runtime.stack.pop<
U64>();
981 this->m_runtime.stack.push(static_cast<U32>(src));
984 Signal FpySequencer::stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error) {
989 switch (directive.get__op()) {
991 error = this->op_or();
994 error = this->op_and();
997 error = this->op_ieq();
1000 error = this->op_ine();
1003 error = this->op_ult();
1006 error = this->op_ule();
1009 error = this->op_ugt();
1012 error = this->op_uge();
1015 error = this->op_slt();
1018 error = this->op_sle();
1021 error = this->op_sgt();
1024 error = this->op_sge();
1027 error = this->op_feq();
1030 error = this->op_fne();
1033 error = this->op_flt();
1036 error = this->op_fle();
1039 error = this->op_fgt();
1042 error = this->op_fge();
1045 error = this->op_not();
1048 error = this->op_fpext();
1051 error = this->op_fptrunc();
1054 error = this->op_fptosi();
1057 error = this->op_fptoui();
1060 error = this->op_sitofp();
1063 error = this->op_uitofp();
1066 error = this->op_add();
1069 error = this->op_sub();
1072 error = this->op_mul();
1075 error = this->op_udiv();
1078 error = this->op_sdiv();
1081 error = this->op_umod();
1084 error = this->op_smod();
1087 error = this->op_fadd();
1090 error = this->op_fsub();
1093 error = this->op_fmul();
1096 error = this->op_fdiv();
1099 error = this->op_fpow();
1102 error = this->op_flog();
1105 error = this->op_fmod();
1108 error = this->op_siext_8_64();
1111 error = this->op_siext_16_64();
1114 error = this->op_siext_32_64();
1117 error = this->op_ziext_8_64();
1120 error = this->op_ziext_16_64();
1123 error = this->op_ziext_32_64();
1126 error = this->op_itrunc_64_8();
1129 error = this->op_itrunc_64_16();
1132 error = this->op_itrunc_64_32();
1144 Signal FpySequencer::exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error) {
1145 if (this->m_runtime.stack.size < 1) {
1149 U8 errorCode = this->m_runtime.stack.pop<
U8>();
1151 if (errorCode == 0) {
1163 Signal FpySequencer::allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error) {
1168 this->m_runtime.stack.pushZeroes(directive.get_size());
1174 if (this->m_runtime.stack.size < size) {
1182 if (destOffset > newStackSize || size > newStackSize - destOffset) {
1187 this->m_runtime.stack.copy(destOffset, this->m_runtime.stack.size - size, size);
1188 this->m_runtime.stack.size = newStackSize;
1200 if (srcOffset > this->m_runtime.stack.size || size > this->m_runtime.stack.size - srcOffset) {
1205 this->m_runtime.stack.copy(this->m_runtime.stack.size, srcOffset, size);
1206 this->m_runtime.stack.size += size;
1210 Signal FpySequencer::storeRelConstOffset_directiveHandler(
const FpySequencer_StoreRelConstOffsetDirective& directive,
1212 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + directive.get_lvarOffset();
1217 return this->storeHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1220 Signal FpySequencer::loadRel_directiveHandler(
const FpySequencer_LoadRelDirective& directive,
DirectiveError& error) {
1221 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + directive.get_lvarOffset();
1226 return this->loadHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1229 Signal FpySequencer::pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error) {
1235 this->m_runtime.stack.push(const_cast<U8*>(directive.get_val()),
1236 static_cast<Fpy::StackSizeType>(directive.get__valSize()));
1240 Signal FpySequencer::discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error) {
1241 if (this->m_runtime.stack.size < directive.get_size()) {
1246 this->m_runtime.stack.size -= directive.get_size();
1250 Signal FpySequencer::memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error) {
1259 if (this->m_runtime.stack.size < directive.get_size() * 2) {
1265 U64 lhsOffset = this->m_runtime.stack.size - directive.get_size() * 2;
1266 U64 rhsOffset = this->m_runtime.stack.size - directive.get_size();
1271 this->m_runtime.stack.size -= directive.get_size() * 2;
1274 if (memcmp(this->m_runtime.stack.bytes + lhsOffset, this->m_runtime.stack.bytes + rhsOffset,
1275 directive.get_size()) == 0) {
1283 Signal FpySequencer::stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error) {
1286 if (this->m_runtime.stack.size <
sizeof(
FwOpcodeType) ||
1287 this->m_runtime.stack.size -
sizeof(
FwOpcodeType) < directive.get_argsSize()) {
1296 U64 argBufOffset = this->m_runtime.stack.size - directive.get_argsSize();
1299 this->m_runtime.currentCmdOpcode = opcode;
1302 this->m_runtime.stack.size -= directive.get_argsSize();
1312 if (this->sendCmd(opcode, this->m_runtime.stack.bytes + argBufOffset, directive.get_argsSize()) ==
1324 Signal FpySequencer::pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error) {
1340 this->m_runtime.stack.push(timeEsb.getBuffAddr(),
static_cast<Fpy::StackSizeType>(timeEsb.getSize()));
1344 Signal FpySequencer::setSeed_directiveHandler(
const FpySequencer_SetSeedDirective& directive,
DirectiveError& error) {
1345 if (this->m_runtime.stack.size <
sizeof(U32)) {
1350 U32 seed = this->m_runtime.stack.pop<U32>();
1351 this->m_runtime.rng.seed(seed);
1352 this->m_runtime.rngSeeded =
true;
1356 Signal FpySequencer::pushRand_directiveHandler(
const FpySequencer_PushRandDirective& directive,
DirectiveError& error) {
1362 if (!this->m_runtime.rngSeeded) {
1364 std::seed_seq seedSeq{
static_cast<U32
>(currentTime.
getTimeBase()), static_cast<U32>(currentTime.
getContext()),
1366 this->m_runtime.rng.seed(seedSeq);
1367 this->m_runtime.rngSeeded =
true;
1370 U32 randVal =
static_cast<U32
>(this->m_runtime.rng());
1371 this->m_runtime.stack.push(randVal);
1375 Signal FpySequencer::getField_directiveHandler(
const FpySequencer_GetFieldDirective& directive,
DirectiveError& error) {
1383 if (this->m_runtime.stack.size -
sizeof(
Fpy::StackSizeType) < directive.get_parentSize()) {
1392 if (offset > directive.get_parentSize() || directive.get_memberSize() > directive.get_parentSize() - offset) {
1403 Fpy::StackSizeType parentStartOffset = this->m_runtime.stack.size - directive.get_parentSize();
1406 this->m_runtime.stack.move(parentStartOffset, parentStartOffset + offset, directive.get_memberSize());
1408 this->m_runtime.stack.size -= (directive.get_parentSize() - directive.get_memberSize());
1412 Signal FpySequencer::peek_directiveHandler(
const FpySequencer_PeekDirective& directive,
DirectiveError& error) {
1423 if (offset > this->m_runtime.stack.size) {
1436 if (byteCount > this->m_runtime.stack.size - offset) {
1442 U8* src = this->m_runtime.stack.top() - offset - byteCount;
1443 this->m_runtime.stack.push(src, byteCount);
1447 Signal FpySequencer::storeRel_directiveHandler(
const FpySequencer_StoreRelDirective& directive,
DirectiveError& error) {
1460 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + lvarOffset;
1465 return this->storeHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1468 Signal FpySequencer::call_directiveHandler(
const FpySequencer_CallDirective& directive,
DirectiveError& error) {
1470 if (this->m_runtime.stack.size <
sizeof(U32)) {
1476 U32 target = this->m_runtime.stack.pop<U32>();
1491 U32 returnAddr = this->m_runtime.nextStatementIndex;
1494 this->m_runtime.nextStatementIndex = target;
1497 this->m_runtime.stack.push<U32>(returnAddr);
1500 this->m_runtime.stack.push<
Fpy::StackSizeType>(this->m_runtime.stack.currentFrameStart);
1503 this->m_runtime.stack.currentFrameStart = this->m_runtime.stack.size;
1508 Signal FpySequencer::return_directiveHandler(
const FpySequencer_ReturnDirective& directive,
DirectiveError& error) {
1513 if (this->m_runtime.stack.size < returnValSize) {
1523 if (returnValSize > 0) {
1524 (void)memcpy(returnValue, this->m_runtime.stack.top() - returnValSize, returnValSize);
1528 if (this->m_runtime.stack.currentFrameStart > this->m_runtime.stack.size) {
1532 this->m_runtime.stack.size = this->m_runtime.stack.currentFrameStart;
1544 U32 returnAddr = this->m_runtime.stack.pop<U32>();
1547 if (savedFramePtr > this->m_runtime.stack.size) {
1551 this->m_runtime.stack.currentFrameStart = savedFramePtr;
1560 this->m_runtime.nextStatementIndex = returnAddr;
1563 if (this->m_runtime.stack.size < callArgsSize) {
1568 this->m_runtime.stack.size -= callArgsSize;
1575 this->m_runtime.stack.push(returnValue, returnValSize);
1580 Signal FpySequencer::loadAbs_directiveHandler(
const FpySequencer_LoadAbsDirective& directive,
DirectiveError& error) {
1581 return this->loadHelper(directive.get_globalOffset(), directive.get_size(), error);
1584 Signal FpySequencer::storeAbs_directiveHandler(
const FpySequencer_StoreAbsDirective& directive,
DirectiveError& error) {
1598 return this->storeHelper(globalOffset, size, error);
1601 Signal FpySequencer::storeAbsConstOffset_directiveHandler(
const FpySequencer_StoreAbsConstOffsetDirective& directive,
1603 return this->storeHelper(directive.get_globalOffset(), directive.get_size(), error);
1606 Signal FpySequencer::popEvent_directiveHandler(
const FpySequencer_PopEventDirective& directive,
DirectiveError& error) {
1617 if (this->m_runtime.stack.size < severitySize || this->m_runtime.stack.size - severitySize < messageSize) {
1628 if (messageSize > clampedSize) {
1630 FW_ASSERT(this->m_runtime.stack.size >= excess, static_cast<FwAssertArgType>(this->m_runtime.stack.size),
1631 static_cast<FwAssertArgType>(excess));
1632 this->m_runtime.stack.size -= excess;
1634 this->m_runtime.stack.pop(messageBuf, clampedSize);
1635 messageBuf[clampedSize] =
'\0';
1641 Fw::String messageStr(reinterpret_cast<const char*>(messageBuf));
1674 Signal FpySequencer::popSerializable_directiveHandler(
const FpySequencer_PopSerializableDirective& directive,
1680 const FwIndexType portIndex = directive.get_portIndex();
1683 if (portIndex < 0 || portIndex >= MAX_PORTS) {
1695 if (this->m_runtime.stack.size < directive.get_size()) {
1701 U8* dataPtr = this->m_runtime.stack.top() - directive.get_size();
1713 this->m_runtime.stack.size -= directive.get_size();
void directive_storeRelConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreRelConstOffsetDirective &directive) override
Internal interface handler for directive_storeRelConstOffset.
void cmdOut_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context) const
Invoke output port cmdOut.
void directive_storeRel_internalInterfaceHandler(const Svc::FpySequencer_StoreRelDirective &directive) override
Internal interface handler for directive_storeRel.
Serialization/Deserialization operation was successful.
void directive_return_internalInterfaceHandler(const Svc::FpySequencer_ReturnDirective &directive) override
Internal interface handler for directive_return.
sets the index of the next directive to execute
void directive_call_internalInterfaceHandler(const Svc::FpySequencer_CallDirective &directive) override
Internal interface handler for directive_call.
bool isConnected_getTlmChan_OutputPort(FwIndexType portNum) const
FwIdType FwOpcodeType
The type of a command opcode.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
pushes the next RNG value to the stack
branches based off of the top byte of the stack
void directive_if_internalInterfaceHandler(const Svc::FpySequencer_IfDirective &directive) override
Internal interface handler for directive_if.
void directive_setSeed_internalInterfaceHandler(const Svc::FpySequencer_SetSeedDirective &directive) override
Internal interface handler for directive_setSeed.
PlatformSizeType FwSizeType
stores a value to an absolute address in the stack (for global variables), offset from stack ...
void directive_loadAbs_internalInterfaceHandler(const Svc::FpySequencer_LoadAbsDirective &directive) override
Internal interface handler for directive_loadAbs.
void directive_stackOp_internalInterfaceHandler(const Svc::FpySequencer_StackOpDirective &directive) override
Internal interface handler for directive_stackOp.
called when statement successfully executed. only raised in the RUNNING.AWAITING_CMD_RESPONSE state ...
void directive_getField_internalInterfaceHandler(const Svc::FpySequencer_GetFieldDirective &directive) override
Internal interface handler for directive_getField.
returns from a function call
I32 SignedStackSizeType
signed version of StackSizeType, used for relative offsets that can be negative
Serializable::SizeType getSize() const override
Get current buffer size.
void log_WARNING_HI_SequenceExitedWithError(const Fw::StringBase &filePath, U8 errorCode) const
Log event SequenceExitedWithError.
void directive_pushTlmValAndTime_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValAndTimeDirective &directive) override
Internal interface handler for directive_pushTlmValAndTime.
int8_t I8
8-bit signed integer
stores a value to a local variable at a compile-time-known offset relative to the current stack frame...
Fw::SerializeStatus serialOut_out(FwIndexType portNum, Fw::LinearBufferBase &buffer)
Invoke output port serialOut.
void directive_constCmd_internalInterfaceHandler(const Svc::FpySequencer_ConstCmdDirective &directive) override
Internal interface handler for directive_constCmd.
Fw::ParamValid getParam_out(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val) const
Invoke output port getParam.
bool isConnected_prmGet_OutputPort(FwIndexType portNum) const
pop an opcode and arg buf off the stack, send to cmd dispatcher and await response ...
void directive_peek_internalInterfaceHandler(const Svc::FpySequencer_PeekDirective &directive) override
Internal interface handler for directive_peek.
TimeBase getTimeBase() const
void sequencer_sendSignal_stmtResponse_success()
Send signal stmtResponse_success to state machine sequencer.
void directive_loadRel_internalInterfaceHandler(const Svc::FpySequencer_LoadRelDirective &directive) override
Internal interface handler for directive_loadRel.
void directive_memCmp_internalInterfaceHandler(const Svc::FpySequencer_MemCmpDirective &directive) override
Internal interface handler for directive_memCmp.
void directive_pushVal_internalInterfaceHandler(const Svc::FpySequencer_PushValDirective &directive) override
Internal interface handler for directive_pushVal.
void directive_pushPrm_internalInterfaceHandler(const Svc::FpySequencer_PushPrmDirective &directive) override
Internal interface handler for directive_pushPrm.
REQUIRED: Maximum number of serial ports. This sentinel value MUST be named.
pops bytes off the top of the stack and does nothing with them
void directive_pushTime_internalInterfaceHandler(const Svc::FpySequencer_PushTimeDirective &directive) override
Internal interface handler for directive_pushTime.
void log_DIAGNOSTIC_LogDiagnostic(const Fw::StringBase &filePath, const Fw::StringBase &message) const
Log event LogDiagnostic.
void log_COMMAND_LogCommand(const Fw::StringBase &filePath, const Fw::StringBase &message) const
Log event LogCommand.
U8 FwTimeContextStoreType
The type used to serialize a time context value.
Software diagnostic events.
void directive_pushRand_internalInterfaceHandler(const Svc::FpySequencer_PushRandDirective &directive) override
Internal interface handler for directive_pushRand.
void log_ACTIVITY_LO_LogActivityLo(const Fw::StringBase &filePath, const Fw::StringBase &message) const
Log event LogActivityLo.
SerializeStatus
forward declaration for string
float F32
32-bit floating point
Fpy::DirectiveErrorCode DirectiveError
void directive_allocate_internalInterfaceHandler(const Svc::FpySequencer_AllocateDirective &directive) override
Internal interface handler for directive_allocate.
executes a cmd with const args
void directive_waitRel_internalInterfaceHandler(const FpySequencer_WaitRelDirective &directive) override
Internal interface handler for directive_waitRel.
void directive_noOp_internalInterfaceHandler(const Svc::FpySequencer_NoOpDirective &directive) override
Internal interface handler for directive_noOp.
loads a value from a local variable at a compile-time-known offset relative to the current stack fram...
void directive_stackCmd_internalInterfaceHandler(const Svc::FpySequencer_StackCmdDirective &directive) override
Internal interface handler for directive_stackCmd.
void log_ACTIVITY_HI_LogActivityHi(const Fw::StringBase &filePath, const Fw::StringBase &message) const
Log event LogActivityHi.
void directive_discard_internalInterfaceHandler(const Svc::FpySequencer_DiscardDirective &directive) override
Internal interface handler for directive_discard.
pop two byte arrays off the top of the stack, call memcmp, push 1 if they were equal, 0 otherwise
Svc::Fpy::Header & get_header()
Get member header.
Less important informational events.
pops a severity and message from the stack and emits an F Prime event
An activity related to commanding.
A less serious but recoverable event.
Omit length from serialization.
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive) override
Internal interface handler for directive_exit.
stores a value to an absolute address in the stack (for global variables), const offset ...
External serialize buffer with no copy semantics.
Svc::Fpy::DirectiveId::T get__op() const
Get member _op.
U8 SerialType
The serial representation type.
void directive_waitAbs_internalInterfaceHandler(const FpySequencer_WaitAbsDirective &directive) override
Internal interface handler for directive_waitAbs.
void log_WARNING_HI_LogWarningHi(const Fw::StringBase &filePath, const Fw::StringBase &message) const
Log event LogWarningHi.
void directive_goto_internalInterfaceHandler(const Svc::FpySequencer_GotoDirective &directive) override
Internal interface handler for directive_goto.
peeks at N bytes from the stack, starting from an offset relative to the top of the stack ...
void sequencer_sendSignal_stmtResponse_failure()
Send signal stmtResponse_failure to state machine sequencer.
A serious but recoverable event.
void sequencer_sendSignal_stmtResponse_beginSleep()
Send signal stmtResponse_beginSleep to state machine sequencer.
void directive_popSerializable_internalInterfaceHandler(const Svc::FpySequencer_PopSerializableDirective &directive) override
Internal interface handler for directive_popSerializable.
void directive_storeAbsConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsConstOffsetDirective &directive) override
Internal interface handler for directive_storeAbsConstOffset.
sleeps for a relative duration from the current time
uint8_t U8
8-bit unsigned integer
bool isConnected_serialOut_OutputPort(FwIndexType portNum) const
void directive_popEvent_internalInterfaceHandler(const Svc::FpySequencer_PopEventDirective &directive) override
Internal interface handler for directive_popEvent.
generic stack operation handler
Important informational events.
static U32 min(const U32 a, const U32 b)
U8 SerialType
The serial representation type.
static Time add(const Time &a, const Time &b)
void sequencer_sendSignal_stmtResponse_keepWaiting()
Send signal stmtResponse_keepWaiting to state machine sequencer.
FwTimeContextStoreType getContext() const
sleeps until an absolute time
called when the statement unsuccessfully executed. only raised in the RUNNING.AWAITING_CMD_RESPONSE s...
loads a value from an absolute address in the stack (for global variables)
PlatformIndexType FwIndexType
pops a U32 from the stack and uses it to seed the RNG used by PushRandDirective
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
pops serialized data from stack and sends to serial output port
A fatal non-recoverable event.
void log_WARNING_LO_LogWarningLo(const Fw::StringBase &filePath, const Fw::StringBase &message) const
Log event LogWarningLo.
pushes a const byte array onto stack
stores a value to a local variable at a runtime-determined offset relative to the current stack frame...
RateGroupDivider component implementation.
U8 * getBuffAddr() override
Get buffer address for data filling (non-const version)
Enum representing parameter validity.
void log_FATAL_LogFatal(const Fw::StringBase &filePath, const Fw::StringBase &message) const
Log event LogFatal.
void directive_storeAbs_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsDirective &directive) override
Internal interface handler for directive_storeAbs.
pushes a prm buf to the stack
U16 FwTimeBaseStoreType
The type used to serialize a time base value.
pushes the current Fw.Time struct to the stack
SerializeStatus setBuffLen(Serializable::SizeType length) override
Set buffer length manually.
pushes some empty bytes to the stack
called when the statement is telling the sequencer to await a later stmt response ...
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
Fw::TlmValid getTlmChan_out(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) const
Invoke output port getTlmChan.
a statement is telling the sequencer to go to sleep
pushes a tlm buf to the stack
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
U32 StackSizeType
the type which everything referencing a size or offset on the stack is represented in ...
void directive_pushTlmVal_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValDirective &directive) override
Internal interface handler for directive_pushTlmVal.