LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/arithmetic - ccu_operator.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 25.9 % 108 28
Test Date: 2026-07-28 12:11:00 Functions: 25.9 % 54 14

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
       3              :  * Description: ccu representation datatype implementation file
       4              :  * Author: sunzhepeng
       5              :  * Create: 2024-07-06
       6              :  */
       7              : 
       8              : #include "ccu_operator_v1.h"
       9              : #include "ccu_datatype_v1.h"
      10              : 
      11              : namespace hcomm {
      12              : namespace CcuRep {
      13              : 
      14           56 : template <> void CcuArithmeticOperator<Variable, Variable>::Check() const
      15              : {
      16              :     // nothing
      17           56 : }
      18            3 : template <> void CcuArithmeticOperator<Variable, Address>::Check() const
      19              : {
      20              :     // nothing
      21            3 : }
      22            0 : template <> void CcuArithmeticOperator<Variable, uint16_t>::Check() const
      23              : {
      24              :     // nothing
      25            0 : }
      26            3 : template <> void CcuArithmeticOperator<Address, Address>::Check() const
      27              : {
      28              :     // nothing
      29            3 : }
      30            1 : template <> void CcuArithmeticOperator<Address, uint16_t>::Check() const
      31              : {
      32              :     // nothing
      33            1 : }
      34              : 
      35            6 : template <> void CcuRelationalOperator<Variable, uint64_t>::Check() const
      36              : {
      37              :     // nothing
      38            6 : }
      39            0 : template <> void CcuRelationalOperator<Variable, Variable>::Check() const
      40              : {
      41              :     // nothing
      42            0 : }
      43              : 
      44           54 : CcuArithmeticOperator<Variable, Variable> Variable::operator+(const Variable &varB) const
      45              : {
      46           54 :     return CcuArithmeticOperator<Variable, Variable>(*this, varB, CcuArithmeticOperatorType::ADDITION);
      47              : }
      48            1 : CcuArithmeticOperator<Variable, Address> Variable::operator+(const Address &addrB) const
      49              : {
      50            1 :     return CcuArithmeticOperator<Variable, Address>(*this, addrB, CcuArithmeticOperatorType::ADDITION);
      51              : }
      52              : 
      53            0 : CcuArithmeticOperator<Variable, uint16_t> Variable::operator+(const uint16_t offset) const
      54              : {
      55            0 :     return CcuArithmeticOperator<Variable, uint16_t>(*this, offset, CcuArithmeticOperatorType::ADDITION);
      56              : }
      57              : 
      58            1 : CcuArithmeticOperator<Variable, Variable> Variable::operator*(const Variable &varB) const
      59              : {
      60            1 :     return CcuArithmeticOperator<Variable, Variable>(*this, varB, CcuArithmeticOperatorType::MULTIPLICATION);
      61              : }
      62            0 : CcuArithmeticOperator<Variable, Address> Variable::operator*(const Address &addrB) const
      63              : {
      64            0 :     return CcuArithmeticOperator<Variable, Address>(*this, addrB, CcuArithmeticOperatorType::MULTIPLICATION);
      65              : }
      66            0 : CcuArithmeticOperator<Variable, uint16_t> Variable::operator*(const uint16_t offset) const
      67              : {
      68            0 :     return CcuArithmeticOperator<Variable, uint16_t>(*this, offset, CcuArithmeticOperatorType::MULTIPLICATION);
      69              : }
      70              : 
      71            1 : CcuArithmeticOperator<Variable, Variable> Variable::operator-(const Variable &varB) const
      72              : {
      73            1 :     return CcuArithmeticOperator<Variable, Variable>(*this, varB, CcuArithmeticOperatorType::SUBTRACTION);
      74              : }
      75            0 : CcuArithmeticOperator<Variable, Address> Variable::operator-(const Address &addrB) const
      76              : {
      77            0 :     return CcuArithmeticOperator<Variable, Address>(*this, addrB, CcuArithmeticOperatorType::SUBTRACTION);
      78              : }
      79            0 : CcuArithmeticOperator<Variable, uint16_t> Variable::operator-(const uint16_t offset) const
      80              : {
      81            0 :     return CcuArithmeticOperator<Variable, uint16_t>(*this, offset, CcuArithmeticOperatorType::SUBTRACTION);
      82              : }
      83              : 
      84            2 : CcuArithmeticOperator<Variable, Address> Address::operator+(const Variable &varB) const
      85              : {
      86            2 :     return CcuArithmeticOperator<Variable, Address>(varB, *this, CcuArithmeticOperatorType::ADDITION);
      87              : }
      88            3 : CcuArithmeticOperator<Address, Address> Address::operator+(const Address &addrB) const
      89              : {
      90            3 :     return CcuArithmeticOperator<Address, Address>(*this, addrB, CcuArithmeticOperatorType::ADDITION);
      91              : }
      92              : 
      93            1 : CcuArithmeticOperator<Address, uint16_t> Address::operator+(const uint16_t offset) const
      94              : {
      95            1 :     return CcuArithmeticOperator<Address, uint16_t>(*this, offset, CcuArithmeticOperatorType::ADDITION);
      96              : }
      97              : 
      98            0 : CcuArithmeticOperator<Variable, Address> Address::operator*(const Variable &varB) const
      99              : {
     100            0 :     return CcuArithmeticOperator<Variable, Address>(varB, *this, CcuArithmeticOperatorType::MULTIPLICATION);
     101              : }
     102            0 : CcuArithmeticOperator<Address, Address> Address::operator*(const Address &addrB) const
     103              : {
     104            0 :     return CcuArithmeticOperator<Address, Address>(*this, addrB, CcuArithmeticOperatorType::MULTIPLICATION);
     105              : }
     106            0 : CcuArithmeticOperator<Address, uint16_t> Address::operator*(const uint16_t offset) const
     107              : {
     108            0 :     return CcuArithmeticOperator<Address, uint16_t>(*this, offset, CcuArithmeticOperatorType::MULTIPLICATION);
     109              : }
     110              : 
     111            0 : CcuArithmeticOperator<Variable, Address> Address::operator-(const Variable &varB) const
     112              : {
     113            0 :     return CcuArithmeticOperator<Variable, Address>(varB, *this, CcuArithmeticOperatorType::SUBTRACTION);
     114              : }
     115            0 : CcuArithmeticOperator<Address, Address> Address::operator-(const Address &addrB) const
     116              : {
     117            0 :     return CcuArithmeticOperator<Address, Address>(*this, addrB, CcuArithmeticOperatorType::SUBTRACTION);
     118              : }
     119            0 : CcuArithmeticOperator<Address, uint16_t> Address::operator-(const uint16_t offset) const
     120              : {
     121            0 :     return CcuArithmeticOperator<Address, uint16_t>(*this, offset, CcuArithmeticOperatorType::SUBTRACTION);
     122              : }
     123              : 
     124            3 : CcuRelationalOperator<Variable, uint64_t> Variable::operator!=(uint64_t immediate) const
     125              : {
     126            3 :     return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::NOT_EQUAL);
     127              : }
     128              : 
     129            3 : CcuRelationalOperator<Variable, uint64_t> Variable::operator==(uint64_t immediate) const
     130              : {
     131            3 :     return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::EQUAL);
     132              : }
     133              : 
     134            0 : CcuRelationalOperator<Variable, uint64_t> Variable::operator<=(uint64_t immediate) const
     135              : {
     136            0 :     return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::LESS_EQUAL);
     137              : }
     138              : 
     139            0 : CcuRelationalOperator<Variable, uint64_t> Variable::operator>(uint64_t immediate) const
     140              : {
     141            0 :     return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::GREATER_THAN);
     142              : }
     143              : 
     144            0 : CcuRelationalOperator<Variable, Variable> Variable::operator<=(const Variable &varB) const
     145              : {
     146            0 :     return CcuRelationalOperator<Variable, Variable>(*this, varB, CcuRelationalOperatorType::LESS_EQUAL);
     147              : }
     148              : 
     149            0 : CcuRelationalOperator<Variable, Variable> Variable::operator>(const Variable &varB) const
     150              : {
     151            0 :     return CcuRelationalOperator<Variable, Variable>(*this, varB, CcuRelationalOperatorType::GREATER_THAN);
     152              : }
     153              : 
     154            0 : template <> void CcuLogicOperator<Variable, Variable>::Check() const
     155              : {
     156              :     // nothing
     157            0 : }
     158              :  
     159            0 : template <> void CcuLogicOperator<Variable, Address>::Check() const
     160              : {
     161              :     // nothing
     162            0 : }
     163              :  
     164            0 : template <> void CcuLogicOperator<Variable, uint64_t>::Check() const
     165              : {
     166              :     // nothing
     167            0 : }
     168              :  
     169            0 : template <> void CcuLogicOperator<Address, Address>::Check() const
     170              : {
     171              :     // nothing
     172            0 : }
     173              :  
     174            0 : template <> void CcuLogicOperator<Address, uint16_t>::Check() const
     175              : {
     176              :     // nothing
     177            0 : }
     178              :  
     179            0 : template <> void CcuLogicOperator<Variable>::Check() const
     180              : {
     181              :     // nothing
     182            0 : }
     183              :  
     184            0 : template <> void CcuLogicOperator<Address>::Check() const
     185              : {
     186              :     // nothing
     187            0 : }
     188              :  
     189            0 : CcuLogicOperator<Variable, Variable> Variable::operator&(const Variable &varB) const
     190              : {
     191            0 :     return CcuLogicOperator<Variable, Variable>(*this, varB, CcuLogicOperatorType::AND);
     192              : }
     193              :  
     194            0 : CcuLogicOperator<Variable, Address> Variable::operator&(const Address &addrB) const
     195              : {
     196            0 :     return CcuLogicOperator<Variable, Address>(*this, addrB, CcuLogicOperatorType::AND);
     197              : }
     198              :  
     199            0 : CcuLogicOperator<Variable, Variable> Variable::operator|(const Variable &varB) const
     200              : {
     201            0 :     return CcuLogicOperator<Variable, Variable>(*this, varB, CcuLogicOperatorType::OR);
     202              : }
     203              :  
     204            0 : CcuLogicOperator<Variable, Address> Variable::operator|(const Address &addrB) const
     205              : {
     206            0 :     return CcuLogicOperator<Variable, Address>(*this, addrB, CcuLogicOperatorType::OR);
     207              : }
     208              :  
     209            0 : CcuLogicOperator<Variable, Variable> Variable::operator^(const Variable &varB) const
     210              : {
     211            0 :     return CcuLogicOperator<Variable, Variable>(*this, varB, CcuLogicOperatorType::XOR);
     212              : }
     213              :  
     214            0 : CcuLogicOperator<Variable, Address> Variable::operator^(const Address &addrB) const
     215              : {
     216            0 :     return CcuLogicOperator<Variable, Address>(*this, addrB, CcuLogicOperatorType::XOR);
     217              : }
     218              :  
     219            0 : CcuLogicOperator<Variable> Variable::operator~() const
     220              : {
     221            0 :     return CcuLogicOperator<Variable>(*this, CcuLogicOperatorType::NOT);
     222              : }
     223              :  
     224            0 : CcuLogicOperator<Address, Address> Address::operator^(const Address &addrB) const
     225              : {
     226            0 :     return CcuLogicOperator<Address, Address>(*this, addrB, CcuLogicOperatorType::XOR);
     227              : }
     228              : 
     229            0 : CcuLogicOperator<Variable, Address> Address::operator^(const Variable &varB) const
     230              : {
     231            0 :     return CcuLogicOperator<Variable, Address>(varB, *this, CcuLogicOperatorType::XOR);
     232              : }
     233              :  
     234            0 : CcuLogicOperator<Address, Address> Address::operator&(const Address &addrB) const
     235              : {
     236            0 :     return CcuLogicOperator<Address, Address>(*this, addrB, CcuLogicOperatorType::AND);
     237              : }
     238              :  
     239            0 : CcuLogicOperator<Variable, Address> Address::operator&(const Variable &varB) const
     240              : {
     241            0 :     return CcuLogicOperator<Variable, Address>(varB, *this,CcuLogicOperatorType::AND);
     242              : }
     243              :  
     244            0 : CcuLogicOperator<Address, Address> Address::operator|(const Address &addrB) const
     245              : {
     246            0 :     return CcuLogicOperator<Address, Address>(*this, addrB, CcuLogicOperatorType::OR);
     247              : }
     248              :  
     249            0 : CcuLogicOperator<Variable, Address> Address::operator|(const Variable &varB) const
     250              : {
     251            0 :     return CcuLogicOperator<Variable, Address>(varB, *this, CcuLogicOperatorType::OR);
     252              : }
     253              : 
     254            0 : template <> void CcuShiftOperator<Variable, Variable>::Check() const
     255              : {
     256              :     // nothing
     257            0 : }
     258              : 
     259            0 : CcuShiftOperator<Variable, Variable> Variable::operator>>(const Variable &other) const
     260              : {
     261            0 :     return CcuShiftOperator<Variable, Variable>(*this, other, CcuShiftType::RIGHT);
     262              : }
     263              : 
     264            0 : CcuShiftOperator<Variable, Variable> Variable::operator<<(const Variable &other) const
     265              : {
     266            0 :     return CcuShiftOperator<Variable, Variable>(*this, other, CcuShiftType::LEFT);
     267              : }
     268              : 
     269              : }; // namespace CcuRep
     270              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1