9 void FpySequencer::sendSignal(
Signal signal) {
28 FW_ASSERT(0, static_cast<FwAssertArgType>(signal));
34 void FpySequencer::handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err) {
35 this->m_tlm.lastDirectiveError = err;
37 this->m_tlm.directiveErrorIndex = this->currentStatementIdx();
38 this->m_tlm.directiveErrorId = id;
45 cmdBuf.
serializeFrom(static_cast<FwPacketDescriptorType>(Fw::ComPacketType::FW_PACKET_COMMAND));
68 static_cast<U32
>(((this->m_sequencesStarted & 0xFFFF) << 16) | (this->m_statementsDispatched & 0xFFFF));
78 this->sendSignal(this->waitRel_directiveHandler(directive, error));
85 this->sendSignal(this->waitAbs_directiveHandler(directive, error));
92 this->sendSignal(this->goto_directiveHandler(directive, error));
99 this->sendSignal(this->if_directiveHandler(directive, error));
106 this->sendSignal(this->noOp_directiveHandler(directive, error));
114 this->sendSignal(this->pushTlmVal_directiveHandler(directive, error));
122 this->sendSignal(this->pushTlmValAndTime_directiveHandler(directive, error));
129 this->sendSignal(this->pushPrm_directiveHandler(directive, error));
136 this->sendSignal(this->constCmd_directiveHandler(directive, error));
143 this->sendSignal(this->stackOp_directiveHandler(directive, error));
144 handleDirectiveErrorCode(directive.
get__op(), error);
150 this->sendSignal(this->exit_directiveHandler(directive, error));
157 this->sendSignal(this->allocate_directiveHandler(directive, error));
165 this->sendSignal(this->storeRelConstOffset_directiveHandler(directive, error));
172 this->sendSignal(this->pushVal_directiveHandler(directive, error));
179 this->sendSignal(this->loadRel_directiveHandler(directive, error));
186 this->sendSignal(this->discard_directiveHandler(directive, error));
193 this->sendSignal(this->memCmp_directiveHandler(directive, error));
200 this->sendSignal(this->stackCmd_directiveHandler(directive, error));
207 this->sendSignal(this->pushTime_directiveHandler(directive, error));
214 this->sendSignal(this->setFlag_directiveHandler(directive, error));
221 this->sendSignal(this->getFlag_directiveHandler(directive, error));
228 this->sendSignal(this->getField_directiveHandler(directive, error));
235 this->sendSignal(this->peek_directiveHandler(directive, error));
242 this->sendSignal(this->storeRel_directiveHandler(directive, error));
249 this->sendSignal(this->call_directiveHandler(directive, error));
256 this->sendSignal(this->return_directiveHandler(directive, error));
263 this->sendSignal(this->loadAbs_directiveHandler(directive, error));
270 this->sendSignal(this->storeAbs_directiveHandler(directive, error));
278 this->sendSignal(this->storeAbsConstOffset_directiveHandler(directive, error));
284 if (this->m_runtime.stack.size < 8) {
291 U32 uSeconds = this->m_runtime.stack.pop<U32>();
292 U32 seconds = this->m_runtime.stack.pop<U32>();
294 wakeupTime.
add(seconds, uSeconds);
295 this->m_runtime.wakeupTime = wakeupTime;
300 Signal FpySequencer::waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error) {
306 U32 uSeconds = this->m_runtime.stack.pop<U32>();
307 U32 seconds = this->m_runtime.stack.pop<U32>();
309 U16 base = this->m_runtime.stack.pop<U16>();
311 this->m_runtime.wakeupTime =
Fw::Time(static_cast<TimeBase::T>(base), ctx, seconds, uSeconds);
316 Signal FpySequencer::goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error) {
322 m_runtime.nextStatementIndex = directive.get_statementIndex();
327 Signal FpySequencer::if_directiveHandler(
const FpySequencer_IfDirective& directive,
DirectiveError& error) {
328 if (this->m_runtime.stack.size < 1) {
338 if (this->m_runtime.stack.pop<
U8>() != 0) {
344 this->m_runtime.nextStatementIndex = directive.get_falseGotoStmtIndex();
348 Signal FpySequencer::noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error) {
352 Signal FpySequencer::pushTlmVal_directiveHandler(
const FpySequencer_PushTlmValDirective& directive,
376 Signal FpySequencer::pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
409 this->m_runtime.stack.push(timeEsb.getBuffAddr(),
static_cast<Fpy::StackSizeType>(timeEsb.getSize()));
413 Signal FpySequencer::pushPrm_directiveHandler(
const FpySequencer_PushPrmDirective& directive,
DirectiveError& error) {
437 Signal FpySequencer::constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error) {
438 if (this->sendCmd(directive.get_opCode(), directive.get_argBuf(), directive.get__argBufSize()) ==
449 if (this->m_runtime.stack.size <
sizeof(
U8) * 2) {
452 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<
U8>() | this->m_runtime.stack.pop<
U8>()));
456 if (this->m_runtime.stack.size <
sizeof(
U8) * 2) {
459 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<
U8>() & this->m_runtime.stack.pop<
U8>()));
463 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
466 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<I64>() == this->m_runtime.stack.pop<I64>()));
470 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
473 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<I64>() != this->m_runtime.stack.pop<I64>()));
477 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
480 U64 rhs = this->m_runtime.stack.pop<
U64>();
481 U64 lhs = this->m_runtime.stack.pop<
U64>();
482 this->m_runtime.stack.push(static_cast<U8>(lhs < rhs));
486 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
489 U64 rhs = this->m_runtime.stack.pop<
U64>();
490 U64 lhs = this->m_runtime.stack.pop<
U64>();
491 this->m_runtime.stack.push(static_cast<U8>(lhs <= rhs));
495 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
498 U64 rhs = this->m_runtime.stack.pop<
U64>();
499 U64 lhs = this->m_runtime.stack.pop<
U64>();
500 this->m_runtime.stack.push(static_cast<U8>(lhs > rhs));
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>();
509 this->m_runtime.stack.push(static_cast<U8>(lhs >= rhs));
513 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
516 I64 rhs = this->m_runtime.stack.pop<I64>();
517 I64 lhs = this->m_runtime.stack.pop<I64>();
518 this->m_runtime.stack.push(static_cast<U8>(lhs < rhs));
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>();
527 this->m_runtime.stack.push(static_cast<U8>(lhs <= rhs));
531 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
534 I64 rhs = this->m_runtime.stack.pop<I64>();
535 I64 lhs = this->m_runtime.stack.pop<I64>();
536 this->m_runtime.stack.push(static_cast<U8>(lhs > rhs));
540 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
543 I64 rhs = this->m_runtime.stack.pop<I64>();
544 I64 lhs = this->m_runtime.stack.pop<I64>();
545 this->m_runtime.stack.push(static_cast<U8>(lhs >= rhs));
549 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
552 F64 rhs = this->m_runtime.stack.pop<
F64>();
553 F64 lhs = this->m_runtime.stack.pop<
F64>();
555 this->m_runtime.stack.push(static_cast<U8>((lhs == rhs) ? 1 : 0));
559 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
562 F64 rhs = this->m_runtime.stack.pop<
F64>();
563 F64 lhs = this->m_runtime.stack.pop<
F64>();
565 this->m_runtime.stack.push(static_cast<U8>((lhs != rhs) ? 1 : 0));
569 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
572 F64 rhs = this->m_runtime.stack.pop<
F64>();
573 F64 lhs = this->m_runtime.stack.pop<
F64>();
574 this->m_runtime.stack.push(static_cast<U8>(std::isless(lhs, rhs)));
578 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
581 F64 rhs = this->m_runtime.stack.pop<
F64>();
582 F64 lhs = this->m_runtime.stack.pop<
F64>();
583 this->m_runtime.stack.push(static_cast<U8>(std::islessequal(lhs, rhs)));
587 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
590 F64 rhs = this->m_runtime.stack.pop<
F64>();
591 F64 lhs = this->m_runtime.stack.pop<
F64>();
592 this->m_runtime.stack.push(static_cast<U8>(std::isgreater(lhs, rhs)));
596 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
599 F64 rhs = this->m_runtime.stack.pop<
F64>();
600 F64 lhs = this->m_runtime.stack.pop<
F64>();
601 this->m_runtime.stack.push(static_cast<U8>(std::isgreaterequal(lhs, rhs)));
605 if (this->m_runtime.stack.size <
sizeof(
U8)) {
608 this->m_runtime.stack.push(static_cast<U8>(this->m_runtime.stack.pop<
U8>() == 0));
613 if (this->m_runtime.stack.size <
sizeof(
F32)) {
616 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<
F32>()));
621 if (this->m_runtime.stack.size <
sizeof(
F64)) {
624 this->m_runtime.stack.push(static_cast<F32>(this->m_runtime.stack.pop<
F64>()));
628 if (this->m_runtime.stack.size <
sizeof(
F64)) {
631 this->m_runtime.stack.push(static_cast<I64>(this->m_runtime.stack.pop<
F64>()));
635 if (this->m_runtime.stack.size <
sizeof(I64)) {
638 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<I64>()));
642 if (this->m_runtime.stack.size <
sizeof(
F64)) {
645 this->m_runtime.stack.push(static_cast<U64>(this->m_runtime.stack.pop<
F64>()));
649 if (this->m_runtime.stack.size <
sizeof(
U64)) {
652 this->m_runtime.stack.push(static_cast<F64>(this->m_runtime.stack.pop<
U64>()));
656 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
659 I64 rhs = this->m_runtime.stack.pop<I64>();
660 I64 lhs = this->m_runtime.stack.pop<I64>();
664 if ((rhs > 0) && (lhs > 0) && ((std::numeric_limits<I64>::max() - rhs) < lhs)) {
672 this->m_runtime.stack.push(static_cast<I64>(lhs + rhs));
676 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
679 I64 rhs = this->m_runtime.stack.pop<I64>();
680 I64 lhs = this->m_runtime.stack.pop<I64>();
685 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)) {
711 else if ((rhs < 0) && (lhs < 0) && ((std::numeric_limits<I64>::max() / (-1 * rhs)) < (-1 * lhs))) {
724 this->m_runtime.stack.push(static_cast<I64>(lhs * rhs));
728 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
731 U64 rhs = this->m_runtime.stack.pop<
U64>();
732 U64 lhs = this->m_runtime.stack.pop<
U64>();
737 this->m_runtime.stack.push(static_cast<U64>(lhs / rhs));
741 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 this->m_runtime.stack.push(static_cast<I64>(lhs / rhs));
755 if (this->m_runtime.stack.size <
sizeof(
U64) * 2) {
758 U64 rhs = this->m_runtime.stack.pop<
U64>();
762 U64 lhs = this->m_runtime.stack.pop<
U64>();
763 this->m_runtime.stack.push(static_cast<U64>(lhs % rhs));
767 if (this->m_runtime.stack.size <
sizeof(I64) * 2) {
770 I64 rhs = this->m_runtime.stack.pop<I64>();
774 I64 lhs = this->m_runtime.stack.pop<I64>();
775 I64 res =
static_cast<I64
>(lhs % rhs);
780 if ((res > 0 && rhs < 0) || (res < 0 && rhs > 0)) {
783 this->m_runtime.stack.push(res);
787 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
790 F64 rhs = this->m_runtime.stack.pop<
F64>();
791 F64 lhs = this->m_runtime.stack.pop<
F64>();
792 this->m_runtime.stack.push(static_cast<F64>(lhs + rhs));
796 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
799 F64 rhs = this->m_runtime.stack.pop<
F64>();
800 F64 lhs = this->m_runtime.stack.pop<
F64>();
801 this->m_runtime.stack.push(static_cast<F64>(lhs - rhs));
805 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
808 F64 rhs = this->m_runtime.stack.pop<
F64>();
809 F64 lhs = this->m_runtime.stack.pop<
F64>();
810 this->m_runtime.stack.push(static_cast<F64>(lhs * rhs));
814 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
817 F64 rhs = this->m_runtime.stack.pop<
F64>();
818 F64 lhs = this->m_runtime.stack.pop<
F64>();
819 this->m_runtime.stack.push(static_cast<F64>(lhs / rhs));
823 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
826 F64 rhs = this->m_runtime.stack.pop<
F64>();
827 F64 lhs = this->m_runtime.stack.pop<
F64>();
828 this->m_runtime.stack.push(static_cast<F64>(pow(lhs, rhs)));
832 if (this->m_runtime.stack.size <
sizeof(
F64)) {
835 F64 val = this->m_runtime.stack.pop<
F64>();
839 this->m_runtime.stack.push(static_cast<F64>(log(val)));
843 if (this->m_runtime.stack.size <
sizeof(
F64) * 2) {
846 F64 rhs = this->m_runtime.stack.pop<
F64>();
850 F64 lhs = this->m_runtime.stack.pop<
F64>();
851 this->m_runtime.stack.push(static_cast<F64>(lhs - rhs * std::floor(lhs / rhs)));
855 if (this->m_runtime.stack.size <
sizeof(
I8)) {
858 I8 src = this->m_runtime.stack.pop<
I8>();
859 this->m_runtime.stack.push(static_cast<I64>(src));
863 if (this->m_runtime.stack.size <
sizeof(I16)) {
866 I16 src = this->m_runtime.stack.pop<I16>();
867 this->m_runtime.stack.push(static_cast<I64>(src));
871 if (this->m_runtime.stack.size <
sizeof(I32)) {
874 I32 src = this->m_runtime.stack.pop<I32>();
875 this->m_runtime.stack.push(static_cast<I64>(src));
879 if (this->m_runtime.stack.size <
sizeof(
U8)) {
882 U8 src = this->m_runtime.stack.pop<
U8>();
883 this->m_runtime.stack.push(static_cast<U64>(src));
887 if (this->m_runtime.stack.size <
sizeof(U16)) {
890 U16 src = this->m_runtime.stack.pop<U16>();
891 this->m_runtime.stack.push(static_cast<U64>(src));
895 if (this->m_runtime.stack.size <
sizeof(U32)) {
898 U32 src = this->m_runtime.stack.pop<U32>();
899 this->m_runtime.stack.push(static_cast<U64>(src));
903 if (this->m_runtime.stack.size <
sizeof(
U64)) {
906 U64 src = this->m_runtime.stack.pop<
U64>();
907 this->m_runtime.stack.push(static_cast<U8>(src));
911 if (this->m_runtime.stack.size <
sizeof(
U64)) {
914 U64 src = this->m_runtime.stack.pop<
U64>();
915 this->m_runtime.stack.push(static_cast<U16>(src));
919 if (this->m_runtime.stack.size <
sizeof(
U64)) {
922 U64 src = this->m_runtime.stack.pop<
U64>();
923 this->m_runtime.stack.push(static_cast<U32>(src));
926 Signal FpySequencer::stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error) {
931 switch (directive.get__op()) {
933 error = this->op_or();
936 error = this->op_and();
939 error = this->op_ieq();
942 error = this->op_ine();
945 error = this->op_ult();
948 error = this->op_ule();
951 error = this->op_ugt();
954 error = this->op_uge();
957 error = this->op_slt();
960 error = this->op_sle();
963 error = this->op_sgt();
966 error = this->op_sge();
969 error = this->op_feq();
972 error = this->op_fne();
975 error = this->op_flt();
978 error = this->op_fle();
981 error = this->op_fgt();
984 error = this->op_fge();
987 error = this->op_not();
990 error = this->op_fpext();
993 error = this->op_fptrunc();
996 error = this->op_fptosi();
999 error = this->op_fptoui();
1002 error = this->op_sitofp();
1005 error = this->op_uitofp();
1008 error = this->op_add();
1011 error = this->op_sub();
1014 error = this->op_mul();
1017 error = this->op_udiv();
1020 error = this->op_sdiv();
1023 error = this->op_umod();
1026 error = this->op_smod();
1029 error = this->op_fadd();
1032 error = this->op_fsub();
1035 error = this->op_fmul();
1038 error = this->op_fdiv();
1041 error = this->op_fpow();
1044 error = this->op_flog();
1047 error = this->op_fmod();
1050 error = this->op_siext_8_64();
1053 error = this->op_siext_16_64();
1056 error = this->op_siext_32_64();
1059 error = this->op_ziext_8_64();
1062 error = this->op_ziext_16_64();
1065 error = this->op_ziext_32_64();
1068 error = this->op_itrunc_64_8();
1071 error = this->op_itrunc_64_16();
1074 error = this->op_itrunc_64_32();
1086 Signal FpySequencer::exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error) {
1087 if (this->m_runtime.stack.size < 1) {
1091 U8 errorCode = this->m_runtime.stack.pop<
U8>();
1093 if (errorCode == 0) {
1105 Signal FpySequencer::allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error) {
1110 this->m_runtime.stack.pushZeroes(directive.get_size());
1116 if (this->m_runtime.stack.size < size) {
1124 if (destOffset > newStackSize || size > newStackSize - destOffset) {
1129 this->m_runtime.stack.copy(destOffset, this->m_runtime.stack.size - size, size);
1130 this->m_runtime.stack.size = newStackSize;
1142 if (srcOffset > this->m_runtime.stack.size || size > this->m_runtime.stack.size - srcOffset) {
1147 this->m_runtime.stack.copy(this->m_runtime.stack.size, srcOffset, size);
1148 this->m_runtime.stack.size += size;
1152 Signal FpySequencer::storeRelConstOffset_directiveHandler(
const FpySequencer_StoreRelConstOffsetDirective& directive,
1154 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + directive.get_lvarOffset();
1159 return this->storeHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1162 Signal FpySequencer::loadRel_directiveHandler(
const FpySequencer_LoadRelDirective& directive,
DirectiveError& error) {
1163 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + directive.get_lvarOffset();
1168 return this->loadHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1171 Signal FpySequencer::pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error) {
1177 this->m_runtime.stack.push(const_cast<U8*>(directive.get_val()),
1178 static_cast<Fpy::StackSizeType>(directive.get__valSize()));
1182 Signal FpySequencer::discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error) {
1183 if (this->m_runtime.stack.size < directive.get_size()) {
1188 this->m_runtime.stack.size -= directive.get_size();
1192 Signal FpySequencer::memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error) {
1201 if (this->m_runtime.stack.size < directive.get_size() * 2) {
1207 U64 lhsOffset = this->m_runtime.stack.size - directive.get_size() * 2;
1208 U64 rhsOffset = this->m_runtime.stack.size - directive.get_size();
1213 this->m_runtime.stack.size -= directive.get_size() * 2;
1216 if (memcmp(this->m_runtime.stack.bytes + lhsOffset, this->m_runtime.stack.bytes + rhsOffset,
1217 directive.get_size()) == 0) {
1218 this->m_runtime.stack.push<
U8>(1);
1220 this->m_runtime.stack.push<
U8>(0);
1225 Signal FpySequencer::stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error) {
1228 if (this->m_runtime.stack.size <
sizeof(
FwOpcodeType) ||
1229 this->m_runtime.stack.size -
sizeof(
FwOpcodeType) < directive.get_argsSize()) {
1238 U64 argBufOffset = this->m_runtime.stack.size - directive.get_argsSize();
1241 this->m_runtime.currentCmdOpcode = opcode;
1244 this->m_runtime.stack.size -= directive.get_argsSize();
1246 if (this->sendCmd(opcode, this->m_runtime.stack.bytes + argBufOffset, directive.get_argsSize()) ==
1258 Signal FpySequencer::pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error) {
1274 this->m_runtime.stack.push(timeEsb.getBuffAddr(),
static_cast<Fpy::StackSizeType>(timeEsb.getSize()));
1278 Signal FpySequencer::setFlag_directiveHandler(
const FpySequencer_SetFlagDirective& directive,
DirectiveError& error) {
1279 if (this->m_runtime.stack.size < 1) {
1289 U8 flagVal = this->m_runtime.stack.pop<
U8>() != 0;
1291 this->m_runtime.flags[directive.get_flagIdx()] = flagVal == 1;
1295 Signal FpySequencer::getFlag_directiveHandler(
const FpySequencer_GetFlagDirective& directive,
DirectiveError& error) {
1305 bool flagVal = this->m_runtime.flags[directive.get_flagIdx()];
1306 this->m_runtime.stack.push<
U8>(flagVal);
1310 Signal FpySequencer::getField_directiveHandler(
const FpySequencer_GetFieldDirective& directive,
DirectiveError& error) {
1318 if (this->m_runtime.stack.size -
sizeof(
Fpy::StackSizeType) < directive.get_parentSize()) {
1327 if (offset > directive.get_parentSize() || directive.get_memberSize() > directive.get_parentSize() - offset) {
1338 Fpy::StackSizeType parentStartOffset = this->m_runtime.stack.size - directive.get_parentSize();
1341 this->m_runtime.stack.move(parentStartOffset, parentStartOffset + offset, directive.get_memberSize());
1343 this->m_runtime.stack.size -= (directive.get_parentSize() - directive.get_memberSize());
1347 Signal FpySequencer::peek_directiveHandler(
const FpySequencer_PeekDirective& directive,
DirectiveError& error) {
1358 if (offset > this->m_runtime.stack.size) {
1371 if (byteCount > this->m_runtime.stack.size - offset) {
1377 U8* src = this->m_runtime.stack.top() - offset - byteCount;
1378 this->m_runtime.stack.push(src, byteCount);
1382 Signal FpySequencer::storeRel_directiveHandler(
const FpySequencer_StoreRelDirective& directive,
DirectiveError& error) {
1395 I64 addr =
static_cast<I64
>(this->m_runtime.stack.currentFrameStart) + lvarOffset;
1400 return this->storeHelper(static_cast<Fpy::StackSizeType>(addr), directive.get_size(), error);
1403 Signal FpySequencer::call_directiveHandler(
const FpySequencer_CallDirective& directive,
DirectiveError& error) {
1405 if (this->m_runtime.stack.size <
sizeof(U32)) {
1411 U32 target = this->m_runtime.stack.pop<U32>();
1426 U32 returnAddr = this->m_runtime.nextStatementIndex;
1429 this->m_runtime.nextStatementIndex = target;
1432 this->m_runtime.stack.push<U32>(returnAddr);
1435 this->m_runtime.stack.push<
Fpy::StackSizeType>(this->m_runtime.stack.currentFrameStart);
1438 this->m_runtime.stack.currentFrameStart = this->m_runtime.stack.size;
1443 Signal FpySequencer::return_directiveHandler(
const FpySequencer_ReturnDirective& directive,
DirectiveError& error) {
1448 if (this->m_runtime.stack.size < returnValSize) {
1458 if (returnValSize > 0) {
1459 memcpy(returnValue, this->m_runtime.stack.top() - returnValSize, returnValSize);
1463 if (this->m_runtime.stack.currentFrameStart > this->m_runtime.stack.size) {
1467 this->m_runtime.stack.size = this->m_runtime.stack.currentFrameStart;
1479 U32 returnAddr = this->m_runtime.stack.pop<U32>();
1482 if (savedFramePtr > this->m_runtime.stack.size) {
1486 this->m_runtime.stack.currentFrameStart = savedFramePtr;
1495 this->m_runtime.nextStatementIndex = returnAddr;
1498 if (this->m_runtime.stack.size < callArgsSize) {
1503 this->m_runtime.stack.size -= callArgsSize;
1510 this->m_runtime.stack.push(returnValue, returnValSize);
1515 Signal FpySequencer::loadAbs_directiveHandler(
const FpySequencer_LoadAbsDirective& directive,
DirectiveError& error) {
1516 return this->loadHelper(directive.get_globalOffset(), directive.get_size(), error);
1519 Signal FpySequencer::storeAbs_directiveHandler(
const FpySequencer_StoreAbsDirective& directive,
DirectiveError& error) {
1533 return this->storeHelper(globalOffset, size, error);
1536 Signal FpySequencer::storeAbsConstOffset_directiveHandler(
const FpySequencer_StoreAbsConstOffsetDirective& directive,
1538 return this->storeHelper(directive.get_globalOffset(), directive.get_size(), error);
void directive_storeRelConstOffset_internalInterfaceHandler(const Svc::FpySequencer_StoreRelConstOffsetDirective &directive) override
Internal interface handler for directive_storeRelConstOffset.
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.
FwIdType FwOpcodeType
The type of a command opcode.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG) override
Serialize an 8-bit unsigned integer value.
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.
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
Fw::TlmValid getTlmChan_out(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke output port getTlmChan.
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.
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.
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.
U8 FwTimeContextStoreType
The type used to serialize a time context value.
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 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.
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 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.
void sequencer_sendSignal_stmtResponse_beginSleep()
Send signal stmtResponse_beginSleep to state machine sequencer.
void directive_getFlag_internalInterfaceHandler(const Svc::FpySequencer_GetFlagDirective &directive) override
Internal interface handler for directive_getFlag.
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
generic stack operation handler
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.
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)
double F64
64-bit floating point (double). Required for compiler-supplied double promotion.
bool isConnected_prmGet_OutputPort(FwIndexType portNum)
void cmdOut_out(FwIndexType portNum, Fw::ComBuffer &data, U32 context)
Invoke output port cmdOut.
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 directive_storeAbs_internalInterfaceHandler(const Svc::FpySequencer_StoreAbsDirective &directive) override
Internal interface handler for directive_storeAbs.
pushes a prm buf to the stack
void directive_setFlag_internalInterfaceHandler(const Svc::FpySequencer_SetFlagDirective &directive) override
Internal interface handler for directive_setFlag.
Fw::ParamValid getParam_out(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Invoke output port getParam.
pushes the current Fw.Time struct to the stack
pushes some empty bytes to the stack
pops a bool off the stack, sets a flag with a specific index to that bool
bool isConnected_getTlmChan_OutputPort(FwIndexType portNum)
called when the statement is telling the sequencer to await a later stmt response ...
gets a flag and pushes its value as a U8 to the stack
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
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.