bool32.rising trigger
frac32.bipolar time A (v0..v1)
frac32.bipolar time B (v1..v2)
frac32.bipolar time C (v2..v3)
frac32.positive output
int32.positive phase index
frac32.u.map v0
frac32.u.map v1
frac32.u.map v2
frac32.u.map v3
frac32.s.map.klineartime.exp tA
frac32.s.map.klineartime.exp tB
frac32.s.map.klineartime.exp tC
int32_t val;
int32_t time1;
int32_t phase1;
int32_t ntrig;
phase1 = 0;
val = 0;
ntrig = 0;
if ((inlet_trig > 0) && (!ntrig)) {
time1 = 0;
phase1 = 1;
val = param_v0;
ntrig = 1;
} else if (phase1 == 1) {
int32_t t;
int32_t tA2 = param_tA + inlet_tA;
MTOF(-tA2, t);
time1 += t >> 2;
if (time1 >= 0)
val = param_v0 + (___SMMUL(param_v1 - param_v0, time1) << 1);
else {
phase1 = 2;
val = param_v1;
time1 = 0;
}
} else if (phase1 == 2) {
int32_t t;
int32_t tB2 = param_tB + inlet_tB;
MTOF(-tB2, t);
time1 += t >> 2;
if (time1 >= 0)
val = param_v1 + (___SMMUL(param_v2 - param_v1, time1) << 1);
else {
phase1 = 3;
val = param_v2;
time1 = 0;
}
} else if (phase1 == 3) {
int32_t t;
int32_t tC2 = param_tC + inlet_tC;
MTOF(-tC2, t);
time1 += t >> 2;
if (time1 >= 0)
val = param_v2 + (___SMMUL(param_v3 - param_v2, time1) << 1);
else {
phase1 = 0;
val = param_v3;
}
}
if (!(inlet_trig > 0))
ntrig = 0;
outlet_out = val;
outlet_phase = phase1;