10 void FpySequencer::sendSignal(
Signal signal) {
29 FW_ASSERT(0, static_cast<FwAssertArgType>(signal));
35 void FpySequencer::handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err) {
36 this->m_tlm.lastDirectiveError = err;
38 this->m_tlm.directiveErrorIndex = this->currentStatementIdx();
39 this->m_tlm.directiveErrorId = id;
46 cmdBuf.
serializeFrom(static_cast<FwPacketDescriptorType>(Fw::ComPacketType::FW_PACKET_COMMAND));
69 static_cast<U32
>(((this->m_sequencesStarted & 0xFFFF) << 16) | (this->m_statementsDispatched & 0xFFFF));
79 this->sendSignal(this->waitRel_directiveHandler(directive, error));
86 this->sendSignal(this->waitAbs_directiveHandler(directive, error));
93 this->sendSignal(this->goto_directiveHandler(directive, error));
100 this->sendSignal(this->if_directiveHandler(directive, error));
107 this->sendSignal(this->noOp_directiveHandler(directive, error));
115 this->sendSignal(this->pushTlmVal_directiveHandler(directive, error));
123 this->sendSignal(this->pushTlmValAndTime_directiveHandler(directive, error));
130 this->sendSignal(this->pushPrm_directiveHandler(directive, error));
137 this->sendSignal(this->constCmd_directiveHandler(directive, error));
144 this->sendSignal(this->stackOp_directiveHandler(directive, error));
145 handleDirectiveErrorCode(directive.
get__op(), error);
151 this->sendSignal(this->exit_directiveHandler(directive, error));
158 this->sendSignal(this->allocate_directiveHandler(directive, error));
166 this->sendSignal(this->storeRelConstOffset_directiveHandler(directive, error));
173 this->sendSignal(this->pushVal_directiveHandler(directive, error));
180 this->sendSignal(this->loadRel_directiveHandler(directive, error));
187 this->sendSignal(this->discard_directiveHandler(directive, error));
194 this->sendSignal(this->memCmp_directiveHandler(directive, error));
201 this->sendSignal(this->stackCmd_directiveHandler(directive, error));
208 this->sendSignal(this->pushTime_directiveHandler(directive, error));
215 this->sendSignal(this->setSeed_directiveHandler(directive, error));
222 this->sendSignal(this->pushRand_directiveHandler(directive, error));
229 this->sendSignal(this->getField_directiveHandler(directive, error));
236 this->sendSignal(this->peek_directiveHandler(directive, error));
243 this->sendSignal(this->storeRel_directiveHandler(directive, error));
250 this->sendSignal(this->call_directiveHandler(directive, error));
257 this->sendSignal(this->return_directiveHandler(directive, error));
264 this->sendSignal(this->loadAbs_directiveHandler(directive, error));
271 this->sendSignal(this->storeAbs_directiveHandler(directive, error));
279 this->sendSignal(this->storeAbsConstOffset_directiveHandler(directive, error));
285 if (this->m_runtime.stack.size < 8) {
292 U32 uSeconds = this->m_runtime.stack.pop<U32>();
293 U32 seconds = this->m_runtime.stack.pop<U32>();
295 wakeupTime.
add(seconds, uSeconds);
296 this->m_runtime.wakeupTime = wakeupTime;
301 Signal FpySequencer::waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error) {
307 U32 uSeconds = this->m_runtime.stack.pop<U32>();
308 U32 seconds = this->m_runtime.stack.pop<U32>();
312 this->m_runtime.wakeupTime =
Fw::Time(static_cast<TimeBase::T>(base), ctx, seconds, uSeconds);
317 Signal FpySequencer::goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error) {
323 m_runtime.nextStatementIndex = directive.get_statementIndex();
328 Signal FpySequencer::if_directiveHandler(
const FpySequencer_IfDirective& directive,
DirectiveError& error) {
329 if (this->m_runtime.stack.size < 1) {
339 if (this->m_runtime.stack.pop<
U8>() != 0) {
345 this->m_runtime.nextStatementIndex = directive.get_falseGotoStmtIndex();
349 Signal FpySequencer::noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error) {
353 Signal FpySequencer::pushTlmVal_directiveHandler(
const FpySequencer_PushTlmValDirective& directive,
377 Signal FpySequencer::pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
410 this->m_runtime.stack.push(timeEsb.getBuffAddr(),
static_cast<Fpy::StackSizeType>(timeEsb.getSize()));
414 Signal FpySequencer::pushPrm_directiveHandler(
const FpySequencer_PushPrmDirective& directive,
DirectiveError& error) {
438 Signal FpySequencer::constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error) {
439 if (this->sendCmd(directive.get_opCode(), directive.get_argBuf(), directive.get__argBufSize()) ==
450 if (this->m_runtime.stack.size <
sizeof(
U8) * 2) {
453 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<
U8>() | this->m_runtime.stack.pop<
U8>()));
457 if (this->m_runtime.stack.size <
sizeof(
U8) * 2) {
460 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<
U8>() & this->m_runtime.stack.pop<
U8>()));
464 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
467 this->m_runtime.stack.push(static_cast<U8>((this->m_runtime.stack.pop<I64>() == this->m_runtime.stack.pop<I64>())
473 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
476 this->m_runtime.stack.push(static_cast<U8>((this->m_runtime.stack.pop<I64>() != this->m_runtime.stack.pop<I64>())
482 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
485 U64 rhs = this->m_runtime.stack.pop<
U64>();
486 U64 lhs = this->m_runtime.stack.pop<
U64>();
492 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
495 U64 rhs = this->m_runtime.stack.pop<
U64>();
496 U64 lhs = this->m_runtime.stack.pop<
U64>();
502 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
505 U64 rhs = this->m_runtime.stack.pop<
U64>();
506 U64 lhs = this->m_runtime.stack.pop<
U64>();
512 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
515 U64 rhs = this->m_runtime.stack.pop<
U64>();
516 U64 lhs = this->m_runtime.stack.pop<
U64>();
522 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
525 I64 rhs = this->m_runtime.stack.pop<I64>();
526 I64 lhs = this->m_runtime.stack.pop<I64>();
532 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
535 I64 rhs = this->m_runtime.stack.pop<I64>();
536 I64 lhs = this->m_runtime.stack.pop<I64>();
542 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
545 I64 rhs = this->m_runtime.stack.pop<I64>();
546 I64 lhs = this->m_runtime.stack.pop<I64>();
552 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
555 I64 rhs = this->m_runtime.stack.pop<I64>();
556 I64 lhs = this->m_runtime.stack.pop<I64>();
562 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
565 F64 rhs = this->m_runtime.stack.pop<
F64>();
566 F64 lhs = this->m_runtime.stack.pop<
F64>();
573 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
576 F64 rhs = this->m_runtime.stack.pop<
F64>();
577 F64 lhs = this->m_runtime.stack.pop<
F64>();
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>();
594 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
597 F64 rhs = this->m_runtime.stack.pop<
F64>();
598 F64 lhs = this->m_runtime.stack.pop<
F64>();
599 this->m_runtime.stack.push(static_cast<U8>(std::islessequal(lhs, rhs) ? static_cast<U8>(
FW_SERIALIZE_TRUE_VALUE)
604 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
607 F64 rhs = this->m_runtime.stack.pop<
F64>();
608 F64 lhs = this->m_runtime.stack.pop<
F64>();
614 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
617 F64 rhs = this->m_runtime.stack.pop<
F64>();
618 F64 lhs = this->m_runtime.stack.pop<
F64>();
619 this->m_runtime.stack.push(static_cast<U8>(std::isgreaterequal(lhs, rhs)
625 if (this->m_runtime.stack.size <
sizeof(
U8)) {
628 this->m_runtime.stack.push(static_cast<U8>((this->m_runtime.stack.pop<
U8>() == 0)
635 if (this->m_runtime.stack.size <
sizeof(
F32)) {
638 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<
F32>()));
643 if (this->m_runtime.stack.size <
sizeof(
F64)) {
646 this->m_runtime.stack.push(static_cast<F32>(this->m_runtime.stack.pop<
F64>()));
650 if (this->m_runtime.stack.size <
sizeof(
F64)) {
653 this->m_runtime.stack.push(static_cast<I64>(this->m_runtime.stack.pop<
F64>()));
657 if (this->m_runtime.stack.size <
sizeof(I64)) {
660 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<I64>()));
664 if (this->m_runtime.stack.size <
sizeof(
F64)) {
667 this->m_runtime.stack.push(static_cast<U64>(this->m_runtime.stack.pop<
F64>()));
671 if (this->m_runtime.stack.size <
sizeof(
U64)) {
674 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<
U64>()));
678 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
681 I64 rhs = this->m_runtime.stack.pop<I64>();
682 I64 lhs = this->m_runtime.stack.pop<I64>();
686 if ((rhs > 0) && (lhs > 0) && ((std::numeric_limits<I64>::max() - rhs) < lhs)) {
694 this->m_runtime.stack.push(static_cast<I64>(lhs + rhs));
698 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
701 I64 rhs = this->m_runtime.stack.pop<I64>();
702 I64 lhs = this->m_runtime.stack.pop<I64>();
707 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)) {
733 else if ((rhs < 0) && (lhs < 0) && ((std::numeric_limits<I64>::max() / (-1 * rhs)) < (-1 * lhs))) {
746 this->m_runtime.stack.push(static_cast<I64>(lhs * rhs));
750 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
753 U64 rhs = this->m_runtime.stack.pop<
U64>();
754 U64 lhs = this->m_runtime.stack.pop<
U64>();
759 this->m_runtime.stack.push(static_cast<U64>(lhs / rhs));
763 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
767 I64 rhs = this->m_runtime.stack.pop<I64>();
768 I64 lhs = this->m_runtime.stack.pop<I64>();
773 this->m_runtime.stack.push(static_cast<I64>(lhs / rhs));
777 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
780 U64 rhs = this->m_runtime.stack.pop<
U64>();
784 U64 lhs = this->m_runtime.stack.pop<
U64>();
785 this->m_runtime.stack.push(static_cast<U64>(lhs % rhs));
789 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
792 I64 rhs = this->m_runtime.stack.pop<I64>();
796 I64 lhs = this->m_runtime.stack.pop<I64>();
797 I64 res =
static_cast<I64
>(lhs % rhs);
802 if ((res > 0 && rhs < 0) || (res < 0 && rhs > 0)) {
805 this->m_runtime.stack.push(res);
809 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
812 F64 rhs = this->m_runtime.stack.pop<
F64>();
813 F64 lhs = this->m_runtime.stack.pop<
F64>();
814 this->m_runtime.stack.push(static_cast<F64>(lhs + rhs));
818 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
821 F64 rhs = this->m_runtime.stack.pop<
F64>();
822 F64 lhs = this->m_runtime.stack.pop<
F64>();
823 this->m_runtime.stack.push(static_cast<F64>(lhs - rhs));
827 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
830 F64 rhs = this->m_runtime.stack.pop<
F64>();
831 F64 lhs = this->m_runtime.stack.pop<
F64>();
832 this->m_runtime.stack.push(static_cast<F64>(lhs * rhs));
836 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
839 F64 rhs = this->m_runtime.stack.pop<
F64>();
840 F64 lhs = this->m_runtime.stack.pop<
F64>();
841 this->m_runtime.stack.push(static_cast<F64>(lhs / rhs));
845 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
848 F64 rhs = this->m_runtime.stack.pop<
F64>();
849 F64 lhs = this->m_runtime.stack.pop<
F64>();
850 this->m_runtime.stack.push(static_cast<F64>(pow(lhs, rhs)));
854 if (this->m_runtime.stack.size <
sizeof(
F64)) {
857 F64 val = this->m_runtime.stack.pop<
F64>();
861 this->m_runtime.stack.push(static_cast<F64>(log(val)));
865 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
868 F64 rhs = this->m_runtime.stack.pop<
F64>();
872 F64 lhs = this->m_runtime.stack.pop<
F64>();
873 this->m_runtime.stack.push(static_cast<F64>(lhs - rhs * std::floor(lhs / rhs)));
877 if (this->m_runtime.stack.size <
sizeof(
I8)) {
880 I8 src = this->m_runtime.stack.pop<
I8>();
881 this->m_runtime.stack.push(static_cast<I64>(src));
885 if (this->m_runtime.stack.size <
sizeof(I16)) {
888 I16 src = this->m_runtime.stack.pop<I16>();
889 this->m_runtime.stack.push(static_cast<I64>(src));
893 if (this->m_runtime.stack.size <
sizeof(I32)) {
896 I32 src = this->m_runtime.stack.pop<I32>();
897 this->m_runtime.stack.push(static_cast<I64>(src));
901 if (this->m_runtime.stack.size <
sizeof(
U8)) {
904 U8 src = this->m_runtime.stack.pop<
U8>();
905 this->m_runtime.stack.push(static_cast<U64>(src));
909 if (this->m_runtime.stack.size <
sizeof(U16)) {
912 U16 src = this->m_runtime.stack.pop<U16>();
913 this->m_runtime.stack.push(static_cast<U64>(src));
917 if (this->m_runtime.stack.size <
sizeof(U32)) {
920 U32 src = this->m_runtime.stack.pop<U32>();
921 this->m_runtime.stack.push(static_cast<U64>(src));
925 if (this->m_runtime.stack.size <
sizeof(
U64)) {
928 U64 src = this->m_runtime.stack.pop<
U64>();
929 this->m_runtime.stack.push(static_cast<U8>(src));
933 if (this->m_runtime.stack.size <
sizeof(
U64)) {
936 U64 src = this->m_runtime.stack.pop<
U64>();
937 this->m_runtime.stack.push(static_cast<U16>(src));
941 if (this->m_runtime.stack.size <
sizeof(
U64)) {
944 U64 src = this->m_runtime.stack.pop<
U64>();
945 this->m_runtime.stack.push(static_cast<U32>(src));
948 Signal FpySequencer::stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error) {
953 switch (directive.get__op()) {
955 error = this->op_or();
958 error = this->op_and();
961 error = this->op_ieq();
964 error = this->op_ine();
967 error = this->op_ult();
970 error = this->op_ule();
973 error = this->op_ugt();
976 error = this->op_uge();
979 error = this->op_slt();
982 error = this->op_sle();
985 error = this->op_sgt();
988 error = this->op_sge();
991 error = this->op_feq();
994 error = this->op_fne();
997 error = this->op_flt();
1000 error = this->op_fle();
1003 error = this->op_fgt();
1006 error = this->op_fge();
1009 error = this->op_not();
1012 error = this->op_fpext();
1015 error = this->op_fptrunc();
1018 error = this->op_fptosi();
1021 error = this->op_fptoui();
1024 error = this->op_sitofp();
1027 error = this->op_uitofp();
1030 error = this->op_add();
1033 error = this->op_sub();
1036 error = this->op_mul();
1039 error = this->op_udiv();
1042 error = this->op_sdiv();
1045 error = this->op_umod();
1048 error = this->op_smod();
1051 error = this->op_fadd();
1054 error = this->op_fsub();
1057 error = this->op_fmul();
1060 error = this->op_fdiv();
1063 error = this->op_fpow();
1066 error = this->op_flog();
1069 error = this->op_fmod();
1072 error = this->op_siext_8_64();
1075 error = this->op_siext_16_64();
1078 error = this->op_siext_32_64();
1081 error = this->op_ziext_8_64();
1084 error = this->op_ziext_16_64();
1087 error = this->op_ziext_32_64();
1090 error = this->op_itrunc_64_8();
1093 error = this->op_itrunc_64_16();
1096 error = this->op_itrunc_64_32();
1108 Signal FpySequencer::exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error) {
1109 if (this->m_runtime.stack.size < 1) {
1113 U8 errorCode = this->m_runtime.stack.pop<
U8>();
1115 if (errorCode == 0) {
1127 Signal FpySequencer::allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error) {
1132 this->m_runtime.stack.pushZeroes(directive.get_size());
1138 if (this->m_runtime.stack.size < size) {
1146 if (destOffset > newStackSize || size > newStackSize - destOffset) {
1151 this->m_runtime.stack.copy(destOffset, this->m_runtime.stack.size - size, size);
1152 this->m_runtime.stack.size = newStackSize;
1164 if (srcOffset > this->m_runtime.stack.size || size > this->m_runtime.stack.size - srcOffset) {
1169 this->m_runtime.stack.copy(this->m_runtime.stack.size, srcOffset, size);
1170 this->m_runtime.stack.size += size;
1174 Signal FpySequencer::storeRelConstOffset_directiveHandler(
const FpySequencer_StoreRelConstOffsetDirective& directive,
1176 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + directive.get_lvarOffset();
1181 return this->storeHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1184 Signal FpySequencer::loadRel_directiveHandler(
const FpySequencer_LoadRelDirective& directive,
DirectiveError& error) {
1185 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + directive.get_lvarOffset();
1190 return this->loadHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1193 Signal FpySequencer::pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error) {
1199 this->m_runtime.stack.push(const_cast<U8*>(directive.get_val()),
1200 static_cast<Fpy::StackSizeType>(directive.get__valSize()));
1204 Signal FpySequencer::discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error) {
1205 if (this->m_runtime.stack.size < directive.get_size()) {
1210 this->m_runtime.stack.size -= directive.get_size();
1214 Signal FpySequencer::memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error) {
1223 if (this->m_runtime.stack.size < directive.get_size() * 2) {
1229 U64 lhsOffset = this->m_runtime.stack.size - directive.get_size() * 2;
1230 U64 rhsOffset = this->m_runtime.stack.size - directive.get_size();
1235 this->m_runtime.stack.size -= directive.get_size() * 2;
1238 if (memcmp(this->m_runtime.stack.bytes + lhsOffset, this->m_runtime.stack.bytes + rhsOffset,
1239 directive.get_size()) == 0) {
1247 Signal FpySequencer::stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error) {
1250 if (this->m_runtime.stack.size <
sizeof(
FwOpcodeType) ||
1251 this->m_runtime.stack.size -
sizeof(
FwOpcodeType) < directive.get_argsSize()) {
1260 U64 argBufOffset = this->m_runtime.stack.size - directive.get_argsSize();
1263 this->m_runtime.currentCmdOpcode = opcode;
1266 this->m_runtime.stack.size -= directive.get_argsSize();
1268 if (this->sendCmd(opcode, this->m_runtime.stack.bytes + argBufOffset, directive.get_argsSize()) ==
1280 Signal FpySequencer::pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error) {
1296 this->m_runtime.stack.push(timeEsb.getBuffAddr(),
static_cast<Fpy::StackSizeType>(timeEsb.getSize()));
1300 Signal FpySequencer::setSeed_directiveHandler(
const FpySequencer_SetSeedDirective& directive,
DirectiveError& error) {
1301 if (this->m_runtime.stack.size <
sizeof(U32)) {
1306 U32 seed = this->m_runtime.stack.pop<U32>();
1307 this->m_runtime.rng.seed(seed);
1308 this->m_runtime.rngSeeded =
true;
1312 Signal FpySequencer::pushRand_directiveHandler(
const FpySequencer_PushRandDirective& directive,
DirectiveError& error) {
1318 if (!this->m_runtime.rngSeeded) {
1320 std::seed_seq seedSeq{
static_cast<U32
>(currentTime.
getTimeBase()), static_cast<U32>(currentTime.
getContext()),
1322 this->m_runtime.rng.seed(seedSeq);
1323 this->m_runtime.rngSeeded =
true;
1326 U32 randVal =
static_cast<U32
>(this->m_runtime.rng());
1327 this->m_runtime.stack.push(randVal);
1331 Signal FpySequencer::getField_directiveHandler(
const FpySequencer_GetFieldDirective& directive,
DirectiveError& error) {
1339 if (this->m_runtime.stack.size -
sizeof(
Fpy::StackSizeType) < directive.get_parentSize()) {
1348 if (offset > directive.get_parentSize() || directive.get_memberSize() > directive.get_parentSize() - offset) {
1359 Fpy::StackSizeType parentStartOffset = this->m_runtime.stack.size - directive.get_parentSize();
1362 this->m_runtime.stack.move(parentStartOffset, parentStartOffset + offset, directive.get_memberSize());
1364 this->m_runtime.stack.size -= (directive.get_parentSize() - directive.get_memberSize());
1368 Signal FpySequencer::peek_directiveHandler(
const FpySequencer_PeekDirective& directive,
DirectiveError& error) {
1379 if (offset > this->m_runtime.stack.size) {
1392 if (byteCount > this->m_runtime.stack.size - offset) {
1398 U8* src = this->m_runtime.stack.top() - offset - byteCount;
1399 this->m_runtime.stack.push(src, byteCount);
1403 Signal FpySequencer::storeRel_directiveHandler(
const FpySequencer_StoreRelDirective& directive,
DirectiveError& error) {
1416 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + lvarOffset;
1421 return this->storeHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1424 Signal FpySequencer::call_directiveHandler(
const FpySequencer_CallDirective& directive,
DirectiveError& error) {
1426 if (this->m_runtime.stack.size <
sizeof(U32)) {
1432 U32 target = this->m_runtime.stack.pop<U32>();
1447 U32 returnAddr = this->m_runtime.nextStatementIndex;
1450 this->m_runtime.nextStatementIndex = target;
1453 this->m_runtime.stack.push<U32>(returnAddr);
1456 this->m_runtime.stack.push<
Fpy::StackSizeType>(this->m_runtime.stack.currentFrameStart);
1459 this->m_runtime.stack.currentFrameStart = this->m_runtime.stack.size;
1464 Signal FpySequencer::return_directiveHandler(
const FpySequencer_ReturnDirective& directive,
DirectiveError& error) {
1469 if (this->m_runtime.stack.size < returnValSize) {
1479 if (returnValSize > 0) {
1480 memcpy(returnValue, this->m_runtime.stack.top() - returnValSize, returnValSize);
1484 if (this->m_runtime.stack.currentFrameStart > this->m_runtime.stack.size) {
1488 this->m_runtime.stack.size = this->m_runtime.stack.currentFrameStart;
1500 U32 returnAddr = this->m_runtime.stack.pop<U32>();
1503 if (savedFramePtr > this->m_runtime.stack.size) {
1507 this->m_runtime.stack.currentFrameStart = savedFramePtr;
1516 this->m_runtime.nextStatementIndex = returnAddr;
1519 if (this->m_runtime.stack.size < callArgsSize) {
1524 this->m_runtime.stack.size -= callArgsSize;
1531 this->m_runtime.stack.push(returnValue, returnValSize);
1536 Signal FpySequencer::loadAbs_directiveHandler(
const FpySequencer_LoadAbsDirective& directive,
DirectiveError& error) {
1537 return this->loadHelper(directive.get_globalOffset(), directive.get_size(), error);
1540 Signal FpySequencer::storeAbs_directiveHandler(
const FpySequencer_StoreAbsDirective& directive,
DirectiveError& error) {
1554 return this->storeHelper(globalOffset, size, error);
1557 Signal FpySequencer::storeAbsConstOffset_directiveHandler(
const FpySequencer_StoreAbsConstOffsetDirective& directive,
1559 return this->storeHelper(directive.get_globalOffset(), directive.get_size(), error);
1565 this->sendSignal(this->popEvent_directiveHandler(directive, error));
1589 if (messageSize > clampedSize) {
1591 this->m_runtime.stack.size -= excess;
1593 this->m_runtime.stack.pop(messageBuf, clampedSize);
1594 messageBuf[clampedSize] =
'\0';
1600 Fw::String messageStr(reinterpret_cast<const char*>(messageBuf));
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
U8 * getBuffAddr()
Get buffer address for data filling (non-const version)
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...
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.
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.
void directive_waitAbs_internalInterfaceHandler(const FpySequencer_WaitAbsDirective &directive) override
Internal interface handler for directive_waitAbs.
U8 * getBuffAddr()
Get buffer address for data filling (non-const version)
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_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
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)
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)
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.
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.
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
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
U8 SerialType
The serial representation type.
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.