From 69c14debed0a9f60e5e275d6376a467b6d02a211 Mon Sep 17 00:00:00 2001 From: Arash Aletayeb Date: Sat, 29 May 2021 16:10:25 +0200 Subject: [PATCH] Quantizer convert to quint32 type cast --- developHw.pro.user | 2 +- include/model/hardware/core/TrxBoard.h | 6 +- .../sram/registerDefinition/RxParams.h | 4 +- .../sram/registerDefinition/RxParamsDegree.h | 8 +-- .../sram/registerDefinition/RxParamsPos.h | 6 +- .../sram/registerDefinition/TxParamsFocus.h | 6 +- .../core/general/Calculation.h | 2 +- src/model/hardware/core/TrxBoard.cpp | 68 +++++++++---------- .../core/general/Calculation.cpp | 4 +- 9 files changed, 50 insertions(+), 56 deletions(-) diff --git a/developHw.pro.user b/developHw.pro.user index de51c32..9420378 100644 --- a/developHw.pro.user +++ b/developHw.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/include/model/hardware/core/TrxBoard.h b/include/model/hardware/core/TrxBoard.h index 93c9038..d29c164 100644 --- a/include/model/hardware/core/TrxBoard.h +++ b/include/model/hardware/core/TrxBoard.h @@ -45,8 +45,8 @@ class TrxBoard : public QObject Q_OBJECT private: - QVector _swapVec; - QVector _signedQntzrVec; + QVector _swapVec; + QVector _unsignedQntzrVec; QList _unsignedQntzrList; QList* _mcsList; QList _afeModuleOffset; @@ -133,7 +133,7 @@ private: void setFpgaOffset(void); void setAfeModuleOffset(void); void scenParamsFilling(eScenParams cmd); - QList signedVector2unsignedList(QVector& sgnVec); + //QList signedVector2unsignedList(QVector& sgnVec); signals: void sendFramePacket(QByteArray newPacket); diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParams.h b/include/model/hardware/core/register/sram/registerDefinition/RxParams.h index b4c8d2a..b1f9a15 100644 --- a/include/model/hardware/core/register/sram/registerDefinition/RxParams.h +++ b/include/model/hardware/core/register/sram/registerDefinition/RxParams.h @@ -21,8 +21,8 @@ class RxParams : public Register { private: SramRx* _rx; - QVector rxActiveElementStepQ; - QVector r0PositionQ; + QVector rxActiveElementStepQ; + QVector r0PositionQ; void prepareData(quint32 index) override { diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h b/include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h index 4e200fe..a518239 100644 --- a/include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h +++ b/include/model/hardware/core/register/sram/registerDefinition/RxParamsDegree.h @@ -21,10 +21,10 @@ class RxParamsDegree : public Register { private: SramRx* _rx; - QVector thetaCosQ; - QVector thetaSinQ; - QVector phiCosQ; - QVector phiSinQ; + QVector thetaCosQ; + QVector thetaSinQ; + QVector phiCosQ; + QVector phiSinQ; void prepareData(quint32 index) override { diff --git a/include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h b/include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h index b0a78a7..6fdb88f 100644 --- a/include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h +++ b/include/model/hardware/core/register/sram/registerDefinition/RxParamsPos.h @@ -22,9 +22,9 @@ class RxParamsPos : public Register { private: SramRx* _rx; - QVector interceptXPosQ; - QVector interceptYPosQ; - QVector interceptZPosQ; + QVector interceptXPosQ; + QVector interceptYPosQ; + QVector interceptZPosQ; void prepareData(quint32 index) override { diff --git a/include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h b/include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h index 83c10fa..928fb26 100644 --- a/include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h +++ b/include/model/hardware/core/register/sram/registerDefinition/TxParamsFocus.h @@ -20,9 +20,9 @@ class TxParamsFocus : public Register { private: SramTx* _tx; - QVector txFocusXPosQ; - QVector txFocusYPosQ; - QVector txFocusZPosQ; + QVector txFocusXPosQ; + QVector txFocusYPosQ; + QVector txFocusZPosQ; void prepareData(quint32 index) override { diff --git a/include/model/scenarioGenerator/core/general/Calculation.h b/include/model/scenarioGenerator/core/general/Calculation.h index a2ab6c5..6bf134c 100644 --- a/include/model/scenarioGenerator/core/general/Calculation.h +++ b/include/model/scenarioGenerator/core/general/Calculation.h @@ -45,7 +45,7 @@ public: float pointDax, QList shotWeight); - static QVector qntzr(QVector data, + static QVector qntzr(QVector data, quint32 sign, quint32 wordlength, quint32 fractionalLength, diff --git a/src/model/hardware/core/TrxBoard.cpp b/src/model/hardware/core/TrxBoard.cpp index 63a8373..07ddb47 100644 --- a/src/model/hardware/core/TrxBoard.cpp +++ b/src/model/hardware/core/TrxBoard.cpp @@ -84,18 +84,18 @@ void TrxBoard::setFpgaOffset() _fpgaOffset << 0x100000 << 0x200000 << 0x300000; } -QList TrxBoard::signedVector2unsignedList (QVector& sgnVec) -{ - _unsignedQntzrList.clear(); -// std::list _usgnList (sgnVec.begin(), sgnVec.end()); -// _unsignedQntzrList.fromStdList(_usgnList); - foreach (auto i, sgnVec) - { - _unsignedQntzrList.push_back(static_cast(i)); - } - - return _unsignedQntzrList; -} +//QList TrxBoard::signedVector2unsignedList (QVector& sgnVec) +//{ +// _unsignedQntzrList.clear(); +//// std::list _usgnList (sgnVec.begin(), sgnVec.end()); +//// _unsignedQntzrList.fromStdList(_usgnList); +// foreach (auto i, sgnVec) +// { +// _unsignedQntzrList.push_back(static_cast(i)); +// } + +// return _unsignedQntzrList; +//} TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(0x800000) { @@ -293,8 +293,8 @@ void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) QList y; QList z; - _signedQntzrVec.clear(); - _signedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->xPosition, + //_signedQntzrVec.clear(); + _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->xPosition, 1, 18, 0, @@ -302,11 +302,10 @@ void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) true, true, true); - //QList xPosQ = _unsignedQntzrVec.toList(); - QList xPosQ = signedVector2unsignedList(_signedQntzrVec); + QList xPosQ = _unsignedQntzrVec.toList(); + //QList xPosQ = signedVector2unsignedList(_signedQntzrVec); - _signedQntzrVec.clear(); - _signedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->yPosition, + _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->yPosition, 1, 18, 0, @@ -314,10 +313,9 @@ void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) true, true, true); - QList yPosQ = signedVector2unsignedList(_signedQntzrVec); + QList yPosQ = _unsignedQntzrVec.toList(); - _signedQntzrVec.clear(); - _signedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->zPosition, + _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->elementPosition->zPosition, 0, 17, 0, @@ -325,7 +323,7 @@ void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) true, true, true); - QList zPosQ = signedVector2unsignedList(_signedQntzrVec); + QList zPosQ = _unsignedQntzrVec.toList(); for(quint8 i = 0; i < 3; i++) { @@ -397,24 +395,22 @@ void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) this->_dsp->receiverConfigurationLut(scenParams->hwRegister->receiverConfigTypeNumber, scenParams->hwRegister->configLut); - _signedQntzrVec.clear(); - _signedQntzrVec = Calculation::qntzr(scenParams->hwRegister->freqLut, 0, 24, 0, 0, true); - QList freqLutQ = signedVector2unsignedList(_signedQntzrVec); + _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->freqLut, 0, 24, 0, 0, true); + QList freqLutQ = _unsignedQntzrVec.toList(); this->_dsp->frequencyLut(freqLutQ); - _signedQntzrVec.clear(); - _signedQntzrVec = Calculation::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false); - QList dtgcLutQ = signedVector2unsignedList(_signedQntzrVec); + _unsignedQntzrVec = Calculation::qntzr(scenParams->hwRegister->dtgcLut, 0, 12, 8, 0, true, false); + QList dtgcLutQ = _unsignedQntzrVec.toList(); this->_dsp->dtgcLut(dtgcLutQ); QList temp; QList > blendWeightQ; - _signedQntzrVec.clear(); + //_signedQntzrVec.clear(); foreach(auto vec, scenParams->hwRegister->blendWeight) { temp.clear(); - _signedQntzrVec = Calculation::qntzr(vec, 0, 9, 8, 0, true, false, true); - temp = signedVector2unsignedList(_signedQntzrVec); + _unsignedQntzrVec = Calculation::qntzr(vec, 0, 9, 8, 0, true, false, true); + temp = _unsignedQntzrVec.toList(); blendWeightQ.push_back(temp); } this->_dsp->blendWeight(blendWeightQ); @@ -458,9 +454,8 @@ void TrxBoard::setScenario (ScenGenHardwareOutput* scenParams) void TrxBoard::setLineFilterCoefficient(QVector& lineFilterLut) { - _signedQntzrVec.clear(); - _signedQntzrVec = Calculation::qntzr(lineFilterLut, 0, 9, 8, 0, true, false); - QList lineFilterLutQ = signedVector2unsignedList(_signedQntzrVec); + _unsignedQntzrVec = Calculation::qntzr(lineFilterLut, 0, 9, 8, 0, true, false); + QList lineFilterLutQ = _unsignedQntzrVec.toList(); this->_dsp->lineFilterCoefficient(lineFilterLutQ); } @@ -497,9 +492,8 @@ void TrxBoard::setMetaData(const QByteArray metaData) const void TrxBoard::setDtgcLut(QVector& dtgcLut) { - _signedQntzrVec.clear(); - _signedQntzrVec = Calculation::qntzr(dtgcLut, 0, 12, 8, 0, true, false); - QList dtgcLutQ = signedVector2unsignedList(_signedQntzrVec); + _unsignedQntzrVec = Calculation::qntzr(dtgcLut, 0, 12, 8, 0, true, false); + QList dtgcLutQ = _unsignedQntzrVec.toList(); this->_dsp->dtgcLut(dtgcLutQ); } diff --git a/src/model/scenarioGenerator/core/general/Calculation.cpp b/src/model/scenarioGenerator/core/general/Calculation.cpp index 989f58b..d056d62 100644 --- a/src/model/scenarioGenerator/core/general/Calculation.cpp +++ b/src/model/scenarioGenerator/core/general/Calculation.cpp @@ -273,7 +273,7 @@ QVector > Calculation::blendCoeff(ScenGenUserParameters_t input, * @return */ /*************************************************************************************************/ -QVector Calculation::qntzr(QVector data, +QVector Calculation::qntzr(QVector data, quint32 sign, quint32 wordLength, quint32 fractionalLength, @@ -315,7 +315,7 @@ QVector Calculation::qntzr(QVector data, } } - QVector output; + QVector output; if(integerOutput) { for(auto i = 0; i < data.length(); i++)