LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_representation/reps/common - ccu_rep_store_var.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 20 20
Test Date: 2026-08-18 17:47:01 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.h"
      12              : #include "string_util.h"
      13              : 
      14              : namespace Hccl {
      15              : namespace CcuRep {
      16              : 
      17            4 :     CcuRepStoreVar::CcuRepStoreVar(const Variable& src, const Variable& var) : src(src), var(var)
      18              :     {
      19            4 :         type = CcuRepType::STORE;
      20            4 :         instrCount = 7; // 7: Store包含7条指令
      21            4 :     }
      22              : 
      23            4 :     bool CcuRepStoreVar::Translate(CcuInstr*& instr, uint16_t& instrId, const TransDep& dep)
      24              :     {
      25            4 :         this->instrId = instrId;
      26            4 :         translated = true;
      27            4 :         uint64_t varAddr = dep.xnBaseAddr + CCU_RESOURCE_XN_PER_SIZE * var.Id();
      28              : 
      29            4 :         LoadGSAXnInstr(instr++, dep.commGsa[0], dep.reserveGsaId, src.Id());
      30            4 :         LoadImdToGSAInstr(instr++, dep.commGsa[1], varAddr);
      31            4 :         LoadImdToXnInstr(instr++, dep.commXn[0], dep.memTokenInfo, CCU_LOAD_TO_XN_SEC_INFO);
      32            4 :         LoadImdToXnInstr(instr++, dep.commXn[1], dep.ccuResSpaceTokenInfo, CCU_LOAD_TO_XN_SEC_INFO);
      33            4 :         LoadImdToXnInstr(instr++, dep.commXn[2], CCU_RESOURCE_XN_PER_SIZE);
      34            4 :         TransLocMemToLocMemInstr(
      35            4 :             instr++, dep.commGsa[0], dep.commXn[0], dep.commGsa[1], dep.commXn[1], dep.commXn[2],
      36            4 :             dep.reserveChannalId[0], dep.commSignal, mask, 0, 0, 1, 1);
      37            4 :         SetCKEInstr(instr++, 0, 0, dep.commSignal, mask, 1);
      38            4 :         instrId += instrCount;
      39              : 
      40            4 :         return translated;
      41              :     }
      42              : 
      43            4 :     std::string CcuRepStoreVar::Describe() { return StringFormat("Store Var([%llu], [%u])", src.Id(), var.Id()); }
      44              : 
      45              : }; // namespace CcuRep
      46              : }; // namespace Hccl
        

Generated by: LCOV version 2.0-1