Line data Source code
1 : /*
2 : * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
3 : * Description: ccu representation implementation file
4 : * Author: sunzhepeng
5 : * Create: 2024-06-17
6 : */
7 :
8 : #include "ccu_rep_v1.h"
9 : #include "string_util.h"
10 : #include "exception_util.h"
11 : #include "ccu_api_exception.h"
12 : #include "hcomm_c_adpt.h"
13 : #include "ccu_ins_generater_v1.h"
14 : #include "../../../../endpoint_pairs/channels/ccu/ccu_urma_channel.h"
15 : #include "ccu_kernel.h"
16 :
17 : namespace hcomm {
18 : namespace CcuRep {
19 :
20 5 : CcuRepRemPostVar::CcuRepRemPostVar(CcuInsGeneraterBase* insGenPtr, Variable param, const ChannelHandle channel, uint16_t paramIndex,
21 5 : uint16_t semIndex, uint16_t mask)
22 5 : : insGenPtr(insGenPtr), param(param), channel(channel), paramIndex(paramIndex), semIndex(semIndex), mask(mask)
23 : {
24 5 : type = CcuRepType::REM_POST_VAR;
25 5 : instrCount = insGenPtr->GetInstrCount(type);
26 5 : }
27 :
28 5 : bool CcuRepRemPostVar::Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
29 : {
30 5 : this->instrId = instrId;
31 5 : translated = true;
32 :
33 5 : insGenPtr->CcuRepRemPostVarTranslate(ccuKernel, instr, this);
34 5 : CHK_PRT_THROW((instrId > UINT16_MAX - instrCount),
35 : HCCL_ERROR("[CcuRepRemPostVar::Translate]uint16 integer overflow occurs, instrId = [%hu], instrCount = [%hu]", instrId, instrCount),
36 : Hccl::InternalException, "integer overflow");
37 5 : instrId += instrCount;
38 :
39 5 : return translated;
40 : }
41 :
42 5 : std::string CcuRepRemPostVar::Describe()
43 : {
44 10 : return Hccl::StringFormat("Post Variable[%u] To ParamIndex[%u], Use semIndex[%u] and mask[%04x]", param.Id(), paramIndex,
45 5 : semIndex, mask);
46 : }
47 :
48 : }; // namespace CcuRep
49 : }; // namespace hcomm
|