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 CcuInsGeneraterBase;
24 : class CcuInsGeneraterV1;
25 :
26 : struct TransDep {
27 : int32_t logicalId;
28 : uint16_t dieId;
29 : uint16_t reserveXnId;
30 : uint16_t reserveGsaId;
31 : uint16_t reserveCkeId;
32 : uint16_t reserveChannalId[2]; // 0: selfLoopBack; 1: inter die, 0xffff为无效值,rep翻译时检查
33 : uint64_t xnBaseAddr[CCU_MAX_IODIE_NUM];
34 : uint64_t ccuResSpaceTokenInfo;
35 : uint64_t memTokenInfo;
36 : uint16_t commXn[3]; // 3个Xn
37 : uint16_t commGsa[2]; // 2个GSA
38 : uint16_t commSignal; // 1个CKE
39 : uint16_t loadXnId;
40 : bool isFuncBlock;
41 : };
42 :
43 : class CcuRepBase {
44 : public:
45 : explicit CcuRepBase();
46 : virtual ~CcuRepBase();
47 : virtual bool Translate(CcuKernel* ccuKernel, CcuInstr *&instr, uint16_t &instrId, const TransDep &dep) = 0;
48 : virtual std::string Describe() = 0;
49 2 : virtual uint32_t GetId() {
50 2 : return 0;
51 : }
52 :
53 : CcuRepType Type() const;
54 : bool Translated() const;
55 : uint16_t StartInstrId() const;
56 : virtual uint16_t InstrCount();
57 :
58 : protected:
59 : CcuRepType type{CcuRepType::BASE};
60 : bool translated{false};
61 : uint16_t instrId{0};
62 : uint16_t instrCount{0};
63 : };
64 :
65 : }; // namespace CcuRep
66 : }; // namespace hcomm
67 : #endif // _CCU_REPRESENTATION_BASE
|