LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/sync - ccu_rep_postsharedsem.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 15 15
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           11 :     CcuRepPostSharedSem::CcuRepPostSharedSem(const MaskSignal& sem, uint16_t mask) : sem(sem), mask(mask)
      19              :     {
      20           11 :         type = CcuRepType::POST_SHARED_SEM;
      21           11 :         instrCount = 1;
      22           11 :     }
      23              : 
      24           10 :     bool CcuRepPostSharedSem::Translate(CcuInstr*& instr, uint16_t& instrId, const TransDep& dep)
      25              :     {
      26           10 :         this->instrId = instrId;
      27           10 :         translated = true;
      28              : 
      29           10 :         if (sem.DieId() != dep.dieId) {
      30            5 :             SyncCKEInstr(instr++, sem.Id(), dep.reserveCkeId, mask, dep.reserveChannalId[1], 0, 0, 0, 0, 1);
      31              :         } else {
      32            5 :             SetCKEInstr(instr++, sem.Id(), mask, 0, 0, 1);
      33              :         }
      34           10 :         CHK_PRT_THROW(
      35              :             (instrId > UINT16_MAX - instrCount),
      36              :             HCCL_ERROR(
      37              :                 "[CcuRepPostSharedSem::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]",
      38              :                 instrId, instrCount),
      39              :             InternalException, "integer overflow");
      40           10 :         instrId += instrCount;
      41              : 
      42           10 :         return translated;
      43              :     }
      44              : 
      45           12 :     std::string CcuRepPostSharedSem::Describe()
      46              :     {
      47           12 :         return StringFormat("Post, Use semIndex[%u] and mask[%04x]", sem.Id(), mask);
      48              :     }
      49              : 
      50              : }; // namespace CcuRep
      51              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1