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: 50.0 % 108 54
Test Date: 2026-08-18 17:47:01 Functions: 50.0 % 54 27

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #include "ccu_operator_v1.h"
      12              : #include "ccu_datatype_v1.h"
      13              : 
      14              : namespace hcomm {
      15              : namespace CcuRep {
      16              : 
      17              :     template <>
      18          117 :     void CcuArithmeticOperator<Variable, Variable>::Check() const
      19              :     {
      20              :         // nothing
      21          117 :     }
      22              :     template <>
      23            3 :     void CcuArithmeticOperator<Variable, Address>::Check() const
      24              :     {
      25              :         // nothing
      26            3 :     }
      27              :     template <>
      28            5 :     void CcuArithmeticOperator<Variable, uint16_t>::Check() const
      29              :     {
      30              :         // nothing
      31            5 :     }
      32              :     template <>
      33            4 :     void CcuArithmeticOperator<Address, Address>::Check() const
      34              :     {
      35              :         // nothing
      36            4 :     }
      37              :     template <>
      38            2 :     void CcuArithmeticOperator<Address, uint16_t>::Check() const
      39              :     {
      40              :         // nothing
      41            2 :     }
      42              : 
      43              :     template <>
      44            6 :     void CcuRelationalOperator<Variable, uint64_t>::Check() const
      45              :     {
      46              :         // nothing
      47            6 :     }
      48              :     template <>
      49            0 :     void CcuRelationalOperator<Variable, Variable>::Check() const
      50              :     {
      51              :         // nothing
      52            0 :     }
      53              : 
      54          111 :     CcuArithmeticOperator<Variable, Variable> Variable::operator+(const Variable& varB) const
      55              :     {
      56          111 :         return CcuArithmeticOperator<Variable, Variable>(*this, varB, CcuArithmeticOperatorType::ADDITION);
      57              :     }
      58            1 :     CcuArithmeticOperator<Variable, Address> Variable::operator+(const Address& addrB) const
      59              :     {
      60            1 :         return CcuArithmeticOperator<Variable, Address>(*this, addrB, CcuArithmeticOperatorType::ADDITION);
      61              :     }
      62              : 
      63            1 :     CcuArithmeticOperator<Variable, uint16_t> Variable::operator+(const uint16_t offset) const
      64              :     {
      65            1 :         return CcuArithmeticOperator<Variable, uint16_t>(*this, offset, CcuArithmeticOperatorType::ADDITION);
      66              :     }
      67              : 
      68            3 :     CcuArithmeticOperator<Variable, Variable> Variable::operator*(const Variable& varB) const
      69              :     {
      70            3 :         return CcuArithmeticOperator<Variable, Variable>(*this, varB, CcuArithmeticOperatorType::MULTIPLICATION);
      71              :     }
      72            0 :     CcuArithmeticOperator<Variable, Address> Variable::operator*(const Address& addrB) const
      73              :     {
      74            0 :         return CcuArithmeticOperator<Variable, Address>(*this, addrB, CcuArithmeticOperatorType::MULTIPLICATION);
      75              :     }
      76            2 :     CcuArithmeticOperator<Variable, uint16_t> Variable::operator*(const uint16_t offset) const
      77              :     {
      78            2 :         return CcuArithmeticOperator<Variable, uint16_t>(*this, offset, CcuArithmeticOperatorType::MULTIPLICATION);
      79              :     }
      80              : 
      81            3 :     CcuArithmeticOperator<Variable, Variable> Variable::operator-(const Variable& varB) const
      82              :     {
      83            3 :         return CcuArithmeticOperator<Variable, Variable>(*this, varB, CcuArithmeticOperatorType::SUBTRACTION);
      84              :     }
      85            0 :     CcuArithmeticOperator<Variable, Address> Variable::operator-(const Address& addrB) const
      86              :     {
      87            0 :         return CcuArithmeticOperator<Variable, Address>(*this, addrB, CcuArithmeticOperatorType::SUBTRACTION);
      88              :     }
      89            2 :     CcuArithmeticOperator<Variable, uint16_t> Variable::operator-(const uint16_t offset) const
      90              :     {
      91            2 :         return CcuArithmeticOperator<Variable, uint16_t>(*this, offset, CcuArithmeticOperatorType::SUBTRACTION);
      92              :     }
      93              : 
      94            2 :     CcuArithmeticOperator<Variable, Address> Address::operator+(const Variable& varB) const
      95              :     {
      96            2 :         return CcuArithmeticOperator<Variable, Address>(varB, *this, CcuArithmeticOperatorType::ADDITION);
      97              :     }
      98            4 :     CcuArithmeticOperator<Address, Address> Address::operator+(const Address& addrB) const
      99              :     {
     100            4 :         return CcuArithmeticOperator<Address, Address>(*this, addrB, CcuArithmeticOperatorType::ADDITION);
     101              :     }
     102              : 
     103            2 :     CcuArithmeticOperator<Address, uint16_t> Address::operator+(const uint16_t offset) const
     104              :     {
     105            2 :         return CcuArithmeticOperator<Address, uint16_t>(*this, offset, CcuArithmeticOperatorType::ADDITION);
     106              :     }
     107              : 
     108            0 :     CcuArithmeticOperator<Variable, Address> Address::operator*(const Variable& varB) const
     109              :     {
     110            0 :         return CcuArithmeticOperator<Variable, Address>(varB, *this, CcuArithmeticOperatorType::MULTIPLICATION);
     111              :     }
     112            0 :     CcuArithmeticOperator<Address, Address> Address::operator*(const Address& addrB) const
     113              :     {
     114            0 :         return CcuArithmeticOperator<Address, Address>(*this, addrB, CcuArithmeticOperatorType::MULTIPLICATION);
     115              :     }
     116            0 :     CcuArithmeticOperator<Address, uint16_t> Address::operator*(const uint16_t offset) const
     117              :     {
     118            0 :         return CcuArithmeticOperator<Address, uint16_t>(*this, offset, CcuArithmeticOperatorType::MULTIPLICATION);
     119              :     }
     120              : 
     121            0 :     CcuArithmeticOperator<Variable, Address> Address::operator-(const Variable& varB) const
     122              :     {
     123            0 :         return CcuArithmeticOperator<Variable, Address>(varB, *this, CcuArithmeticOperatorType::SUBTRACTION);
     124              :     }
     125            0 :     CcuArithmeticOperator<Address, Address> Address::operator-(const Address& addrB) const
     126              :     {
     127            0 :         return CcuArithmeticOperator<Address, Address>(*this, addrB, CcuArithmeticOperatorType::SUBTRACTION);
     128              :     }
     129            0 :     CcuArithmeticOperator<Address, uint16_t> Address::operator-(const uint16_t offset) const
     130              :     {
     131            0 :         return CcuArithmeticOperator<Address, uint16_t>(*this, offset, CcuArithmeticOperatorType::SUBTRACTION);
     132              :     }
     133              : 
     134            3 :     CcuRelationalOperator<Variable, uint64_t> Variable::operator!=(uint64_t immediate) const
     135              :     {
     136            3 :         return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::NOT_EQUAL);
     137              :     }
     138              : 
     139            3 :     CcuRelationalOperator<Variable, uint64_t> Variable::operator==(uint64_t immediate) const
     140              :     {
     141            3 :         return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::EQUAL);
     142              :     }
     143              : 
     144            0 :     CcuRelationalOperator<Variable, uint64_t> Variable::operator<=(uint64_t immediate) const
     145              :     {
     146            0 :         return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::LESS_EQUAL);
     147              :     }
     148              : 
     149            0 :     CcuRelationalOperator<Variable, uint64_t> Variable::operator>(uint64_t immediate) const
     150              :     {
     151            0 :         return CcuRelationalOperator<Variable, uint64_t>(*this, immediate, CcuRelationalOperatorType::GREATER_THAN);
     152              :     }
     153              : 
     154            0 :     CcuRelationalOperator<Variable, Variable> Variable::operator<=(const Variable& varB) const
     155              :     {
     156            0 :         return CcuRelationalOperator<Variable, Variable>(*this, varB, CcuRelationalOperatorType::LESS_EQUAL);
     157              :     }
     158              : 
     159            0 :     CcuRelationalOperator<Variable, Variable> Variable::operator>(const Variable& varB) const
     160              :     {
     161            0 :         return CcuRelationalOperator<Variable, Variable>(*this, varB, CcuRelationalOperatorType::GREATER_THAN);
     162              :     }
     163              : 
     164              :     template <>
     165            6 :     void CcuLogicOperator<Variable, Variable>::Check() const
     166              :     {
     167              :         // nothing
     168            6 :     }
     169              : 
     170              :     template <>
     171            0 :     void CcuLogicOperator<Variable, Address>::Check() const
     172              :     {
     173              :         // nothing
     174            0 :     }
     175              : 
     176              :     template <>
     177            0 :     void CcuLogicOperator<Variable, uint64_t>::Check() const
     178              :     {
     179              :         // nothing
     180            0 :     }
     181              : 
     182              :     template <>
     183            0 :     void CcuLogicOperator<Address, Address>::Check() const
     184              :     {
     185              :         // nothing
     186            0 :     }
     187              : 
     188              :     template <>
     189            0 :     void CcuLogicOperator<Address, uint16_t>::Check() const
     190              :     {
     191              :         // nothing
     192            0 :     }
     193              : 
     194              :     template <>
     195            1 :     void CcuLogicOperator<Variable>::Check() const
     196              :     {
     197              :         // nothing
     198            1 :     }
     199              : 
     200              :     template <>
     201            0 :     void CcuLogicOperator<Address>::Check() const
     202              :     {
     203              :         // nothing
     204            0 :     }
     205              : 
     206            2 :     CcuLogicOperator<Variable, Variable> Variable::operator&(const Variable& varB) const
     207              :     {
     208            2 :         return CcuLogicOperator<Variable, Variable>(*this, varB, CcuLogicOperatorType::AND);
     209              :     }
     210              : 
     211            0 :     CcuLogicOperator<Variable, Address> Variable::operator&(const Address& addrB) const
     212              :     {
     213            0 :         return CcuLogicOperator<Variable, Address>(*this, addrB, CcuLogicOperatorType::AND);
     214              :     }
     215              : 
     216            2 :     CcuLogicOperator<Variable, Variable> Variable::operator|(const Variable& varB) const
     217              :     {
     218            2 :         return CcuLogicOperator<Variable, Variable>(*this, varB, CcuLogicOperatorType::OR);
     219              :     }
     220              : 
     221            0 :     CcuLogicOperator<Variable, Address> Variable::operator|(const Address& addrB) const
     222              :     {
     223            0 :         return CcuLogicOperator<Variable, Address>(*this, addrB, CcuLogicOperatorType::OR);
     224              :     }
     225              : 
     226            2 :     CcuLogicOperator<Variable, Variable> Variable::operator^(const Variable& varB) const
     227              :     {
     228            2 :         return CcuLogicOperator<Variable, Variable>(*this, varB, CcuLogicOperatorType::XOR);
     229              :     }
     230              : 
     231            0 :     CcuLogicOperator<Variable, Address> Variable::operator^(const Address& addrB) const
     232              :     {
     233            0 :         return CcuLogicOperator<Variable, Address>(*this, addrB, CcuLogicOperatorType::XOR);
     234              :     }
     235              : 
     236            1 :     CcuLogicOperator<Variable> Variable::operator~() const
     237              :     {
     238            1 :         return CcuLogicOperator<Variable>(*this, CcuLogicOperatorType::NOT);
     239              :     }
     240              : 
     241            0 :     CcuLogicOperator<Address, Address> Address::operator^(const Address& addrB) const
     242              :     {
     243            0 :         return CcuLogicOperator<Address, Address>(*this, addrB, CcuLogicOperatorType::XOR);
     244              :     }
     245              : 
     246            0 :     CcuLogicOperator<Variable, Address> Address::operator^(const Variable& varB) const
     247              :     {
     248            0 :         return CcuLogicOperator<Variable, Address>(varB, *this, CcuLogicOperatorType::XOR);
     249              :     }
     250              : 
     251            0 :     CcuLogicOperator<Address, Address> Address::operator&(const Address& addrB) const
     252              :     {
     253            0 :         return CcuLogicOperator<Address, Address>(*this, addrB, CcuLogicOperatorType::AND);
     254              :     }
     255              : 
     256            0 :     CcuLogicOperator<Variable, Address> Address::operator&(const Variable& varB) const
     257              :     {
     258            0 :         return CcuLogicOperator<Variable, Address>(varB, *this, CcuLogicOperatorType::AND);
     259              :     }
     260              : 
     261            0 :     CcuLogicOperator<Address, Address> Address::operator|(const Address& addrB) const
     262              :     {
     263            0 :         return CcuLogicOperator<Address, Address>(*this, addrB, CcuLogicOperatorType::OR);
     264              :     }
     265              : 
     266            0 :     CcuLogicOperator<Variable, Address> Address::operator|(const Variable& varB) const
     267              :     {
     268            0 :         return CcuLogicOperator<Variable, Address>(varB, *this, CcuLogicOperatorType::OR);
     269              :     }
     270              : 
     271              :     template <>
     272            4 :     void CcuShiftOperator<Variable, Variable>::Check() const
     273              :     {
     274              :         // nothing
     275            4 :     }
     276              : 
     277            2 :     CcuShiftOperator<Variable, Variable> Variable::operator>>(const Variable& other) const
     278              :     {
     279            2 :         return CcuShiftOperator<Variable, Variable>(*this, other, CcuShiftType::RIGHT);
     280              :     }
     281              : 
     282            2 :     CcuShiftOperator<Variable, Variable> Variable::operator<<(const Variable& other) const
     283              :     {
     284            2 :         return CcuShiftOperator<Variable, Variable>(*this, other, CcuShiftType::LEFT);
     285              :     }
     286              : 
     287              : }; // namespace CcuRep
     288              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1