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;
116 this->sendSignal(this->binaryRegOp_directiveHandler(directive, error));
117 this->m_tlm.lastDirectiveError = error;
124 this->sendSignal(this->unaryRegOp_directiveHandler(directive, error));
125 this->m_tlm.lastDirectiveError = error;
131 this->sendSignal(this->exit_directiveHandler(directive, error));
132 this->m_tlm.lastDirectiveError = error;
140 this->m_runtime.wakeupTime = wakeupTime;
145 Signal FpySequencer::waitAbs_directiveHandler(
const FpySequencer_WaitAbsDirective& directive,
DirectiveError& error) {
146 this->m_runtime.wakeupTime = directive.getwakeupTime();
151 Signal FpySequencer::setSerReg_directiveHandler(
const FpySequencer_SetSerRegDirective& directive,
163 this->m_runtime.serRegs[directive.getindex()].valueSize = directive.get_valueSize();
165 (void)memcpy(this->m_runtime.serRegs[directive.getindex()].value, directive.getvalue(),
166 static_cast<size_t>(directive.get_valueSize()));
172 Signal FpySequencer::goto_directiveHandler(
const FpySequencer_GotoDirective& directive,
DirectiveError& error) {
178 m_runtime.nextStatementIndex = directive.getstatementIndex();
183 Signal FpySequencer::if_directiveHandler(
const FpySequencer_IfDirective& directive,
DirectiveError& error) {
194 if (reg(directive.getconditionalReg())) {
200 this->m_runtime.nextStatementIndex = directive.getfalseGotoStmtIndex();
204 Signal FpySequencer::noOp_directiveHandler(
const FpySequencer_NoOpDirective& directive,
DirectiveError& error) {
208 Signal FpySequencer::getTlm_directiveHandler(
const FpySequencer_GetTlmDirective& directive,
DirectiveError& error) {
236 Runtime::SerializableReg& valueSerReg = this->m_runtime.serRegs[directive.getvalueDestSerReg()];
241 Runtime::SerializableReg& timeSerReg = this->m_runtime.serRegs[directive.gettimeDestSerReg()];
243 timeSerReg.valueSize = 0;
253 timeSerReg.valueSize = esb.getBuffLength();
257 Signal FpySequencer::getPrm_directiveHandler(
const FpySequencer_GetPrmDirective& directive,
DirectiveError& error) {
283 Runtime::SerializableReg& serReg = this->m_runtime.serRegs[directive.getdestSerRegIndex()];
289 Signal FpySequencer::cmd_directiveHandler(
const FpySequencer_CmdDirective& directive,
DirectiveError& error) {
298 stat = cmdBuf.
serialize(directive.getopCode());
317 static_cast<U32
>(((this->m_sequencesStarted & 0xFFFF) << 16) | (this->m_statementsDispatched & 0xFFFF));
328 Signal FpySequencer::deserSerReg_directiveHandler(
const FpySequencer_DeserSerRegDirective& directive,
338 Runtime::SerializableReg& serReg = this->m_runtime.serRegs[directive.getsrcSerRegIdx()];
339 if (directive.getsrcOffset() + directive.get_deserSize() > serReg.valueSize) {
346 esb.setBuffLen(serReg.valueSize);
354 switch (directive.get_deserSize()) {
358 reg(directive.getdestReg()) = oneByte;
363 reg(directive.getdestReg()) = twoBytes;
368 reg(directive.getdestReg()) = fourBytes;
373 reg(directive.getdestReg()) = eightBytes;
377 FW_ASSERT(0, static_cast<FwAssertArgType>(directive.get_deserSize()));
385 Signal FpySequencer::setReg_directiveHandler(
const FpySequencer_SetRegDirective& directive,
DirectiveError& error) {
390 reg(directive.getdest()) = directive.getvalue();
395 if (std::isunordered(lhs, rhs)) {
399 }
else if (std::isgreater(lhs, rhs)) {
401 }
else if (std::isless(lhs, rhs)) {
407 I64 FpySequencer::binaryRegOp_or(I64 lhs, I64 rhs) {
410 I64 FpySequencer::binaryRegOp_and(I64 lhs, I64 rhs) {
413 I64 FpySequencer::binaryRegOp_ieq(I64 lhs, I64 rhs) {
416 I64 FpySequencer::binaryRegOp_ine(I64 lhs, I64 rhs) {
419 I64 FpySequencer::binaryRegOp_ult(I64 lhs, I64 rhs) {
420 return static_cast<U64>(lhs) < static_cast<U64>(rhs);
422 I64 FpySequencer::binaryRegOp_ule(I64 lhs, I64 rhs) {
423 return static_cast<U64>(lhs) <= static_cast<U64>(rhs);
425 I64 FpySequencer::binaryRegOp_ugt(I64 lhs, I64 rhs) {
426 return static_cast<U64>(lhs) > static_cast<U64>(rhs);
428 I64 FpySequencer::binaryRegOp_uge(I64 lhs, I64 rhs) {
429 return static_cast<U64>(lhs) >= static_cast<U64>(rhs);
431 I64 FpySequencer::binaryRegOp_slt(I64 lhs, I64 rhs) {
434 I64 FpySequencer::binaryRegOp_sle(I64 lhs, I64 rhs) {
437 I64 FpySequencer::binaryRegOp_sgt(I64 lhs, I64 rhs) {
440 I64 FpySequencer::binaryRegOp_sge(I64 lhs, I64 rhs) {
443 I64 FpySequencer::binaryRegOp_feq(I64 lhs, I64 rhs) {
445 memcpy(&left, &lhs,
sizeof(left));
447 memcpy(&right, &rhs,
sizeof(right));
450 I64 FpySequencer::binaryRegOp_fne(I64 lhs, I64 rhs) {
452 memcpy(&left, &lhs,
sizeof(left));
454 memcpy(&right, &rhs,
sizeof(right));
457 return cmp != 0 && cmp != -2;
459 I64 FpySequencer::binaryRegOp_flt(I64 lhs, I64 rhs) {
461 memcpy(&left, &lhs,
sizeof(left));
463 memcpy(&right, &rhs,
sizeof(right));
466 I64 FpySequencer::binaryRegOp_fle(I64 lhs, I64 rhs) {
468 memcpy(&left, &lhs,
sizeof(left));
470 memcpy(&right, &rhs,
sizeof(right));
472 return cmp == 0 || cmp == -1;
474 I64 FpySequencer::binaryRegOp_fgt(I64 lhs, I64 rhs) {
476 memcpy(&left, &lhs,
sizeof(left));
478 memcpy(&right, &rhs,
sizeof(right));
481 I64 FpySequencer::binaryRegOp_fge(I64 lhs, I64 rhs) {
483 memcpy(&left, &lhs,
sizeof(left));
485 memcpy(&right, &rhs,
sizeof(right));
487 return cmp == 0 || cmp == 1;
490 Signal FpySequencer::binaryRegOp_directiveHandler(
const FpySequencer_BinaryRegOpDirective& directive,
502 I64 lhs = reg(directive.getlhs());
503 I64 rhs = reg(directive.getrhs());
504 I64& res = reg(directive.getres());
506 switch (directive.get_op()) {
508 res = this->binaryRegOp_or(lhs, rhs);
511 res = this->binaryRegOp_and(lhs, rhs);
514 res = this->binaryRegOp_ieq(lhs, rhs);
517 res = this->binaryRegOp_ine(lhs, rhs);
520 res = this->binaryRegOp_ult(lhs, rhs);
523 res = this->binaryRegOp_ule(lhs, rhs);
526 res = this->binaryRegOp_ugt(lhs, rhs);
529 res = this->binaryRegOp_uge(lhs, rhs);
532 res = this->binaryRegOp_slt(lhs, rhs);
535 res = this->binaryRegOp_sle(lhs, rhs);
538 res = this->binaryRegOp_sgt(lhs, rhs);
541 res = this->binaryRegOp_sge(lhs, rhs);
544 res = this->binaryRegOp_feq(lhs, rhs);
547 res = this->binaryRegOp_fne(lhs, rhs);
550 res = this->binaryRegOp_flt(lhs, rhs);
553 res = this->binaryRegOp_fle(lhs, rhs);
556 res = this->binaryRegOp_fgt(lhs, rhs);
559 res = this->binaryRegOp_fge(lhs, rhs);
567 I64 FpySequencer::unaryRegOp_not(I64 src) {
570 I64 FpySequencer::unaryRegOp_fpext(I64 src) {
573 I32 trunc =
static_cast<I32
>(src);
576 memcpy(&fsrc, &trunc,
sizeof(fsrc));
578 F64 ext =
static_cast<F64>(fsrc);
581 memcpy(&iext, &ext,
sizeof(iext));
584 I64 FpySequencer::unaryRegOp_fptrunc(I64 src) {
588 memcpy(&fsrc, &src,
sizeof(fsrc));
590 F32 trunc =
static_cast<F32>(fsrc);
593 memcpy(&itrunc, &trunc,
sizeof(itrunc));
595 return static_cast<I64
>(itrunc);
598 Signal FpySequencer::unaryRegOp_directiveHandler(
const FpySequencer_UnaryRegOpDirective& directive,
DirectiveError& error) {
608 I64 src = reg(directive.getsrc());
609 I64& res = reg(directive.getres());
611 switch (directive.get_op()) {
613 res = this->unaryRegOp_not(src);
616 res = this->unaryRegOp_fpext(src);
619 res = this->unaryRegOp_fptrunc(src);
628 Signal FpySequencer::exit_directiveHandler(
const FpySequencer_ExitDirective& directive,
DirectiveError& error) {
629 if (directive.getsuccess()) {
deser up to 8 bytes out of an serReg
Serialization/Deserialization operation was successful.
U8 * getBuffAddr()
gets buffer address for data filling
U32 getseconds() const
Get member seconds.
Svc::Fpy::Header & getheader()
Get member header.
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)
serialize 8-bit unsigned int
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.
U32 getuSeconds() const
Get member uSeconds.
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
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.
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