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 36 : CcuRepBufLocWrite::CcuRepBufLocWrite(CcuBuffer src, Memory dst, Variable len, MaskSignal sem, uint16_t mask)
19 36 : : src(src), dst(dst), len(len), sem(sem), mask(mask)
20 : {
21 36 : type = CcuRepType::BUF_LOC_WRITE;
22 36 : instrCount = 1;
23 36 : }
24 :
25 7 : bool CcuRepBufLocWrite::Translate(CcuInstr *&instr, uint16_t &instrId, const TransDep &dep)
26 : {
27 7 : this->instrId = instrId;
28 7 : translated = true;
29 :
30 7 : TransLocMSToLocMemInstr(instr++, dst.addr.Id(), dst.token.Id(), src.Id(), len.Id(), dep.reserveChannalId[0],
31 7 : sem.Id(), mask, 0, 0, 1, 1);
32 :
33 7 : instrId += instrCount;
34 :
35 7 : return translated;
36 : }
37 :
38 10 : std::string CcuRepBufLocWrite::Describe()
39 : {
40 30 : return StringFormat("Write CcuBuffer[%u] To Loc Mem[%u], len[%u], sem[%u], mask[%04x]", src.Id(), dst.addr.Id(),
41 10 : len.Id(), sem.Id(), mask);
42 : }
43 :
44 : }; // namespace CcuRep
45 : }; // namespace Hccl
|