LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/sync - ccu_rep_locpostsem.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 15 15
Test Date: 2026-07-28 12:11:00 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              : #include <climits>
      13              : 
      14              : #include "string_util.h"
      15              : 
      16              : namespace Hccl {
      17              : namespace CcuRep {
      18              : 
      19           13 : CcuRepLocPostSem::CcuRepLocPostSem(const MaskSignal &sem, uint16_t mask) : sem(sem), mask(mask)
      20              : {
      21           13 :     type       = CcuRepType::LOC_POST_SEM;
      22           13 :     instrCount = 1;
      23           13 : }
      24              : 
      25           11 : bool CcuRepLocPostSem::Translate(CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
      26              : {
      27           11 :     this->instrId = instrId;
      28           11 :     translated    = true;
      29              : 
      30           11 :     SetCKEInstr(instr++, sem.Id(), mask, 0, 0, 1);
      31              : 
      32           11 :     if (instrId > USHRT_MAX - instrCount) {
      33            1 :         THROW<InternalException>(StringFormat("[CcuRepLocPostSem][Translate] instrId[%u] + instrCount[%u] exceeds the "
      34            1 :             "maximum value of unsigned short int.", instrId, instrCount));
      35              :     }
      36           10 :     instrId += instrCount;
      37              : 
      38           10 :     return translated;
      39              : }
      40              : 
      41           11 : std::string CcuRepLocPostSem::Describe()
      42              : {
      43           11 :     return StringFormat("Set Sem[%u], mask[%04x]", sem.Id(), mask);
      44              : }
      45              : 
      46              : }; // namespace CcuRep
      47              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1