7 void FpySequencer::sendSignal(
Signal signal) {
26 FW_ASSERT(0, static_cast<FwAssertArgType>(signal));
31 I64& FpySequencer::reg(
U8 idx) {
32 return this->m_runtime.regs[idx];
38 this->sendSignal(this->waitRel_directiveHandler(directive, error));
39 this->m_tlm.lastDirectiveError = error;
45 this->sendSignal(this->waitAbs_directiveHandler(directive, error));
46 this->m_tlm.lastDirectiveError = error;
52 this->sendSignal(this->setSerReg_directiveHandler(directive, error));
53 this->m_tlm.lastDirectiveError = error;
59 this->sendSignal(this->goto_directiveHandler(directive, error));
60 this->m_tlm.lastDirectiveError = error;
66 this->sendSignal(this->if_directiveHandler(directive, error));
67 this->m_tlm.lastDirectiveError = error;
73 this->sendSignal(this->noOp_directiveHandler(directive, error));
74 this->m_tlm.lastDirectiveError = error;
80 this->sendSignal(this->getTlm_directiveHandler(directive, error));
81 this->m_tlm.lastDirectiveError = error;
87 this->sendSignal(this->getPrm_directiveHandler(directive, error));
88 this->m_tlm.lastDirectiveError = error;
94 this->sendSignal(this->cmd_directiveHandler(directive, error));
95 this->m_tlm.lastDirectiveError = error;
102 this->sendSignal(this->deserSerReg_directiveHandler(directive, error));
103 this->m_tlm.lastDirectiveError = error;
109 this->sendSignal(this->setReg_directiveHandler(directive, error));
110 this->m_tlm.lastDirectiveError = error;
117 this->sendSignal(this->binaryRegOp_directiveHandler(directive, error));
118 this->m_tlm.lastDirectiveError = error;
125 this->sendSignal(this->unaryRegOp_directiveHandler(directive, error));
126 this->m_tlm.lastDirectiveError = error;
132 this->sendSignal(this->exit_directiveHandler(directive, error));
133 this->m_tlm.lastDirectiveError = error;
141 this->m_runtime.wakeupTime = wakeupTime;
146 Signal FpySequencer::waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error) {
147 this->m_runtime.wakeupTime = directive.get_wakeupTime();
152 Signal FpySequencer::setSerReg_directiveHandler(
const FpySequencer_SetSerRegDirective& directive,
164 this->m_runtime.serRegs[directive.get_index()].valueSize = directive.get__valueSize();
166 (void)memcpy(this->m_runtime.serRegs[directive.get_index()].value, directive.get_value(),
167 static_cast<size_t>(directive.get__valueSize()));
173 Signal FpySequencer::goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error) {
179 m_runtime.nextStatementIndex = directive.get_statementIndex();
184 Signal FpySequencer::if_directiveHandler(
const FpySequencer_IfDirective& directive,
DirectiveError& error) {
195 if (reg(directive.get_conditionalReg())) {
201 this->m_runtime.nextStatementIndex = directive.get_falseGotoStmtIndex();
205 Signal FpySequencer::noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error) {
209 Signal FpySequencer::getTlm_directiveHandler(
const FpySequencer_GetTlmDirective& directive,
DirectiveError& error) {
237 Runtime::SerializableReg& valueSerReg = this->m_runtime.serRegs[directive.get_valueDestSerReg()];
242 Runtime::SerializableReg& timeSerReg = this->m_runtime.serRegs[directive.get_timeDestSerReg()];
244 timeSerReg.valueSize = 0;
254 timeSerReg.valueSize = esb.getBuffLength();
258 Signal FpySequencer::getPrm_directiveHandler(
const FpySequencer_GetPrmDirective& directive,
DirectiveError& error) {
284 Runtime::SerializableReg& serReg = this->m_runtime.serRegs[directive.get_destSerRegIndex()];
290 Signal FpySequencer::cmd_directiveHandler(
const FpySequencer_CmdDirective& directive,
DirectiveError& error) {
299 stat = cmdBuf.
serialize(directive.get_opCode());
318 static_cast<U32
>(((this->m_sequencesStarted & 0xFFFF) << 16) | (this->m_statementsDispatched & 0xFFFF));
329 Signal FpySequencer::deserSerReg_directiveHandler(
const FpySequencer_DeserSerRegDirective& directive,
339 Runtime::SerializableReg& serReg = this->m_runtime.serRegs[directive.get_srcSerRegIdx()];
340 if (directive.get_srcOffset() + directive.get__deserSize() > serReg.valueSize) {
347 esb.setBuffLen(serReg.valueSize);
355 switch (directive.get__deserSize()) {
359 reg(directive.get_destReg()) = oneByte;
364 reg(directive.get_destReg()) = twoBytes;
369 reg(directive.get_destReg()) = fourBytes;
374 reg(directive.get_destReg()) = eightBytes;
378 FW_ASSERT(0, static_cast<FwAssertArgType>(directive.get__deserSize()));
386 Signal FpySequencer::setReg_directiveHandler(
const FpySequencer_SetRegDirective& directive,
DirectiveError& error) {
391 reg(directive.get_dest()) = directive.get_value();
396 if (std::isunordered(lhs, rhs)) {
400 }
else if (std::isgreater(lhs, rhs)) {
402 }
else if (std::isless(lhs, rhs)) {
408 I64 FpySequencer::binaryRegOp_or(I64 lhs, I64 rhs) {
411 I64 FpySequencer::binaryRegOp_and(I64 lhs, I64 rhs) {
414 I64 FpySequencer::binaryRegOp_ieq(I64 lhs, I64 rhs) {
417 I64 FpySequencer::binaryRegOp_ine(I64 lhs, I64 rhs) {
420 I64 FpySequencer::binaryRegOp_ult(I64 lhs, I64 rhs) {
421 return static_cast<U64>(lhs) < static_cast<U64>(rhs);
423 I64 FpySequencer::binaryRegOp_ule(I64 lhs, I64 rhs) {
424 return static_cast<U64>(lhs) <= static_cast<U64>(rhs);
426 I64 FpySequencer::binaryRegOp_ugt(I64 lhs, I64 rhs) {
427 return static_cast<U64>(lhs) > static_cast<U64>(rhs);
429 I64 FpySequencer::binaryRegOp_uge(I64 lhs, I64 rhs) {
430 return static_cast<U64>(lhs) >= static_cast<U64>(rhs);
432 I64 FpySequencer::binaryRegOp_slt(I64 lhs, I64 rhs) {
435 I64 FpySequencer::binaryRegOp_sle(I64 lhs, I64 rhs) {
438 I64 FpySequencer::binaryRegOp_sgt(I64 lhs, I64 rhs) {
441 I64 FpySequencer::binaryRegOp_sge(I64 lhs, I64 rhs) {
444 I64 FpySequencer::binaryRegOp_feq(I64 lhs, I64 rhs) {
446 memcpy(&left, &lhs,
sizeof(left));
448 memcpy(&right, &rhs,
sizeof(right));
451 I64 FpySequencer::binaryRegOp_fne(I64 lhs, I64 rhs) {
453 memcpy(&left, &lhs,
sizeof(left));
455 memcpy(&right, &rhs,
sizeof(right));
458 return cmp != 0 && cmp != -2;
460 I64 FpySequencer::binaryRegOp_flt(I64 lhs, I64 rhs) {
462 memcpy(&left, &lhs,
sizeof(left));
464 memcpy(&right, &rhs,
sizeof(right));
467 I64 FpySequencer::binaryRegOp_fle(I64 lhs, I64 rhs) {
469 memcpy(&left, &lhs,
sizeof(left));
471 memcpy(&right, &rhs,
sizeof(right));
473 return cmp == 0 || cmp == -1;
475 I64 FpySequencer::binaryRegOp_fgt(I64 lhs, I64 rhs) {
477 memcpy(&left, &lhs,
sizeof(left));
479 memcpy(&right, &rhs,
sizeof(right));
482 I64 FpySequencer::binaryRegOp_fge(I64 lhs, I64 rhs) {
484 memcpy(&left, &lhs,
sizeof(left));
486 memcpy(&right, &rhs,
sizeof(right));
488 return cmp == 0 || cmp == 1;
491 Signal FpySequencer::binaryRegOp_directiveHandler(
const FpySequencer_BinaryRegOpDirective& directive,
503 I64 lhs = reg(directive.get_lhs());
504 I64 rhs = reg(directive.get_rhs());
505 I64& res = reg(directive.get_res());
507 switch (directive.get__op()) {
509 res = this->binaryRegOp_or(lhs, rhs);
512 res = this->binaryRegOp_and(lhs, rhs);
515 res = this->binaryRegOp_ieq(lhs, rhs);
518 res = this->binaryRegOp_ine(lhs, rhs);
521 res = this->binaryRegOp_ult(lhs, rhs);
524 res = this->binaryRegOp_ule(lhs, rhs);
527 res = this->binaryRegOp_ugt(lhs, rhs);
530 res = this->binaryRegOp_uge(lhs, rhs);
533 res = this->binaryRegOp_slt(lhs, rhs);
536 res = this->binaryRegOp_sle(lhs, rhs);
539 res = this->binaryRegOp_sgt(lhs, rhs);
542 res = this->binaryRegOp_sge(lhs, rhs);
545 res = this->binaryRegOp_feq(lhs, rhs);
548 res = this->binaryRegOp_fne(lhs, rhs);
551 res = this->binaryRegOp_flt(lhs, rhs);
554 res = this->binaryRegOp_fle(lhs, rhs);
557 res = this->binaryRegOp_fgt(lhs, rhs);
560 res = this->binaryRegOp_fge(lhs, rhs);
568 I64 FpySequencer::unaryRegOp_not(I64 src) {
570 return static_cast<I64
>(
false);
572 return static_cast<I64
>(
true);
574 I64 FpySequencer::unaryRegOp_fpext(I64 src) {
577 I32 trunc =
static_cast<I32
>(src);
580 memcpy(&fsrc, &trunc,
sizeof(fsrc));
582 F64 ext =
static_cast<F64>(fsrc);
585 memcpy(&iext, &ext,
sizeof(iext));
588 I64 FpySequencer::unaryRegOp_fptrunc(I64 src) {
592 memcpy(&fsrc, &src,
sizeof(fsrc));
594 F32 trunc =
static_cast<F32>(fsrc);
597 memcpy(&itrunc, &trunc,
sizeof(itrunc));
599 return static_cast<I64
>(itrunc);
601 I64 FpySequencer::unaryRegOp_fptosi(I64 src) {
604 memcpy(&fsrc, &src,
sizeof(fsrc));
606 return static_cast<I64
>(fsrc);
608 I64 FpySequencer::unaryRegOp_sitofp(I64 src) {
610 F64 fsrc =
static_cast<F64>(src);
613 memcpy(&res, &fsrc,
sizeof(res));
616 I64 FpySequencer::unaryRegOp_fptoui(I64 src) {
619 memcpy(&fsrc, &src,
sizeof(fsrc));
622 return static_cast<I64
>(
static_cast<U64>(fsrc));
624 I64 FpySequencer::unaryRegOp_uitofp(I64 src) {
626 F64 fsrc =
static_cast<F64>(
static_cast<U64>(src));
629 memcpy(&res, &fsrc,
sizeof(res));
632 Signal FpySequencer::unaryRegOp_directiveHandler(
const FpySequencer_UnaryRegOpDirective& directive,
643 I64 src = reg(directive.get_src());
644 I64& res = reg(directive.get_res());
646 switch (directive.get__op()) {
648 res = this->unaryRegOp_not(src);
651 res = this->unaryRegOp_fpext(src);
654 res = this->unaryRegOp_fptrunc(src);
657 res = this->unaryRegOp_fptosi(src);
660 res = this->unaryRegOp_fptoui(src);
663 res = this->unaryRegOp_sitofp(src);
666 res = this->unaryRegOp_uitofp(src);
675 Signal FpySequencer::exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error) {
676 if (directive.get_success()) {
deser up to 8 bytes out of an serReg
Serialization/Deserialization operation was successful.
U8 * getBuffAddr()
gets buffer address for data filling
void directive_if_internalInterfaceHandler(const Svc::FpySequencer_IfDirective &directive) override
Internal interface handler for directive_if.
I8 floatCmp(F64 lhs, F64 rhs)
called when statement successfully executed. only raised in the RUNNING.AWAITING_CMD_RESPONSE state ...
SerializeStatus serialize(U8 val)
performs a unary reg operation on src reg, and stores in res reg
Fw::TlmValid getTlmChan_out(FwIndexType portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val)
Invoke output port getTlmChan.
void directive_getPrm_internalInterfaceHandler(const Svc::FpySequencer_GetPrmDirective &directive) override
Internal interface handler for directive_getPrm.
void directive_binaryRegOp_internalInterfaceHandler(const Svc::FpySequencer_BinaryRegOpDirective &directive) override
Internal interface handler for directive_binaryRegOp.
int8_t I8
8-bit signed integer
void directive_cmd_internalInterfaceHandler(const Svc::FpySequencer_CmdDirective &directive) override
Internal interface handler for directive_cmd.
void sequencer_sendSignal_stmtResponse_success()
Send signal stmtResponse_success to state machine sequencer.
void directive_setReg_internalInterfaceHandler(const Svc::FpySequencer_SetRegDirective &directive) override
Internal interface handler for directive_setReg.
void directive_getTlm_internalInterfaceHandler(const Svc::FpySequencer_GetTlmDirective &directive) override
Internal interface handler for directive_getTlm.
SerializeStatus
forward declaration for string
float F32
32-bit floating point
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.
void directive_unaryRegOp_internalInterfaceHandler(const Svc::FpySequencer_UnaryRegOpDirective &directive) override
Internal interface handler for directive_unaryRegOp.
Serializable::SizeType getBuffLength() const
returns current buffer size
FpySequencer_DirectiveErrorCode DirectiveError
Svc::Fpy::Header & get_header()
Get member header.
U32 get_uSeconds() const
Get member uSeconds.
void directive_deserSerReg_internalInterfaceHandler(const Svc::FpySequencer_DeserSerRegDirective &directive) override
Internal interface handler for directive_deserSerReg.
void directive_exit_internalInterfaceHandler(const Svc::FpySequencer_ExitDirective &directive) override
Internal interface handler for directive_exit.
External serialize buffer with no copy semantics.
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.
uint8_t U8
8-bit unsigned integer
sets a register to a constant value
static Time add(const Time &a, const Time &b)
void sequencer_sendSignal_stmtResponse_keepWaiting()
Send signal stmtResponse_keepWaiting to state machine sequencer.
Omit length from serialization.
called when the statement unsuccessfully executed. only raised in the RUNNING.AWAITING_CMD_RESPONSE s...
performs a binary reg operation on the lhs and rhs regs, and stores the result in the third register ...
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.
RateGroupDivider component implementation.
U32 get_seconds() const
Get member seconds.
Enum representing parameter validity.
void directive_setSerReg_internalInterfaceHandler(const FpySequencer_SetSerRegDirective &directive) override
Internal interface handler for directive_setSerReg.
Fw::ParamValid getParam_out(FwIndexType portNum, FwPrmIdType id, Fw::ParamBuffer &val)
Invoke output port getParam.
bool isConnected_getTlmChan_OutputPort(FwIndexType portNum)
called when the statement is telling the sequencer to await a later stmt response ...
FpySequencer_SequencerStateMachineStateMachineBase::Signal Signal
a statement is telling the sequencer to go to sleep
PlatformAssertArgType FwAssertArgType
The type of arguments to assert functions.
SerializeStatus setBuffLen(Serializable::SizeType length)
sets buffer length manually after filling with data