LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/logical - ccu_rep_not.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 90.0 % 20 18
Test Date: 2026-08-04 10:52:23 Functions: 100.0 % 3 3

            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_rep_v1.h"
      12              : #include "string_util.h"
      13              : #include "exception_util.h"
      14              : #include "ccu_api_exception.h"
      15              : #include "ccu_ins_generator_v1.h"
      16              : #include "ccu_kernel.h"
      17              : namespace hcomm {
      18              : namespace CcuRep {
      19              : 
      20            1 : CcuRepNot::CcuRepNot(CcuInsGeneratorBase* insGenPtr, const Variable &varC, const Variable &varB)
      21            1 :     : subType(NotSubType::VAR_EQUALS_NOT_VAR), varB(varB), varC(varC), insGenPtr(insGenPtr)
      22              : {
      23            1 :     type       = CcuRepType::NOT;
      24            1 :     instrCount = insGenPtr->GetInstrCount(type);
      25            1 : }
      26              : 
      27            1 : bool CcuRepNot::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &curInstrId, const TransDep &dep)
      28              : {
      29            1 :     Hccl::CHECK_NULLPTR(instr, "[CcuRepNot::Translate] instr is nullptr!");
      30            1 :     this->instrId = curInstrId;
      31            1 :     translated    = true;
      32            1 :     instrCount = insGenPtr->GetInstrCount(type);
      33            1 :     insGenPtr->CcuRepNotTranslate(ccuKernel, instr, this, dep);
      34            1 :     CHK_PRT_THROW((curInstrId > UINT16_MAX - instrCount),
      35              :         HCCL_ERROR("[CcuRepNot::Translate]uint16 integer overflow occurs, curInstrId = [%hu], instrCount = [%hu]", curInstrId, instrCount),
      36              :         Hccl::InternalException, "integer overflow");
      37            1 :     curInstrId += instrCount;
      38            1 :     return translated;
      39              : }
      40              : 
      41            1 : std::string CcuRepNot::Describe()
      42              : {
      43            1 :     switch (subType) {
      44            1 :         case NotSubType::VAR_EQUALS_NOT_VAR: {
      45            1 :             return Hccl::StringFormat("Variable[%u] = ~Variable[%u]", varC.Id(), varB.Id());
      46              :         }
      47            0 :         default: {
      48            0 :             return Hccl::StringFormat("Invalid Not");
      49              :         }
      50              :     }
      51              : }
      52              : 
      53              : }; // namespace CcuRep
      54              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1