LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/interface - ccu_datatype.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 83 83
Test Date: 2026-07-28 12:11:00 Functions: 100.0 % 30 30

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 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              : #include "ccu_datatype.h"
      11              : #include "ccu_rep.h"
      12              : #include "ccu_context_resource.h"
      13              : #include "ccu_interface_assist.h"
      14              : 
      15              : #include "exception_util.h"
      16              : #include "ccu_api_exception.h"
      17              : 
      18              : namespace Hccl {
      19              : namespace CcuRep {
      20              : 
      21         6144 : uint16_t CcuPhyRes::Id() const
      22              : {
      23         6144 :     return id;
      24              : }
      25          240 : uint16_t CcuPhyRes::DieId() const
      26              : {
      27          240 :     return dieId;
      28              : }
      29        30188 : void CcuPhyRes::Reset(uint16_t id)
      30              : {
      31        30188 :     this->id = id;
      32        30188 : }
      33        24356 : void CcuPhyRes::SetDieId(uint16_t dieId)
      34              : {
      35        24356 :     this->dieId = dieId;
      36        24356 : }
      37              : 
      38        71067 : CcuVirRes::CcuVirRes(CcuRepContext *context) : context(context)
      39              : {
      40        71067 :     phyRes = std::make_shared<CcuPhyRes>();
      41        71067 : }
      42              : 
      43         5833 : void CcuVirRes::Reset(uint16_t id)
      44              : {
      45         5833 :     phyRes->Reset(id);
      46         5833 : }
      47              : 
      48        24355 : void CcuVirRes::Reset(uint16_t id, uint16_t dieId)
      49              : {
      50        24355 :     phyRes->Reset(id);
      51        24355 :     phyRes->SetDieId(dieId);
      52        24355 : }
      53              : 
      54            1 : void CcuVirRes::SetDieId(uint16_t dieId)
      55              : {
      56            1 :     phyRes->SetDieId(dieId);
      57            1 : }
      58              : 
      59         5931 : uint16_t CcuVirRes::Id() const
      60              : {
      61         5931 :     return phyRes->Id();
      62              : }
      63              : 
      64           27 : uint16_t CcuVirRes::DieId() const
      65              : {
      66           27 :     return phyRes->DieId();
      67              : }
      68              : 
      69         9338 : Variable::Variable(CcuRepContext* context) : CcuVirRes(context)
      70              : {
      71         9338 : }
      72              : 
      73        29003 : Variable::Variable(const Variable& other): CcuVirRes(other.context)
      74              : {
      75        29003 :     phyRes = other.phyRes;
      76        29003 : }
      77              : 
      78          377 : void Variable::operator=(Variable&& other)
      79              : {
      80          377 :     phyRes = other.phyRes;
      81          377 :     context = other.context;
      82          377 : }
      83              : 
      84          181 : void Variable::operator=(const Variable &other)
      85              : {
      86          181 :     AppendToContext(context, std::make_shared<CcuRepAssign>(*this, other));
      87          181 : }
      88              : 
      89          201 : void Variable::operator=(uint64_t immediate)
      90              : {
      91          201 :     AppendToContext(context, std::make_shared<CcuRepAssign>(*this, immediate));
      92          201 : }
      93              : 
      94            1 : void Variable::operator=(CcuArithmeticOperator<Variable, Variable> op)
      95              : {
      96            1 :     AppendToContext(context, std::make_shared<CcuRepAdd>(*this, op.lhs, op.rhs));
      97            1 : }
      98              : 
      99           29 : void Variable::operator+=(const Variable &other)
     100              : {
     101           29 :     AppendToContext(context, std::make_shared<CcuRepAdd>(*this, other));
     102           29 : }
     103              : 
     104         3198 : Address::Address(CcuRepContext* context) : CcuVirRes(context)
     105              : {
     106         3198 : }
     107              : 
     108         7035 : Address::Address(const Address& other): CcuVirRes(other.context)
     109              : {
     110         7035 :     phyRes = other.phyRes;
     111         7035 : }
     112              : 
     113            2 : void Address::operator=(Address&& other)
     114              : {
     115            2 :     phyRes = other.phyRes;
     116            2 :     context = other.context;
     117            2 : }
     118              : 
     119            8 : void Address::operator=(const Address &other)
     120              : {
     121            8 :     AppendToContext(context, std::make_shared<CcuRepAssign>(*this, other));
     122            8 : }
     123              : 
     124          171 : void Address::operator=(const Variable &other)
     125              : {
     126          171 :     AppendToContext(context, std::make_shared<CcuRepAssign>(*this, other));
     127          171 : }
     128              : 
     129            1 : void Address::operator=(uint64_t immediate)
     130              : {
     131            1 :     AppendToContext(context, std::make_shared<CcuRepAssign>(*this, immediate));
     132            1 : }
     133              : 
     134            8 : void Address::operator=(CcuArithmeticOperator<Variable, Address> op)
     135              : {
     136            8 :     AppendToContext(context, std::make_shared<CcuRepAdd>(*this, op.rhs, op.lhs));
     137            8 : }
     138              : 
     139            1 : void Address::operator=(CcuArithmeticOperator<Address, Address> op)
     140              : {
     141            1 :     AppendToContext(context, std::make_shared<CcuRepAdd>(*this, op.lhs, op.rhs));
     142            1 : }
     143              : 
     144          508 : void Address::operator+=(const Variable &other)
     145              : {
     146          508 :     AppendToContext(context, std::make_shared<CcuRepAdd>(*this, other));
     147          508 : }
     148              : 
     149         2485 : MaskSignal::MaskSignal(CcuRepContext* context) : CcuVirRes(context)
     150              : {
     151         2485 : }
     152              : 
     153        17772 : CcuBuffer::CcuBuffer(CcuRepContext* context) : CcuVirRes(context)
     154              : {
     155        17772 : }
     156              : 
     157          213 : uint16_t CcuBuffer::Id() const
     158              : {
     159          213 :     return phyRes->Id() + CCUBUFFER_DIE_ID_BIT * phyRes->DieId();
     160              : }
     161              : 
     162         2236 : Executor::Executor(CcuRepContext* context) : CcuVirRes(context)
     163              : {
     164         2236 : }
     165              : 
     166              : }; // namespace CcuRep
     167              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1