Line data Source code
1 : /*
2 : * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
3 : * Description: ccu representation base header file
4 : * Create: 2025-02-18
5 : */
6 :
7 : #ifndef CCU_REPRESENTATION_BASE
8 : #define CCU_REPRESENTATION_BASE
9 :
10 : #include <string>
11 :
12 : #include "ccu_common.h"
13 : #include "ccu_microcode_v1.h"
14 : #include "ccu_rep_type_v1.h"
15 : #include "hcomm_primitives.h"
16 :
17 : namespace hcomm {
18 :
19 : class CcuKernel;
20 :
21 : namespace CcuRep {
22 :
23 : class CcuInsGeneratorBase;
24 : class CcuInsGeneratorV1;
25 : class CcuInsGeneratorV2;
26 :
27 : struct TransDep {
28 : int32_t logicalId;
29 : uint16_t dieId;
30 : uint16_t reserveXnId;
31 : uint16_t reserveGsaId;
32 : uint16_t reserveCkeId;
33 : uint16_t reserveChannalId[2]; // 0: selfLoopBack; 1: inter die, 0xffff为无效值,rep翻译时检查
34 : uint64_t xnBaseAddr[CCU_MAX_IODIE_NUM];
35 : uint64_t ccuResSpaceTokenInfo;
36 : uint64_t memTokenInfo;
37 : uint16_t commXn[3]; // 3个Xn
38 : uint16_t commGsa[2]; // 2个GSA
39 : uint16_t commSignal; // 1个CKE
40 : uint16_t loadXnId;
41 : bool isFuncBlock;
42 : };
43 :
44 : class CcuRepBase {
45 : public:
46 : explicit CcuRepBase();
47 : virtual ~CcuRepBase();
48 : virtual bool Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep) = 0;
49 : virtual std::string Describe() = 0;
50 3 : virtual uint32_t GetId() {
51 3 : return 0;
52 : }
53 :
54 : CcuRepType Type() const;
55 : bool Translated() const;
56 : uint16_t StartInstrId() const;
57 : virtual uint16_t InstrCount();
58 :
59 : protected:
60 : CcuRepType type{CcuRepType::BASE};
61 : bool translated{false};
62 : uint16_t instrId{0};
63 : uint16_t instrCount{0};
64 : };
65 :
66 : }; // namespace CcuRep
67 : }; // namespace hcomm
68 : #endif // _CCU_REPRESENTATION_BASE
|