Skip to content

Commit

Permalink
Generate q macro for QSS handler access.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinffernandez committed Nov 2, 2022
1 parent 64d0141 commit 33ce614
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/mmoc/generator/macros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ string Macros::engineIndex() const

void Macros::initialize()
{
stringstream index, def, state_index, state_def, init_code;
stringstream index, def, state_index, state_def, init_code, quantized_def;
int dim = _variable.dimensions();
bool idx = !_variable.isParameter() || dim;
const bool IS_STATE = _variable.isState();
Expand All @@ -139,8 +139,9 @@ void Macros::initialize()
}
if (!_variable.isEqType() && !_variable.isOutput()) {
_macros << "#define " << _variable << params << " ";
if (_variable.isState()) {
if (IS_STATE) {
_macros << "x";
quantized_def << "#define _q" << _variable << params << " q";
init_code << "#define _init" << _variable << params << " x";
}
if (_variable.isAlgebraic()) {
Expand Down Expand Up @@ -168,9 +169,13 @@ void Macros::initialize()
state_def << " * COEFF_MULTIPLIER(coeff)";
}
_macros << state_def.str() << endl;
if (_variable.isState()) {
if (IS_STATE) {
init_code << def.str() << endl;
_macros << init_code.str();
quantized_def << state_def.str() << endl;
if (_is_qss) {
_macros << quantized_def.str();
}
}
}

Expand Down

0 comments on commit 33ce614

Please sign in to comment.