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