LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_representation/reps/sync - ccu_rep_loc_record_event.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 14 14
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_loc_record_event.h"
      12              : #include <climits>
      13              : #include "exception_util.h"
      14              : #include "ccu_api_exception.h"
      15              : #include "ccu_ins_generater_base.h"
      16              : 
      17              : namespace hcomm {
      18              : namespace CcuRep {
      19              : 
      20            8 : CcuRepLocRecordEvent::CcuRepLocRecordEvent(CcuInsGeneraterBase* insGenPtr, const CompletedEvent &event, uint32_t mask)
      21            8 :     : insGenPtr(insGenPtr), event_(event), mask_(mask)
      22              : {
      23            8 :     type       = CcuRepType::LOC_RECORD_EVENT;
      24            8 :     instrCount = insGenPtr->GetInstrCount(type);
      25            8 : }
      26              : 
      27            6 : bool CcuRepLocRecordEvent::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
      28              : {
      29            6 :     this->instrId = instrId;
      30            6 :     translated    = true;
      31              : 
      32            6 :     insGenPtr->CcuRepLocRecordEventTranslate(ccuKernel, instr, this);
      33              :     
      34            6 :     CHK_PRT_THROW(instrId > USHRT_MAX - instrCount,
      35              :         HCCL_ERROR("[CcuRepLocRecordEvent][Translate] instrId[%u] + instrCount[%u] "
      36              :             "exceeds the maximum value of unsigned short int.", instrId, instrCount),
      37              :         Hccl::CcuApiException, "integer overflow");
      38              : 
      39            6 :     instrId += instrCount;
      40            6 :     return translated;
      41              : }
      42              : 
      43            6 : std::string CcuRepLocRecordEvent::Describe()
      44              : {
      45            6 :     return Hccl::StringFormat("CcuRepLocRecordEvent=id[%u], mask[%04x]", event_.Id(), mask_);
      46              : }
      47              : 
      48              : }; // namespace CcuRep
      49              : }; // namespace hcomm
        

Generated by: LCOV version 2.0-1