8 void FpySequencer::sendSignal(
Signal signal) {
27 FW_ASSERT(0, static_cast<FwAssertArgType>(signal));
33 void FpySequencer::handleDirectiveErrorCode(Fpy::DirectiveId
id,
DirectiveError err) {
34 this->m_tlm.lastDirectiveError = err;
36 this->m_tlm.directiveErrorIndex = this->currentStatementIdx();
37 this->m_tlm.directiveErrorId = id;
44 cmdBuf.
serializeFrom(static_cast<FwPacketDescriptorType>(Fw::ComPacketType::FW_PACKET_COMMAND));
67 static_cast<U32
>(((this->m_sequencesStarted & 0xFFFF) << 16) | (this->m_statementsDispatched & 0xFFFF));
75 T FpySequencer::pop() {
76 static_assert(
sizeof(T) == 8 ||
sizeof(T) == 4 ||
sizeof(T) == 2 ||
sizeof(T) == 1,
"size must be 1, 2, 4, 8");
77 FW_ASSERT(this->m_runtime.stackSize >=
sizeof(T), static_cast<FwAssertArgType>(this->m_runtime.stackSize),
78 static_cast<FwAssertArgType>(
sizeof(T)));
82 memcpy(valBytes, this->top() -
sizeof(T),
sizeof(T));
87 return static_cast<T
>((
static_cast<T
>(valBytes[7]) << 0) | (
static_cast<T
>(valBytes[6]) << 8) |
88 (
static_cast<T
>(valBytes[5]) << 16) | (
static_cast<T
>(valBytes[4]) << 24) |
89 (
static_cast<T
>(valBytes[3]) << 32) | (
static_cast<T
>(valBytes[2]) << 40) |
90 (
static_cast<T
>(valBytes[1]) << 48) | (
static_cast<T
>(valBytes[0]) << 56));
91 }
else if (
sizeof(T) == 4) {
92 return static_cast<T
>((
static_cast<T
>(valBytes[3]) << 0) | (
static_cast<T
>(valBytes[2]) << 8) |
93 (
static_cast<T
>(valBytes[1]) << 16) | (
static_cast<T
>(valBytes[0]) << 24));
94 }
else if (
sizeof(T) == 2) {
95 return static_cast<T
>((
static_cast<T
>(valBytes[1]) << 0) | (
static_cast<T
>(valBytes[0]) << 8));
97 return static_cast<T
>(valBytes[0]);
101 template U8 FpySequencer::pop();
102 template U16 FpySequencer::pop();
103 template U32 FpySequencer::pop();
104 template U64 FpySequencer::pop();
105 template I8 FpySequencer::pop();
106 template I16 FpySequencer::pop();
107 template I32 FpySequencer::pop();
108 template I64 FpySequencer::pop();
111 F32 FpySequencer::pop<F32>() {
112 U32 endianness = this->pop<U32>();
114 memcpy(&val, &endianness,
sizeof(val));
119 F64 FpySequencer::pop<F64>() {
120 U64 endianness = this->pop<U64>();
122 memcpy(&val, &endianness,
sizeof(val));
126 template <
typename T>
127 void FpySequencer::push(T val) {
128 static_assert(
sizeof(T) == 8 ||
sizeof(T) == 4 ||
sizeof(T) == 2 ||
sizeof(T) == 1,
"size must be 1, 2, 4, 8");
130 static_cast<FwAssertArgType>(this->m_runtime.stackSize), static_cast<FwAssertArgType>(
sizeof(T)));
132 U8 valBytes[8] = {0};
134 using UnsignedT =
typename std::make_unsigned<T>::type;
135 UnsignedT valUnsigned =
static_cast<UnsignedT
>(val);
136 if (
sizeof(T) == 8) {
137 valBytes[0] =
static_cast<U8>(valUnsigned >> 56);
138 valBytes[1] =
static_cast<U8>(valUnsigned >> 48);
139 valBytes[2] =
static_cast<U8>(valUnsigned >> 40);
140 valBytes[3] =
static_cast<U8>(valUnsigned >> 32);
141 valBytes[4] =
static_cast<U8>(valUnsigned >> 24);
142 valBytes[5] =
static_cast<U8>(valUnsigned >> 16);
143 valBytes[6] =
static_cast<U8>(valUnsigned >> 8);
144 valBytes[7] =
static_cast<U8>(valUnsigned >> 0);
145 }
else if (
sizeof(T) == 4) {
146 valBytes[0] =
static_cast<U8>(valUnsigned >> 24);
147 valBytes[1] =
static_cast<U8>(valUnsigned >> 16);
148 valBytes[2] =
static_cast<U8>(valUnsigned >> 8);
149 valBytes[3] =
static_cast<U8>(valUnsigned >> 0);
150 }
else if (
sizeof(T) == 2) {
151 valBytes[0] =
static_cast<U8>(valUnsigned >> 8);
152 valBytes[1] =
static_cast<U8>(valUnsigned >> 0);
154 valBytes[0] =
static_cast<U8>(valUnsigned);
156 memcpy(this->top(), valBytes,
sizeof(T));
160 template void FpySequencer::push(
U8);
161 template void FpySequencer::push(U16);
162 template void FpySequencer::push(U32);
163 template void FpySequencer::push(
U64);
164 template void FpySequencer::push(
I8);
165 template void FpySequencer::push(I16);
166 template void FpySequencer::push(I32);
167 template void FpySequencer::push(I64);
170 void FpySequencer::push<F32>(
F32 val) {
172 memcpy(&endianness, &val,
sizeof(val));
173 this->push(endianness);
177 void FpySequencer::push<F64>(
F64 val) {
179 memcpy(&endianness, &val,
sizeof(val));
180 this->push(endianness);
183 U8* FpySequencer::top() {
184 return &this->m_runtime.stack[this->m_runtime.stackSize];
187 U8* FpySequencer::lvars() {
188 return this->m_runtime.stack + this->lvarOffset();
200 this->sendSignal(this->waitRel_directiveHandler(directive, error));
207 this->sendSignal(this->waitAbs_directiveHandler(directive, error));
214 this->sendSignal(this->goto_directiveHandler(directive, error));
221 this->sendSignal(this->if_directiveHandler(directive, error));
228 this->sendSignal(this->noOp_directiveHandler(directive, error));
236 this->sendSignal(this->storeTlmVal_directiveHandler(directive, error));
244 this->sendSignal(this->pushTlmValAndTime_directiveHandler(directive, error));
251 this->sendSignal(this->storePrm_directiveHandler(directive, error));
258 this->sendSignal(this->constCmd_directiveHandler(directive, error));
265 this->sendSignal(this->stackOp_directiveHandler(directive, error));
266 handleDirectiveErrorCode(directive.
get__op(), error);
272 this->sendSignal(this->exit_directiveHandler(directive, error));
279 this->sendSignal(this->allocate_directiveHandler(directive, error));
286 this->sendSignal(this->store_directiveHandler(directive, error));
293 this->sendSignal(this->pushVal_directiveHandler(directive, error));
300 this->sendSignal(this->load_directiveHandler(directive, error));
307 this->sendSignal(this->discard_directiveHandler(directive, error));
314 this->sendSignal(this->memCmp_directiveHandler(directive, error));
321 this->sendSignal(this->stackCmd_directiveHandler(directive, error));
328 this->sendSignal(this->pushTime_directiveHandler(directive, error));
335 this->sendSignal(this->setFlag_directiveHandler(directive, error));
342 this->sendSignal(this->getFlag_directiveHandler(directive, error));
348 if (this->m_runtime.stackSize < 8) {
355 U32 uSeconds = this->pop<U32>();
356 U32 seconds = this->pop<U32>();
358 wakeupTime.
add(seconds, uSeconds);
359 this->m_runtime.wakeupTime = wakeupTime;
364 Signal FpySequencer::waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error) {
370 U32 uSeconds = this->pop<U32>();
371 U32 seconds = this->pop<U32>();
373 U16 base = this->pop<U16>();
375 this->m_runtime.wakeupTime =
Fw::Time(static_cast<TimeBase::T>(base), ctx, seconds, uSeconds);
380 Signal FpySequencer::goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error) {
386 m_runtime.nextStatementIndex = directive.get_statementIndex();
391 Signal FpySequencer::if_directiveHandler(
const FpySequencer_IfDirective& directive,
DirectiveError& error) {
392 if (this->m_runtime.stackSize < 1) {
402 if (this->pop<U8>() != 0) {
408 this->m_runtime.nextStatementIndex = directive.get_falseGotoStmtIndex();
412 Signal FpySequencer::noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error) {
416 Signal FpySequencer::storeTlmVal_directiveHandler(
const FpySequencer_StoreTlmValDirective& directive,
423 if (stackOffset >= this->m_runtime.stackSize) {
441 if (stackOffset + tlmValue.
getBuffLength() > this->m_runtime.stackSize) {
450 Signal FpySequencer::pushTlmValAndTime_directiveHandler(
const FpySequencer_PushTlmValAndTimeDirective& directive,
484 memcpy(this->m_runtime.stack + this->m_runtime.stackSize, timeEsb.getBuffAddr(), timeEsb.getBuffLength());
485 this->m_runtime.stackSize +=
static_cast<Fpy::StackSizeType>(timeEsb.getBuffLength());
489 Signal FpySequencer::storePrm_directiveHandler(
const FpySequencer_StorePrmDirective& directive,
DirectiveError& error) {
495 if (stackOffset >= this->m_runtime.stackSize) {
512 if (stackOffset + prmValue.
getBuffLength() > this->m_runtime.stackSize) {
521 Signal FpySequencer::constCmd_directiveHandler(
const FpySequencer_ConstCmdDirective& directive,
DirectiveError& error) {
522 if (this->sendCmd(directive.get_opCode(), directive.get_argBuf(), directive.get__argBufSize()) ==
533 if (std::isunordered(lhs, rhs)) {
537 }
else if (std::isgreater(lhs, rhs)) {
539 }
else if (std::isless(lhs, rhs)) {
546 if (this->m_runtime.stackSize <
sizeof(
U8) * 2) {
549 this->push(static_cast<U8>(this->pop<U8>() | this->pop<U8>()));
553 if (this->m_runtime.stackSize <
sizeof(
U8) * 2) {
556 this->push(static_cast<U8>(this->pop<U8>() & this->pop<U8>()));
560 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
563 this->push(static_cast<U8>(this->pop<I64>() == this->pop<I64>()));
567 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
570 this->push(static_cast<U8>(this->pop<I64>() != this->pop<I64>()));
574 if (this->m_runtime.stackSize <
sizeof(
U64) * 2) {
577 U64 rhs = this->pop<U64>();
578 U64 lhs = this->pop<U64>();
579 this->push(static_cast<U8>(lhs < rhs));
583 if (this->m_runtime.stackSize <
sizeof(
U64) * 2) {
586 U64 rhs = this->pop<U64>();
587 U64 lhs = this->pop<U64>();
588 this->push(static_cast<U8>(lhs <= rhs));
592 if (this->m_runtime.stackSize <
sizeof(
U64) * 2) {
595 U64 rhs = this->pop<U64>();
596 U64 lhs = this->pop<U64>();
597 this->push(static_cast<U8>(lhs > rhs));
601 if (this->m_runtime.stackSize <
sizeof(
U64) * 2) {
604 U64 rhs = this->pop<U64>();
605 U64 lhs = this->pop<U64>();
606 this->push(static_cast<U8>(lhs >= rhs));
610 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
613 I64 rhs = this->pop<I64>();
614 I64 lhs = this->pop<I64>();
615 this->push(static_cast<U8>(lhs < rhs));
619 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
622 I64 rhs = this->pop<I64>();
623 I64 lhs = this->pop<I64>();
624 this->push(static_cast<U8>(lhs <= rhs));
628 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
631 I64 rhs = this->pop<I64>();
632 I64 lhs = this->pop<I64>();
633 this->push(static_cast<U8>(lhs > rhs));
637 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
640 I64 rhs = this->pop<I64>();
641 I64 lhs = this->pop<I64>();
642 this->push(static_cast<U8>(lhs >= rhs));
646 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
649 F64 rhs = this->pop<F64>();
650 F64 lhs = this->pop<F64>();
652 this->push(static_cast<U8>(
floatCmp(lhs, rhs) == 0));
656 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
659 F64 rhs = this->pop<F64>();
660 F64 lhs = this->pop<F64>();
663 this->push(static_cast<U8>(cmp != 0 && cmp != -2));
667 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
670 F64 rhs = this->pop<F64>();
671 F64 lhs = this->pop<F64>();
672 this->push(static_cast<U8>(
floatCmp(lhs, rhs) == -1));
676 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
679 F64 rhs = this->pop<F64>();
680 F64 lhs = this->pop<F64>();
682 this->push(static_cast<U8>(cmp == 0 || cmp == -1));
686 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
689 F64 rhs = this->pop<F64>();
690 F64 lhs = this->pop<F64>();
691 this->push(static_cast<U8>(
floatCmp(lhs, rhs) == 1));
695 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
698 F64 rhs = this->pop<F64>();
699 F64 lhs = this->pop<F64>();
701 this->push(static_cast<U8>(cmp == 0 || cmp == 1));
705 if (this->m_runtime.stackSize <
sizeof(
U8)) {
708 this->push(static_cast<U8>(this->pop<U8>() == 0));
713 if (this->m_runtime.stackSize <
sizeof(
F32)) {
716 this->push(static_cast<F64>(this->pop<F32>()));
721 if (this->m_runtime.stackSize <
sizeof(
F64)) {
724 this->push(static_cast<F32>(this->pop<F64>()));
728 if (this->m_runtime.stackSize <
sizeof(
F64)) {
731 this->push(static_cast<I64>(this->pop<F64>()));
735 if (this->m_runtime.stackSize <
sizeof(I64)) {
738 this->push(static_cast<F64>(this->pop<I64>()));
742 if (this->m_runtime.stackSize <
sizeof(
F64)) {
745 this->push(static_cast<U64>(this->pop<F64>()));
749 if (this->m_runtime.stackSize <
sizeof(
U64)) {
752 this->push(static_cast<F64>(this->pop<U64>()));
756 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
759 I64 rhs = this->pop<I64>();
760 I64 lhs = this->pop<I64>();
761 this->push(static_cast<I64>(lhs + rhs));
765 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
768 I64 rhs = this->pop<I64>();
769 I64 lhs = this->pop<I64>();
770 this->push(static_cast<I64>(lhs - rhs));
774 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
777 I64 rhs = this->pop<I64>();
778 I64 lhs = this->pop<I64>();
779 this->push(static_cast<I64>(lhs * rhs));
783 if (this->m_runtime.stackSize <
sizeof(
U64) * 2) {
786 U64 rhs = this->pop<U64>();
787 U64 lhs = this->pop<U64>();
788 this->push(static_cast<U64>(lhs / rhs));
792 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
795 I64 rhs = this->pop<I64>();
796 I64 lhs = this->pop<I64>();
797 this->push(static_cast<I64>(lhs / rhs));
801 if (this->m_runtime.stackSize <
sizeof(
U64) * 2) {
804 U64 rhs = this->pop<U64>();
808 U64 lhs = this->pop<U64>();
809 this->push(static_cast<U64>(lhs % rhs));
813 if (this->m_runtime.stackSize <
sizeof(I64) * 2) {
816 I64 rhs = this->pop<I64>();
820 I64 lhs = this->pop<I64>();
821 I64 res =
static_cast<I64
>(lhs % rhs);
826 if ((res > 0 && rhs < 0) || (res < 0 && rhs > 0)) {
833 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
836 F64 rhs = this->pop<F64>();
837 F64 lhs = this->pop<F64>();
838 this->push(static_cast<F64>(lhs + rhs));
842 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
845 F64 rhs = this->pop<F64>();
846 F64 lhs = this->pop<F64>();
847 this->push(static_cast<F64>(lhs - rhs));
851 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
854 F64 rhs = this->pop<F64>();
855 F64 lhs = this->pop<F64>();
856 this->push(static_cast<F64>(lhs * rhs));
860 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
863 F64 rhs = this->pop<F64>();
864 F64 lhs = this->pop<F64>();
865 this->push(static_cast<F64>(lhs / rhs));
869 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
872 F64 rhs = this->pop<F64>();
873 F64 lhs = this->pop<F64>();
874 this->push(static_cast<F64>(floor(lhs / rhs)));
878 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
881 F64 rhs = this->pop<F64>();
882 F64 lhs = this->pop<F64>();
883 this->push(static_cast<F64>(pow(lhs, rhs)));
887 if (this->m_runtime.stackSize <
sizeof(
F64)) {
890 F64 val = this->pop<F64>();
891 this->push(static_cast<F64>(log(val)));
895 if (this->m_runtime.stackSize <
sizeof(
F64) * 2) {
898 F64 rhs = this->pop<F64>();
902 F64 lhs = this->pop<F64>();
903 this->push(static_cast<F64>(lhs - rhs * std::floor(lhs / rhs)));
907 if (this->m_runtime.stackSize <
sizeof(
I8)) {
910 I8 src = this->pop<I8>();
911 this->push(static_cast<I64>(src));
915 if (this->m_runtime.stackSize <
sizeof(I16)) {
918 I16 src = this->pop<I16>();
919 this->push(static_cast<I64>(src));
923 if (this->m_runtime.stackSize <
sizeof(I32)) {
926 I32 src = this->pop<I32>();
927 this->push(static_cast<I64>(src));
931 if (this->m_runtime.stackSize <
sizeof(
U8)) {
934 U8 src = this->pop<U8>();
935 this->push(static_cast<U64>(src));
939 if (this->m_runtime.stackSize <
sizeof(U16)) {
942 U16 src = this->pop<U16>();
943 this->push(static_cast<U64>(src));
947 if (this->m_runtime.stackSize <
sizeof(U32)) {
950 U32 src = this->pop<U32>();
951 this->push(static_cast<U64>(src));
955 if (this->m_runtime.stackSize <
sizeof(
U64)) {
958 U64 src = this->pop<U64>();
959 this->push(static_cast<U8>(src));
963 if (this->m_runtime.stackSize <
sizeof(
U64)) {
966 U64 src = this->pop<U64>();
967 this->push(static_cast<U16>(src));
971 if (this->m_runtime.stackSize <
sizeof(
U64)) {
974 U64 src = this->pop<U64>();
975 this->push(static_cast<U32>(src));
978 Signal FpySequencer::stackOp_directiveHandler(
const FpySequencer_StackOpDirective& directive,
DirectiveError& error) {
983 switch (directive.get__op()) {
985 error = this->op_or();
988 error = this->op_and();
991 error = this->op_ieq();
994 error = this->op_ine();
997 error = this->op_ult();
1000 error = this->op_ule();
1003 error = this->op_ugt();
1006 error = this->op_uge();
1009 error = this->op_slt();
1012 error = this->op_sle();
1015 error = this->op_sgt();
1018 error = this->op_sge();
1021 error = this->op_feq();
1024 error = this->op_fne();
1027 error = this->op_flt();
1030 error = this->op_fle();
1033 error = this->op_fgt();
1036 error = this->op_fge();
1039 error = this->op_not();
1042 error = this->op_fpext();
1045 error = this->op_fptrunc();
1048 error = this->op_fptosi();
1051 error = this->op_fptoui();
1054 error = this->op_sitofp();
1057 error = this->op_uitofp();
1060 error = this->op_iadd();
1063 error = this->op_isub();
1066 error = this->op_imul();
1069 error = this->op_udiv();
1072 error = this->op_sdiv();
1075 error = this->op_umod();
1078 error = this->op_smod();
1081 error = this->op_fadd();
1084 error = this->op_fsub();
1087 error = this->op_fmul();
1090 error = this->op_fdiv();
1093 error = this->op_float_floor_div();
1096 error = this->op_fpow();
1099 error = this->op_flog();
1102 error = this->op_fmod();
1105 error = this->op_siext_8_64();
1108 error = this->op_siext_16_64();
1111 error = this->op_siext_32_64();
1114 error = this->op_ziext_8_64();
1117 error = this->op_ziext_16_64();
1120 error = this->op_ziext_32_64();
1123 error = this->op_itrunc_64_8();
1126 error = this->op_itrunc_64_16();
1129 error = this->op_itrunc_64_32();
1141 Signal FpySequencer::exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error) {
1142 if (this->m_runtime.stackSize < 1) {
1146 if (this->pop<U8>() != 0) {
1156 Signal FpySequencer::allocate_directiveHandler(
const FpySequencer_AllocateDirective& directive,
DirectiveError& error) {
1162 memset(this->top(), 0, directive.get_size());
1163 this->m_runtime.stackSize += directive.get_size();
1167 Signal FpySequencer::store_directiveHandler(
const FpySequencer_StoreDirective& directive,
DirectiveError& error) {
1168 if (this->m_runtime.stackSize < directive.get_size()) {
1175 if (stackOffset + directive.get_size() > this->m_runtime.stackSize - directive.get_size()) {
1181 memcpy(this->m_runtime.stack + stackOffset, this->top() - directive.get_size(), directive.get_size());
1182 this->m_runtime.stackSize -= directive.get_size();
1186 Signal FpySequencer::load_directiveHandler(
const FpySequencer_LoadDirective& directive,
DirectiveError& error) {
1194 if (stackOffset + directive.get_size() > this->m_runtime.stackSize) {
1199 memcpy(this->top(), this->m_runtime.stack + stackOffset, directive.get_size());
1200 this->m_runtime.stackSize += directive.get_size();
1204 Signal FpySequencer::pushVal_directiveHandler(
const FpySequencer_PushValDirective& directive,
DirectiveError& error) {
1210 memcpy(this->top(), directive.get_val(), directive.get__valSize());
1211 this->m_runtime.stackSize +=
static_cast<Fpy::StackSizeType>(directive.get__valSize());
1215 Signal FpySequencer::discard_directiveHandler(
const FpySequencer_DiscardDirective& directive,
DirectiveError& error) {
1216 if (this->m_runtime.stackSize < directive.get_size()) {
1221 this->m_runtime.stackSize -= directive.get_size();
1225 Signal FpySequencer::memCmp_directiveHandler(
const FpySequencer_MemCmpDirective& directive,
DirectiveError& error) {
1227 if (this->m_runtime.stackSize < directive.get_size() * 2) {
1233 U64 lhsOffset = this->m_runtime.stackSize - directive.get_size() * 2;
1234 U64 rhsOffset = this->m_runtime.stackSize - directive.get_size();
1239 this->m_runtime.stackSize -= directive.get_size() * 2;
1242 if (memcmp(this->m_runtime.stack + lhsOffset, this->m_runtime.stack + rhsOffset, directive.get_size()) == 0) {
1250 Signal FpySequencer::stackCmd_directiveHandler(
const FpySequencer_StackCmdDirective& directive,
DirectiveError& error) {
1251 if (this->m_runtime.stackSize < static_cast<U64>(directive.get_argsSize() +
sizeof(
FwOpcodeType))) {
1260 U64 argBufOffset = this->m_runtime.stackSize - directive.get_argsSize();
1263 this->m_runtime.currentCmdOpcode = opcode;
1266 this->m_runtime.stackSize -= directive.get_argsSize();
1268 if (this->sendCmd(opcode, this->m_runtime.stack + argBufOffset, directive.get_argsSize()) ==
Fw::Success::FAILURE) {
1279 Signal FpySequencer::pushTime_directiveHandler(
const FpySequencer_PushTimeDirective& directive,
DirectiveError& error) {
1295 memcpy(this->m_runtime.stack + this->m_runtime.stackSize, timeEsb.getBuffAddr(), timeEsb.getBuffLength());
1296 this->m_runtime.stackSize +=
static_cast<Fpy::StackSizeType>(timeEsb.getBuffLength());
1300 Signal FpySequencer::setFlag_directiveHandler(
const FpySequencer_SetFlagDirective& directive,
DirectiveError& error) {
1301 if (this->m_runtime.stackSize < 1) {
1311 U8 flagVal = this->pop<U8>() != 0;
1313 this->m_runtime.flags[directive.get_flagIdx()] = flagVal == 1;
1317 Signal FpySequencer::getFlag_directiveHandler(
const FpySequencer_GetFlagDirective& directive,
DirectiveError& error) {
1327 bool flagVal = this->m_runtime.flags[directive.get_flagIdx()];
1328 this->push<U8>(flagVal);
Serialization/Deserialization operation was successful.
sets the index of the next directive to execute
U8 * getBuffAddr()
gets buffer address for data filling
FwIdType FwOpcodeType
The type of a command opcode.
void directive_load_internalInterfaceHandler(const Svc::FpySequencer_LoadDirective &directive) override
Internal interface handler for directive_load.
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
I8 floatCmp(F64 lhs, F64 rhs)
void directive_stackOp_internalInterfaceHandler(const Svc::FpySequencer_StackOpDirective &directive) override
Internal interface handler for directive_stackOp.
void directive_storePrm_internalInterfaceHandler(const Svc::FpySequencer_StorePrmDirective &directive) override
Internal interface handler for directive_storePrm.
called when statement successfully executed. only raised in the RUNNING.AWAITING_CMD_RESPONSE state ...
Fw::TlmValid getTlmChan_out(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke output port getTlmChan.
void directive_pushTlmValAndTime_internalInterfaceHandler(const Svc::FpySequencer_PushTlmValAndTimeDirective &directive) override
Internal interface handler for directive_pushTlmValAndTime.
int8_t I8
8-bit signed integer
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 sequencer_sendSignal_stmtResponse_success()
Send signal stmtResponse_success to state machine sequencer.
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.
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
void directive_allocate_internalInterfaceHandler(const Svc::FpySequencer_AllocateDirective &directive) override
Internal interface handler for directive_allocate.
stores a prm buffer in the lvar array
void directive_storeTlmVal_internalInterfaceHandler(const Svc::FpySequencer_StoreTlmValDirective &directive) override
Internal interface handler for directive_storeTlmVal.
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.
Serializable::SizeType getBuffLength() const
returns current buffer size
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.
FpySequencer_DirectiveErrorCode DirectiveError
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_store_internalInterfaceHandler(const Svc::FpySequencer_StoreDirective &directive) override
Internal interface handler for directive_store.
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive) override
Internal interface handler for directive_exit.
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()
gets buffer address for data filling
void directive_goto_internalInterfaceHandler(const Svc::FpySequencer_GotoDirective &directive) override
Internal interface handler for directive_goto.
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.
SerializeStatus serializeFrom(U8 val, Endianness mode=Endianness::BIG)
serialize 8-bit unsigned int
void directive_getFlag_internalInterfaceHandler(const Svc::FpySequencer_GetFlagDirective &directive) override
Internal interface handler for directive_getFlag.
pops some bytes off the stack and puts them in lvar array
sleeps for a relative duration from the current time
uint8_t U8
8-bit unsigned integer
gets bytes from lvar array and pushes them to stack
generic stack operation handler
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...
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
RateGroupDivider component implementation.
Enum representing parameter validity.
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
stores a tlm buffer in the lvar array
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
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 ...