LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/sync - ccu_rep_rempostsem.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 18 18
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 3 3

            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              : 
      11              : #include "ccu_rep.h"
      12              : 
      13              : #include "string_util.h"
      14              : 
      15              : namespace Hccl {
      16              : namespace CcuRep {
      17              : 
      18           26 :     CcuRepRemPostSem::CcuRepRemPostSem(const CcuTransport& transport, uint16_t semIndex, uint16_t mask, bool single)
      19           26 :         : transport(transport),
      20           26 :           semIndex(semIndex),
      21           26 :           mask(mask),
      22           26 :           single(single)
      23              :     {
      24           26 :         type = CcuRepType::REM_POST_SEM;
      25           26 :         instrCount = 1;
      26           26 :     }
      27              : 
      28           25 :     bool CcuRepRemPostSem::Translate(CcuInstr*& instr, uint16_t& instrId, const TransDep& dep)
      29              :     {
      30           25 :         this->instrId = instrId;
      31           25 :         translated = true;
      32              : 
      33           25 :         auto ckeId = single ? transport.GetRmtCkeByIndex(semIndex) : transport.GetRmtCntCkeByIndex(semIndex);
      34           25 :         SyncCKEInstr(instr++, ckeId, dep.reserveCkeId, mask, transport.GetChannelId(), 0, 0, 0, 0, 1);
      35           25 :         CHK_PRT_THROW(
      36              :             (instrId > UINT16_MAX - instrCount),
      37              :             HCCL_ERROR(
      38              :                 "[CcuRepRemPostSem::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]",
      39              :                 instrId, instrCount),
      40              :             InternalException, "integer overflow");
      41           25 :         instrId += instrCount;
      42              : 
      43           25 :         return translated;
      44              :     }
      45              : 
      46           25 :     std::string CcuRepRemPostSem::Describe()
      47              :     {
      48           25 :         return StringFormat("Post, Use semIndex[%u] and mask[%04x]", semIndex, mask);
      49              :     }
      50              : 
      51              : }; // namespace CcuRep
      52              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1