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