LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_microcode - ccu_microcode_v1.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 5 5
Test Date: 2026-08-25 19:18:03 Functions: 100.0 % 1 1

            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              : #ifndef CCU_MICROCODE_H
      12              : #define CCU_MICROCODE_H
      13              : 
      14              : #include <cstdint>
      15              : #include <string>
      16              : #include <unordered_map>
      17              : namespace hcomm {
      18              : namespace CcuRep {
      19              : 
      20              :     constexpr uint16_t CCU_REDUCE_SUM = 0;
      21              :     constexpr uint16_t CCU_REDUCE_MAX = 1;
      22              :     constexpr uint16_t CCU_REDUCE_MIN = 2;
      23              : 
      24              :     constexpr uint16_t CCU_REDUCE_MIN_MS = 2;
      25              :     constexpr uint16_t CCU_REDUCE_MAX_MS = 8;
      26              : 
      27              :     constexpr uint64_t CCU_MS_SIZE = 4096;
      28              :     constexpr uint64_t CCU_MS_INTERLEAVE = 8;
      29              :     constexpr uint64_t CCU_MS_DEFAULT_LOOP_COUNT = 128;
      30              : 
      31              :     constexpr uint16_t CCU_LOAD_TO_XN_SEC_INFO = 1;
      32              : 
      33              :     // CCU V2 CKE 写后读 (setcke -> waitcke/clearcke) 需要的最坏 latency (单位: 指令周期).
      34              :     // 后端优化 cke-only 档按此为每个 CKE 读者补 NOP; 指令空间预留也按此为每个 wait 类 rep
      35              :     // 预留同等条数, 两处必须同源引用, 严禁各自写死, 否则预留与实际插入会漂移导致越界.
      36              :     constexpr uint32_t CCU_CKE_RAW_LATENCY = 14;
      37              : 
      38              : #pragma pack(push, 1)
      39              :     // instr common header
      40              :     union CcuInstrHeader {
      41              :         struct {
      42              :             uint16_t code : 11;
      43              :             uint16_t type : 4;
      44              :             uint16_t reserved : 1;
      45              :         };
      46              : 
      47              :         uint16_t header;
      48              :     };
      49              : #pragma pack(pop)
      50              : 
      51         5372 :     inline CcuInstrHeader InstrHeader(uint16_t type, uint16_t code)
      52              :     {
      53         5372 :         CcuInstrHeader header = {};
      54         5372 :         header.type = type;
      55         5372 :         header.code = code;
      56         5372 :         return header;
      57              :     }
      58              : 
      59              :     namespace CcuV1 {
      60              : 
      61              : #pragma pack(push, 1)
      62              :         // load instruction
      63              :         struct CcuInstrLoadSqeArgsToGSA {
      64              :             uint16_t gsaId;
      65              :             uint16_t sqeArgsId;
      66              :             uint16_t reserved[13];
      67              :         };
      68              : 
      69              :         struct CcuInstrLoadSqeArgsToXn {
      70              :             uint16_t xnId;
      71              :             uint16_t sqeArgsId;
      72              :             uint16_t reserved[13];
      73              :         };
      74              : 
      75              :         struct CcuInstrLoadImdToGSA {
      76              :             uint16_t gsaId;
      77              :             uint64_t immediate;
      78              :             uint16_t reserved[10];
      79              :         };
      80              : 
      81              :         struct CcuInstrLoadImdToXn {
      82              :             uint16_t xnId;
      83              :             uint64_t immediate;
      84              :             uint16_t secFlag;
      85              :             uint16_t reserved[9];
      86              :         };
      87              : 
      88              :         struct CcuInstrLoadGSAXn {
      89              :             uint16_t gsAdId;
      90              :             uint16_t gsAmId;
      91              :             uint16_t xnId;
      92              :             uint16_t reserved[12];
      93              :         };
      94              : 
      95              :         struct CcuInstrLoadGSAGSA {
      96              :             uint16_t gsAdId;
      97              :             uint16_t gsAmId;
      98              :             uint16_t gsAnId;
      99              :             uint16_t reserved[12];
     100              :         };
     101              : 
     102              :         struct CcuInstrLoadXX {
     103              :             uint16_t xdId;
     104              :             uint16_t xmId;
     105              :             uint16_t xnId;
     106              :             uint16_t reserved[12];
     107              :         };
     108              : 
     109              :         // loop control instruction
     110              :         struct CcuInstrLoop {
     111              :             uint16_t startInstrId; // 开始指令地址Id
     112              :             uint16_t endInstrId;   // 结束指令地址Id
     113              :             uint16_t xnId;         // LoopCtxId[52:45], Offset[44:13], IterNum[12:0]
     114              :             uint16_t reserved[12];
     115              :         };
     116              : 
     117              :         struct CcuInstrLoopGroup {
     118              :             uint16_t startLoopInstrId; // 开始loop地址Id
     119              :             uint16_t xnId;             // LoopNum[61:55], RepeatNum[54:48], NoRepeatNum[47:41]
     120              :             uint16_t xmId;             // gsaOffset[52:21], MSOffset[20:10], ckeOffset[9:0]
     121              :             uint16_t highPerfModeEn : 1;
     122              :             uint16_t reserved1 : 15;
     123              :             uint16_t reserved[11];
     124              :         };
     125              : 
     126              :         struct CcuInstrSetCKE {
     127              :             uint16_t clearType : 1;
     128              :             uint16_t reserved1 : 15;
     129              :             uint16_t setCKEId;
     130              :             uint16_t setCKEMask;
     131              :             uint16_t waitCKEId;
     132              :             uint16_t waitCKEMask;
     133              :             uint16_t reserved[10];
     134              :         };
     135              : 
     136              :         struct CcuInstrClearCKE {
     137              :             uint16_t clearType : 1;
     138              :             uint16_t reserved1 : 15;
     139              :             uint16_t clearCKEId;
     140              :             uint16_t clearMask;
     141              :             uint16_t waitCKEId;
     142              :             uint16_t waitCKEMask;
     143              :             uint16_t reserved[10];
     144              :         };
     145              : 
     146              :         struct CcuInstrJmp {
     147              :             uint16_t dstInstrXnId;
     148              :             uint16_t conditionXnId;
     149              :             uint64_t expectData;
     150              :         };
     151              : 
     152              :         // data transfer instruction
     153              :         struct CcuInstrTransLocMemToLocMS {
     154              :             uint16_t locMSId;
     155              :             uint16_t locGSAId;
     156              :             uint16_t locXnId;
     157              :             uint16_t lengthXnId;
     158              :             uint16_t channelId;
     159              :             uint16_t reserved1[5];
     160              :             uint16_t clearType : 1;
     161              :             uint16_t lengthEn : 1;
     162              :             uint16_t reserved : 14;
     163              :             uint16_t setCKEId;
     164              :             uint16_t setCKEMask;
     165              :             uint16_t waitCKEId;
     166              :             uint16_t waitCKEMask;
     167              :         };
     168              : 
     169              :         struct CcuInstrTransRmtMemToLocMS {
     170              :             uint16_t locMSId;
     171              :             uint16_t rmtGSAId;
     172              :             uint16_t rmtXnId;
     173              :             uint16_t lengthXnId;
     174              :             uint16_t channelId;
     175              :             uint16_t reserved1[5];
     176              :             uint16_t clearType : 1;
     177              :             uint16_t lengthEn : 1;
     178              :             uint16_t reserved : 14;
     179              :             uint16_t setCKEId;
     180              :             uint16_t setCKEMask;
     181              :             uint16_t waitCKEId;
     182              :             uint16_t waitCKEMask;
     183              :         };
     184              : 
     185              :         struct CcuInstrTransLocMSToLocMem {
     186              :             uint16_t locGSAId;
     187              :             uint16_t locXnId;
     188              :             uint16_t locMSId;
     189              :             uint16_t lengthXnId;
     190              :             uint16_t channelId;
     191              :             uint16_t reserved1[5];
     192              :             uint16_t clearType : 1;
     193              :             uint16_t lengthEn : 1;
     194              :             uint16_t reserved : 14;
     195              :             uint16_t setCKEId;
     196              :             uint16_t setCKEMask;
     197              :             uint16_t waitCKEId;
     198              :             uint16_t waitCKEMask;
     199              :         };
     200              : 
     201              :         struct CcuInstrTransLocMSToRmtMem {
     202              :             uint16_t rmtGSAId;
     203              :             uint16_t rmtXnId;
     204              :             uint16_t locMSId;
     205              :             uint16_t lengthXnId;
     206              :             uint16_t channelId;
     207              :             uint16_t reserved1[5];
     208              :             uint16_t clearType : 1;
     209              :             uint16_t lengthEn : 1;
     210              :             uint16_t reserved : 14;
     211              :             uint16_t setCKEId;
     212              :             uint16_t setCKEMask;
     213              :             uint16_t waitCKEId;
     214              :             uint16_t waitCKEMask;
     215              :         };
     216              : 
     217              :         struct CcuInstrTransRmtMSToLocMem {
     218              :             uint16_t locGSAId;
     219              :             uint16_t locXnId;
     220              :             uint16_t rmtMSId;
     221              :             uint16_t lengthXnId;
     222              :             uint16_t channelId;
     223              :             uint16_t reserved1[5];
     224              :             uint16_t clearType : 1;
     225              :             uint16_t lengthEn : 1;
     226              :             uint16_t reserved : 14;
     227              :             uint16_t setCKEId;
     228              :             uint16_t setCKEMask;
     229              :             uint16_t waitCKEId;
     230              :             uint16_t waitCKEMask;
     231              :         };
     232              : 
     233              :         struct CcuInstrTransLocMSToLocMS {
     234              :             uint16_t dstMSId;
     235              :             uint16_t srcMSId;
     236              :             uint16_t lengthXnId;
     237              :             uint16_t channelId;
     238              :             uint16_t reserved1[6];
     239              :             uint16_t clearType : 1;
     240              :             uint16_t lengthEn : 1;
     241              :             uint16_t reserved : 14;
     242              :             uint16_t setCKEId;
     243              :             uint16_t setCKEMask;
     244              :             uint16_t waitCKEId;
     245              :             uint16_t waitCKEMask;
     246              :         };
     247              : 
     248              :         struct CcuInstrTransRmtMSToLocMS {
     249              :             uint16_t locMSId;
     250              :             uint16_t rmtMSId;
     251              :             uint16_t lengthXnId;
     252              :             uint16_t channelId;
     253              :             uint16_t reserved1[6];
     254              :             uint16_t clearType : 1;
     255              :             uint16_t lengthEn : 1;
     256              :             uint16_t reserved : 14;
     257              :             uint16_t setCKEId;
     258              :             uint16_t setCKEMask;
     259              :             uint16_t waitCKEId;
     260              :             uint16_t waitCKEMask;
     261              :         };
     262              : 
     263              :         struct CcuInstrTransLocMSToRmtMS {
     264              :             uint16_t rmtMSId;
     265              :             uint16_t locMSId;
     266              :             uint16_t lengthXnId;
     267              :             uint16_t channelId;
     268              :             uint16_t setRmtCKEId;
     269              :             uint16_t setRmtCKEMask;
     270              :             uint16_t reserved1[4];
     271              :             uint16_t clearType : 1;
     272              :             uint16_t lengthEn : 1;
     273              :             uint16_t reserved : 14;
     274              :             uint16_t setCKEId;
     275              :             uint16_t setCKEMask;
     276              :             uint16_t waitCKEId;
     277              :             uint16_t waitCKEMask;
     278              :         };
     279              : 
     280              :         struct CcuInstrTransRmtMemToLocMem {
     281              :             uint16_t locGSAId;
     282              :             uint16_t locXnId;
     283              :             uint16_t rmtGSAId;
     284              :             uint16_t rmtXnId;
     285              :             uint16_t lengthXnId;
     286              :             uint16_t channelId;
     287              :             uint16_t udfType : 8;
     288              :             uint16_t reduceDataType : 4;
     289              :             uint16_t reduceOpCode : 4;
     290              :             uint16_t reserved[3];
     291              :             uint16_t clearType : 1;
     292              :             uint16_t lengthEn : 1;
     293              :             uint16_t reduceEn : 1;
     294              :             uint16_t reserved1 : 13;
     295              :             uint16_t setCKEId;
     296              :             uint16_t setCKEMask;
     297              :             uint16_t waitCKEId;
     298              :             uint16_t waitCKEMask;
     299              :         };
     300              : 
     301              :         struct CcuInstrTransLocMemToRmtMem {
     302              :             uint16_t rmtGSAId;
     303              :             uint16_t rmtXnId;
     304              :             uint16_t locGSAId;
     305              :             uint16_t locXnId;
     306              :             uint16_t lengthXnId;
     307              :             uint16_t channelId;
     308              :             uint16_t udfType : 8;
     309              :             uint16_t reduceDataType : 4;
     310              :             uint16_t reduceOpCode : 4;
     311              :             uint16_t reserved[3];
     312              :             uint16_t clearType : 1;
     313              :             uint16_t lengthEn : 1;
     314              :             uint16_t reduceEn : 1;
     315              :             uint16_t reserved1 : 13;
     316              :             uint16_t setCKEId;
     317              :             uint16_t setCKEMask;
     318              :             uint16_t waitCKEId;
     319              :             uint16_t waitCKEMask;
     320              :         };
     321              : 
     322              :         struct CcuInstrTransLocMemToLocMem {
     323              :             uint16_t dstGSAId;
     324              :             uint16_t dstXnId;
     325              :             uint16_t srcGSAId;
     326              :             uint16_t srcXnId;
     327              :             uint16_t lengthXnId;
     328              :             uint16_t channelId;
     329              :             uint16_t reserved1[4];
     330              :             uint16_t clearType : 1;
     331              :             uint16_t lengthEn : 1;
     332              :             uint16_t reserved : 14;
     333              :             uint16_t setCKEId;
     334              :             uint16_t setCKEMask;
     335              :             uint16_t waitCKEId;
     336              :             uint16_t waitCKEMask;
     337              :         };
     338              : 
     339              :         struct CcuInstrSyncCKE {
     340              :             uint16_t rmtCKEId;
     341              :             uint16_t locCKEId;
     342              :             uint16_t locCKEMask;
     343              :             uint16_t channelId;
     344              :             uint16_t reserved[6];
     345              :             uint16_t clearType : 1;
     346              :             uint16_t reserved1 : 15;
     347              :             uint16_t setCKEId;
     348              :             uint16_t setCKEMask;
     349              :             uint16_t waitCKEId;
     350              :             uint16_t waitCKEMask;
     351              :         };
     352              : 
     353              :         struct CcuInstrSyncGSA {
     354              :             uint16_t rmtGSAId;
     355              :             uint16_t locGSAId;
     356              :             uint16_t reserved2;
     357              :             uint16_t channelId;
     358              :             uint16_t setRmtCKEId;
     359              :             uint16_t setRmtCKEMask;
     360              :             uint16_t reserved[4];
     361              :             uint16_t clearType : 1;
     362              :             uint16_t reserved1 : 15;
     363              :             uint16_t setCKEId;
     364              :             uint16_t setCKEMask;
     365              :             uint16_t waitCKEId;
     366              :             uint16_t waitCKEMask;
     367              :         };
     368              : 
     369              :         struct CcuInstrSyncXn {
     370              :             uint16_t rmtXnId;
     371              :             uint16_t locXnId;
     372              :             uint16_t reserved2;
     373              :             uint16_t channelId;
     374              :             uint16_t setRmtCKEId;
     375              :             uint16_t setRmtCKEMask;
     376              :             uint16_t reserved[4];
     377              :             uint16_t clearType : 1;
     378              :             uint16_t reserved1 : 15;
     379              :             uint16_t setCKEId;
     380              :             uint16_t setCKEMask;
     381              :             uint16_t waitCKEId;
     382              :             uint16_t waitCKEMask;
     383              :         };
     384              : 
     385              :         struct CcuInstrAdd {
     386              :             uint16_t msId[CCU_REDUCE_MAX_MS];
     387              :             uint16_t XnIdLength;
     388              :             uint16_t reserved;
     389              :             uint16_t clearType : 1;
     390              :             uint16_t count : 3;
     391              :             uint16_t castEn : 2;
     392              :             uint16_t reserved1 : 5;
     393              :             uint16_t dataType : 5;
     394              :             uint16_t setCKEId;
     395              :             uint16_t setCKEMask;
     396              :             uint16_t waitCKEId;
     397              :             uint16_t waitCKEMask;
     398              :         };
     399              : 
     400              :         struct CcuInstrMax {
     401              :             uint16_t msId[CCU_REDUCE_MAX_MS];
     402              :             uint16_t XnIdLength;
     403              :             uint16_t reserved;
     404              :             uint16_t clearType : 1;
     405              :             uint16_t count : 3;
     406              :             uint16_t reserved1 : 7;
     407              :             uint16_t dataType : 5;
     408              :             uint16_t setCKEId;
     409              :             uint16_t setCKEMask;
     410              :             uint16_t waitCKEId;
     411              :             uint16_t waitCKEMask;
     412              :         };
     413              : 
     414              :         struct CcuInstrMin {
     415              :             uint16_t msId[CCU_REDUCE_MAX_MS];
     416              :             uint16_t XnIdLength;
     417              :             uint16_t reserved;
     418              :             uint16_t clearType : 1;
     419              :             uint16_t count : 3;
     420              :             uint16_t reserved1 : 7;
     421              :             uint16_t dataType : 5;
     422              :             uint16_t setCKEId;
     423              :             uint16_t setCKEMask;
     424              :             uint16_t waitCKEId;
     425              :             uint16_t waitCKEMask;
     426              :         };
     427              : #pragma pack(pop)
     428              : 
     429              :         union CcuMicroCodeV1 {
     430              :             CcuV1::CcuInstrLoadSqeArgsToGSA loadSqeArgsToGSA;
     431              :             CcuV1::CcuInstrLoadSqeArgsToXn loadSqeArgsToXn;
     432              :             CcuV1::CcuInstrLoadImdToGSA loadImdToGSA;
     433              :             CcuV1::CcuInstrLoadImdToXn loadImdToXn;
     434              :             CcuV1::CcuInstrLoadGSAXn loadGSAXn;
     435              :             CcuV1::CcuInstrLoadGSAGSA loadGSAGSA;
     436              :             CcuV1::CcuInstrLoadXX loadXX;
     437              : 
     438              :             CcuV1::CcuInstrLoop loop;
     439              :             CcuV1::CcuInstrLoopGroup loopGroup;
     440              :             CcuV1::CcuInstrSetCKE setCKE;
     441              :             CcuV1::CcuInstrClearCKE clearCKE;
     442              :             CcuV1::CcuInstrJmp jmp;
     443              : 
     444              :             CcuV1::CcuInstrTransLocMemToLocMS transLocMemToLocMS;
     445              :             CcuV1::CcuInstrTransRmtMemToLocMS transRmtMemToLocMS;
     446              :             CcuV1::CcuInstrTransLocMSToLocMem transLocMSToLocMem;
     447              :             CcuV1::CcuInstrTransLocMSToRmtMem transLocMSToRmtMem;
     448              :             CcuV1::CcuInstrTransRmtMSToLocMem transRmtMSToLocMem;
     449              : 
     450              :             CcuV1::CcuInstrTransLocMSToLocMS transLocMSToLocMS;
     451              :             CcuV1::CcuInstrTransRmtMSToLocMS transRmtMSToLocMS;
     452              :             CcuV1::CcuInstrTransLocMSToRmtMS transLocMSToRmtMS;
     453              : 
     454              :             CcuV1::CcuInstrTransRmtMemToLocMem transRmtMemToLocMem;
     455              :             CcuV1::CcuInstrTransLocMemToRmtMem transLocMemToRmtMem;
     456              :             CcuV1::CcuInstrTransLocMemToLocMem transLocMemToLocMem;
     457              : 
     458              :             CcuV1::CcuInstrSyncCKE syncCKE;
     459              :             CcuV1::CcuInstrSyncGSA syncGSA;
     460              :             CcuV1::CcuInstrSyncXn syncXn;
     461              : 
     462              :             CcuV1::CcuInstrAdd add;
     463              :             CcuV1::CcuInstrMax max;
     464              :             CcuV1::CcuInstrMin min;
     465              :         };
     466              : 
     467              :     }; // namespace CcuV1
     468              : 
     469              :     namespace CcuV2 {
     470              : 
     471              :         struct CacheConfig {
     472              :             uint16_t allocHint;
     473              :             uint16_t victimHint;
     474              :         };
     475              : 
     476              :         struct TransMemNotifyInfo {
     477              :             uint16_t xnId;
     478              :             uint16_t xntId;
     479              :             uint32_t value;
     480              :         };
     481              : 
     482              :         struct TransMemReduceInfo {
     483              :             uint16_t udfType;
     484              :             uint16_t reduceDataType;
     485              :             uint16_t reduceOpCode;
     486              :         };
     487              : 
     488              :         struct TransMemConfig {
     489              :             uint16_t dmaOpCode;
     490              :             uint16_t order;
     491              :             uint16_t fence;
     492              :             uint16_t cqe;
     493              :             uint16_t nf;
     494              :             uint16_t udfEnable;
     495              :             uint16_t splitMode;
     496              :             uint16_t se;
     497              :             uint16_t rmtJettyType;
     498              :             uint16_t src_mode;
     499              :             uint16_t dst_mode;
     500              :             uint16_t msIdMode;
     501              :         };
     502              : 
     503              : #pragma pack(push, 1)
     504              : 
     505              :         // load instruction
     506              :         struct CcuInstrLoadSqeArgsToX {
     507              :             uint16_t xnId;
     508              :             uint16_t sqeArgsId;
     509              :             uint16_t reserved[11];
     510              :             uint16_t setCKEId;
     511              :             uint16_t setCKEMask;
     512              :         };
     513              : 
     514              :         struct CcuInstrLoadImdToX {
     515              :             uint16_t xnId;
     516              :             uint64_t immediate;
     517              :             uint16_t reserved[8];
     518              :             uint16_t setCKEId;
     519              :             uint16_t setCKEMask;
     520              :         };
     521              : 
     522              :         struct CcuInstrLoadStoreX {
     523              :             uint16_t xdId;
     524              :             uint16_t xsId;
     525              :             uint16_t xsoId;
     526              :             uint16_t xdoId;
     527              :             uint16_t oMode : 1;
     528              :             uint16_t reserved : 15;
     529              :             uint16_t reserved1[8];
     530              :             uint16_t setCKEId;
     531              :             uint16_t setCKEMask;
     532              :         };
     533              : 
     534              :         struct CcuInstrClearX {
     535              :             uint16_t xnId : 15;
     536              :             uint16_t xnIdMode : 1;
     537              :             uint16_t xmId : 15;
     538              :             uint16_t xmIdMode : 1;
     539              :             uint16_t reserved[11];
     540              :             uint16_t setCKEId;
     541              :             uint16_t setCKEMask;
     542              :         };
     543              : 
     544              :         struct CcuInstrNop {
     545              :             uint16_t reserved[15];
     546              :         };
     547              : 
     548              :         struct CcuInstrLoad {
     549              :             uint16_t xdId;
     550              :             uint16_t xsId;
     551              :             uint16_t xstId;
     552              :             uint16_t xlId;
     553              :             uint16_t reserved[6];
     554              :             uint16_t dstType : 4;
     555              :             uint16_t allocHint : 2;
     556              :             uint16_t victimHint : 2;
     557              :             uint16_t reserved1 : 8;
     558              :             uint16_t reserved2[2];
     559              :             uint16_t setCKEId;
     560              :             uint16_t setCKEMask;
     561              :         };
     562              : 
     563              :         struct CcuInstrStore {
     564              :             uint16_t xdId;
     565              :             uint16_t xdtId;
     566              :             uint16_t xsId;
     567              :             uint16_t xlId;
     568              :             uint16_t xhId;
     569              :             uint16_t reserved[5];
     570              :             uint16_t srcType : 4;
     571              :             uint16_t allocHint : 2;
     572              :             uint16_t victimHint : 2;
     573              :             uint16_t storeType : 1;
     574              :             uint16_t hscbType : 1;
     575              :             uint16_t hscbBroadCastDstType : 6;
     576              :             uint16_t reserved1[2];
     577              :             uint16_t setCKEId;
     578              :             uint16_t setCKEMask;
     579              :         };
     580              : 
     581              :         // 运算符复用相同的结构体
     582              :         // 左移右移:需要指定shiftType
     583              :         // A = B@C类算子,需要指定xd, xn, xm
     584              :         // 按位非,需要指定xd, xn
     585              :         // popcnt,需要指定xd, xn
     586              :         struct CcuInstrOperator {
     587              :             uint16_t xdId;
     588              :             uint16_t xnId;
     589              :             uint16_t xmId;
     590              :             uint16_t parMode : 1;
     591              :             uint16_t reserved : 15;
     592              :             uint16_t reserved1[6];
     593              :             uint16_t shiftType : 1;
     594              :             uint16_t reserved2 : 15;
     595              :             uint16_t reserved3[2];
     596              :             uint16_t setCKEId;
     597              :             uint16_t setCKEMask;
     598              :         };
     599              : 
     600              :         // loop control instruction
     601              :         struct CcuInstrLoop {
     602              :             uint16_t startInstrId; // 开始指令地址Id
     603              :             uint16_t endInstrId;   // 结束指令地址Id
     604              :             uint16_t xmId;         // IterNum[12:0]
     605              :             uint16_t xnId;         // Offset[31:0]
     606              :             uint16_t xpId;         // LoopCtxId[8:0]
     607              :             uint16_t wishCKEBit;
     608              :             uint16_t mode : 1;
     609              :             uint16_t reserved : 15;
     610              :             uint16_t reserved1[8];
     611              :         };
     612              : 
     613              :         struct CcuInstrLoopGroup {
     614              :             uint16_t startLoopInstrId; // 开始loop地址Id
     615              :             uint16_t xnId;             // ExtendNum[22:16], RepeatLoopIndex[15:9], LoopNum[8:0]
     616              :             uint16_t xmId;             // gsaOffset[52:21], MSOffset[20:10], ckeOffset[9:0]
     617              :             uint16_t xpId;             // xnOffset[31:0]
     618              :             uint16_t reserved[11];
     619              :         };
     620              : 
     621              :         struct CcuInstrSetCKE {
     622              :             uint16_t clearType : 1;
     623              :             uint16_t reserved : 15;
     624              :             uint16_t setCKEId;
     625              :             uint16_t setCKEMask;
     626              :             uint16_t waitCKEId;
     627              :             uint16_t waitCKEMask;
     628              :             uint64_t userData;
     629              :             uint16_t reserved1[6];
     630              :         };
     631              : 
     632              :         struct CcuInstrClearCKE {
     633              :             uint16_t clearType : 1;
     634              :             uint16_t reserved : 15;
     635              :             uint16_t clearCKEId;
     636              :             uint16_t clearMask;
     637              :             uint16_t waitCKEId;
     638              :             uint16_t waitCKEMask;
     639              :             uint16_t reserved1[10];
     640              :         };
     641              : 
     642              :         struct CcuInstrJmp {
     643              :             uint16_t expectedXnId;
     644              :             uint16_t conditionXnId;
     645              :             uint16_t relTarInstrXnId;
     646              :             uint16_t conditionType : 4;
     647              :             uint16_t jumpMode : 1;
     648              :             uint16_t reserved : 11;
     649              :             uint16_t reserved1[11];
     650              :         };
     651              : 
     652              :         struct CcuInstrWait {
     653              :             uint16_t conditionXnId; // Xn
     654              :             uint16_t expectedXnId;  // Xm
     655              :             uint16_t conditionType : 4;
     656              :             uint16_t reserved : 12;
     657              :             uint16_t reserved1[12];
     658              :         };
     659              : 
     660              :         struct CcuInstrFence {
     661              :             uint16_t reserved[15];
     662              :         };
     663              : 
     664              :         // data transfer instruction
     665              :         struct CcuInstrTransLocMemToLocMS {
     666              :             uint16_t msId;
     667              :             uint16_t xsId;
     668              :             uint16_t xstId;
     669              :             uint16_t xlId;
     670              :             uint16_t xoId;
     671              :             uint16_t allocHint : 2;
     672              :             uint16_t victimHint : 2;
     673              :             uint16_t reserved : 12;
     674              :             uint16_t reserved1[7];
     675              :             uint16_t setCKEId;
     676              :             uint16_t setCKEMask;
     677              :         };
     678              : 
     679              :         struct CcuInstrTransLocMSToLocMem {
     680              :             uint16_t xdId;
     681              :             uint16_t xdtId;
     682              :             uint16_t msId;
     683              :             uint16_t xlId;
     684              :             uint16_t xoId;
     685              :             uint16_t allocHint : 2;
     686              :             uint16_t victimHint : 2;
     687              :             uint16_t reserved : 12;
     688              :             uint16_t reserved1[7];
     689              :             uint16_t setCKEId;
     690              :             uint16_t setCKEMask;
     691              :         };
     692              : 
     693              :         struct CcuInstrTransLocMSToLocMS {
     694              :             uint16_t msdId;
     695              :             uint16_t mssId;
     696              :             uint16_t xlId;
     697              :             uint16_t xoId;
     698              :             uint16_t reserved[9];
     699              :             uint16_t setCKEId;
     700              :             uint16_t setCKEMask;
     701              :         };
     702              : 
     703              :         struct CcuInstrTransLocMemToLocMem {
     704              :             uint16_t xdId;
     705              :             uint16_t xdtId;
     706              :             uint16_t xsId;
     707              :             uint16_t xstId;
     708              :             uint16_t xlId;
     709              :             uint16_t usedMSId;
     710              :             uint16_t srcAllocHint : 2;
     711              :             uint16_t srcVictimHint : 2;
     712              :             uint16_t dstAllocHint : 2;
     713              :             uint16_t dstVictimHint : 2;
     714              :             uint16_t msNum : 8;
     715              :             uint16_t reserved1[6];
     716              :             uint16_t setCKEId;
     717              :             uint16_t setCKEMask;
     718              :         };
     719              : 
     720              :         struct CcuInstrTransMem {
     721              :             uint16_t xdId;  // 存储目的内存地址
     722              :             uint16_t xdtId; // 存储目的内存Token
     723              :             uint16_t xsId;  // 存储源内存地址
     724              :             uint16_t xstId; // 存储源内存Token
     725              :             uint16_t xlId;  // 存储要搬运的数据长度
     726              :             uint16_t xcId;  // 存储使用的channelId
     727              :             uint16_t xnId;  // 存储notify/atomic的目的地址
     728              :             uint16_t xntId; // 存储notify/atomic的目的Token
     729              :             uint32_t value; // notify value, atomic store add value, immeidata data, 视不同的opCode确定, 只支持32bit
     730              :             uint16_t udfType : 8;
     731              :             uint16_t reduceDataType : 4;
     732              :             uint16_t reduceOpCode : 4;
     733              :             uint16_t dmaOpCode : 8; // wqe中的opcode,支持0x0: send,0x1: send with immediata,0x3: Write,0x5: Write
     734              :                                     // with Notify,0x6: Read,0x70: Write with atomic store add
     735              :             uint16_t order : 3;
     736              :             uint16_t fence : 1;
     737              :             uint16_t cqe : 1;
     738              :             uint16_t nf : 1; // No Fragment, 不允许分片
     739              :             uint16_t udfEnable : 1;
     740              :             uint16_t splitMode : 1;
     741              :             uint16_t se : 1; // Solicited Event,Responder基于se来判断生成CQE时是否产生Completion Event
     742              :             uint16_t rmtJettyType : 2; // 00: JFR, 01: Jetty,10: JettyGroup,11: reserved
     743              :             uint16_t src_mode : 1;
     744              :             uint16_t dst_mode : 1;
     745              :             uint16_t msIdMode : 1; // 标记是否使用transmem的msId模式
     746              :             uint16_t reserved : 2;
     747              :             uint16_t targetHint : 8;
     748              :             uint16_t setCKEId;
     749              :             uint16_t setCKEMask;
     750              :         };
     751              : 
     752              :         // SyncWtX指令固定将一个指定Xn的信息同步,固定8B
     753              :         struct CcuInstrSyncWtX {
     754              :             uint16_t xdId;  // 存储目的Xn寄存器的地址
     755              :             uint16_t xdtId; // 存储目的Xn寄存器Token
     756              :             uint16_t xsId;  // 存储源Xn寄存器Id
     757              :             uint16_t xcId;  // 存储使用的channelId
     758              :             uint16_t xnId;  // 存储notify/atomic的目的地址
     759              :             uint16_t xntId; // 存储notify/atomic的目的Token
     760              :             uint32_t value; // notify value, 只支持32bit
     761              :             uint16_t notifyValid : 1;
     762              :             uint16_t parMode : 1;
     763              :             uint16_t reserved : 14;
     764              :             uint16_t reserved1[4];
     765              :             uint16_t setCKEId;
     766              :             uint16_t setCKEMask;
     767              :         };
     768              : 
     769              :         // SyncAtX指令以write with atomic store add发往对端,其中write的数据长度为0,本端Xn的值是写在atomic
     770              :         // value中进行发送
     771              :         struct CcuInstrSyncAtX {
     772              :             uint16_t xdId;  // 存储目的Xn寄存器的地址
     773              :             uint16_t xdtId; // 存储目的Xn寄存器Token
     774              :             uint16_t xsId;  // 存储源Xn寄存器Id
     775              :             uint16_t xcId;  // 存储使用的channelId
     776              :             uint16_t reserved : 1;
     777              :             uint16_t parMode : 1;
     778              :             uint16_t reserved1 : 14;
     779              :             uint16_t reserved2[8];
     780              :             uint16_t setCKEId;
     781              :             uint16_t setCKEMask;
     782              :         };
     783              : 
     784              :         // reduce instruction
     785              :         // add: 配置castEn
     786              :         // max和min: castEn保持默认为0
     787              :         struct CcuInstrReduce {
     788              :             uint16_t msId[CCU_REDUCE_MAX_MS];
     789              :             uint16_t XnIdLength;
     790              :             uint16_t reserved;
     791              :             uint16_t reserved1 : 1;
     792              :             uint16_t count : 3;
     793              :             uint16_t castEn : 2;
     794              :             uint16_t reserved2 : 5;
     795              :             uint16_t dataType : 5;
     796              :             uint16_t reserved3[2];
     797              :             uint16_t setCKEId;
     798              :             uint16_t setCKEMask;
     799              :         };
     800              : 
     801              : #pragma pack(pop)
     802              : 
     803              :         union CcuMicroCodeV2 {
     804              :             CcuV2::CcuInstrLoadSqeArgsToX loadSqeArgsToX;
     805              :             CcuV2::CcuInstrLoadImdToX loadImdToX;
     806              :             CcuV2::CcuInstrLoadStoreX loadStoreX;
     807              :             CcuV2::CcuInstrClearX clearX;
     808              :             CcuV2::CcuInstrNop nop;
     809              :             CcuV2::CcuInstrOperator operate;
     810              :             CcuV2::CcuInstrLoad load;
     811              :             CcuV2::CcuInstrStore store;
     812              : 
     813              :             CcuV2::CcuInstrLoop loop;
     814              :             CcuV2::CcuInstrLoopGroup loopGroup;
     815              :             CcuV2::CcuInstrSetCKE setCKE;
     816              :             CcuV2::CcuInstrClearCKE clearCKE;
     817              :             CcuV2::CcuInstrJmp jmp;
     818              :             CcuV2::CcuInstrWait wait;
     819              :             CcuV2::CcuInstrFence fence;
     820              : 
     821              :             CcuV2::CcuInstrTransLocMemToLocMS transLocMemToLocMS;
     822              :             CcuV2::CcuInstrTransLocMSToLocMem transLocMSToLocMem;
     823              :             CcuV2::CcuInstrTransLocMSToLocMS transLocMSToLocMS;
     824              :             CcuV2::CcuInstrTransLocMemToLocMem transLocMemToLocMem;
     825              :             CcuV2::CcuInstrTransMem transMem;
     826              :             CcuV2::CcuInstrSyncWtX syncWtX;
     827              :             CcuV2::CcuInstrSyncAtX syncAtX;
     828              : 
     829              :             CcuV2::CcuInstrReduce reduce;
     830              :         };
     831              :     }; // namespace CcuV2
     832              : 
     833              :     struct CcuInstr {
     834              :         CcuInstrHeader header;
     835              :         union {
     836              :             CcuV1::CcuMicroCodeV1 v1;
     837              :             CcuV2::CcuMicroCodeV2 v2;
     838              :         };
     839              :     };
     840              : 
     841              :     std::string ParseInstr(const CcuInstr* instr);
     842              : 
     843              :     void LoadSqeArgsToGSAInstr(CcuInstr* instr, uint16_t gsaId, uint16_t sqeArgsId);
     844              :     void LoadSqeArgsToXnInstr(CcuInstr* instr, uint16_t xnId, uint16_t sqeArgsId);
     845              :     void LoadImdToGSAInstr(CcuInstr* instr, uint16_t gsaId, uint64_t immediate);
     846              :     void LoadImdToXnInstr(CcuInstr* instr, uint16_t xnId, uint64_t immediate, uint16_t secFlag = 0);
     847              :     void LoadGSAXnInstr(CcuInstr* instr, uint16_t gsAdId, uint16_t gsAmId, uint16_t xnId);
     848              :     void LoadGSAGSAInstr(CcuInstr* instr, uint16_t gsAdId, uint16_t gsAmId, uint16_t gsAnId);
     849              :     void LoadXXInstr(CcuInstr* instr, uint16_t xdId, uint16_t xmId, uint16_t xnId);
     850              : 
     851              :     void LoopInstr(CcuInstr* instr, uint16_t startInstrId, uint16_t endInstrId, uint16_t xnId);
     852              :     void
     853              :     LoopGroupInstr(CcuInstr* instr, uint16_t startLoopInstrId, uint16_t xnId, uint16_t xmId, uint16_t highPerfModeEn);
     854              :     void JumpInstr(CcuInstr* instr, uint16_t dstInstrXnId, uint16_t conditionXnId, uint64_t expectData);
     855              :     void SetCKEInstr(
     856              :         CcuInstr* instr, uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask,
     857              :         uint16_t clearType);
     858              :     void ClearCKEInstr(
     859              :         CcuInstr* instr, uint16_t clearCKEId, uint16_t clearMask, uint16_t waitCKEId, uint16_t waitCKEMask,
     860              :         uint16_t clearType);
     861              : 
     862              :     void TransLocMemToLocMSInstr(
     863              :         CcuInstr* instr, uint16_t locMSId, uint16_t locGSAId, uint16_t locXnId, uint16_t lengthXnId, uint16_t channelId,
     864              :         uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType,
     865              :         uint16_t lengthEn);
     866              :     void TransRmtMemToLocMSInstr(
     867              :         CcuInstr* instr, uint16_t locMSId, uint16_t rmtGSAId, uint16_t rmtXnId, uint16_t lengthXnId, uint16_t channelId,
     868              :         uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType,
     869              :         uint16_t lengthEn);
     870              :     void TransLocMSToLocMemInstr(
     871              :         CcuInstr* instr, uint16_t locGSAId, uint16_t locXnId, uint16_t locMSId, uint16_t lengthXnId, uint16_t channelId,
     872              :         uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType,
     873              :         uint16_t lengthEn);
     874              :     void TransLocMSToRmtMemInstr(
     875              :         CcuInstr* instr, uint16_t rmtGSAId, uint16_t rmtXnId, uint16_t locMSId, uint16_t lengthXnId, uint16_t channelId,
     876              :         uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType,
     877              :         uint16_t lengthEn);
     878              :     void TransRmtMSToLocMemInstr(
     879              :         CcuInstr* instr, uint16_t locGSAId, uint16_t locXnId, uint16_t rmtMSId, uint16_t lengthXnId, uint16_t channelId,
     880              :         uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType,
     881              :         uint16_t lengthEn);
     882              : 
     883              :     void TransLocMSToLocMSInstr(
     884              :         CcuInstr* instr, uint16_t dstMSId, uint16_t srcMSId, uint16_t lengthXnId, uint16_t channelId, uint16_t setCKEId,
     885              :         uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType, uint16_t lengthEn);
     886              :     void TransRmtMSToLocMSInstr(
     887              :         CcuInstr* instr, uint16_t locMSId, uint16_t rmtMSId, uint16_t lengthXnId, uint16_t channelId, uint16_t setCKEId,
     888              :         uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType, uint16_t lengthEn);
     889              :     void TransLocMSToRmtMSInstr(
     890              :         CcuInstr* instr, uint16_t rmtMSId, uint16_t locMSId, uint16_t lengthXnId, uint16_t channelId,
     891              :         uint16_t setRmtCKEId, uint16_t setRmtCKEMask, uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId,
     892              :         uint16_t waitCKEMask, uint16_t clearType, uint16_t lengthEn);
     893              : 
     894              :     void TransRmtMemToLocMemInstr(
     895              :         CcuInstr* instr, uint16_t locGSAId, uint16_t locXnId, uint16_t rmtGSAId, uint16_t rmtXnId, uint16_t lengthXnId,
     896              :         uint16_t channelId, uint16_t reduceDataType, uint16_t reduceOpCode, uint16_t setCKEId, uint16_t setCKEMask,
     897              :         uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType, uint16_t lengthEn, uint16_t reduceEn);
     898              :     void TransLocMemToRmtMemInstr(
     899              :         CcuInstr* instr, uint16_t rmtGSAId, uint16_t rmtXnId, uint16_t locGSAId, uint16_t locXnId, uint16_t lengthXnId,
     900              :         uint16_t channelId, uint16_t reduceDataType, uint16_t reduceOpCode, uint16_t setCKEId, uint16_t setCKEMask,
     901              :         uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType, uint16_t lengthEn, uint16_t reduceEn);
     902              :     void TransLocMemToLocMemInstr(
     903              :         CcuInstr* instr, uint16_t dstGSAId, uint16_t dstXnId, uint16_t srcGSAId, uint16_t srcXnId, uint16_t lengthXnId,
     904              :         uint16_t channelId, uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask,
     905              :         uint16_t clearType, uint16_t lengthEn);
     906              : 
     907              :     void SyncCKEInstr(
     908              :         CcuInstr* instr, uint16_t rmtCKEId, uint16_t locCKEId, uint16_t locCKEMask, uint16_t channelId,
     909              :         uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType);
     910              :     void SyncGSAInstr(
     911              :         CcuInstr* instr, uint16_t rmtGSAId, uint16_t locGSAId, uint16_t channelId, uint16_t setRmtCKEId,
     912              :         uint16_t setRmtCKEMask, uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask,
     913              :         uint16_t clearType);
     914              :     void SyncXnInstr(
     915              :         CcuInstr* instr, uint16_t rmtXnId, uint16_t locXnId, uint16_t channelId, uint16_t setRmtCKEId,
     916              :         uint16_t setRmtCKEMask, uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask,
     917              :         uint16_t clearType);
     918              : 
     919              :     void AddInstr(
     920              :         CcuInstr* instr, uint16_t* msId, uint16_t count, uint16_t castEn, uint16_t dataType, uint16_t setCKEId,
     921              :         uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType, uint16_t XnIdLength);
     922              :     void MaxInstr(
     923              :         CcuInstr* instr, uint16_t* msId, uint16_t count, uint16_t dataType, uint16_t setCKEId, uint16_t setCKEMask,
     924              :         uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType, uint16_t XnIdLength);
     925              :     void MinInstr(
     926              :         CcuInstr* instr, uint16_t* msId, uint16_t count, uint16_t dataType, uint16_t setCKEId, uint16_t setCKEMask,
     927              :         uint16_t waitCKEId, uint16_t waitCKEMask, uint16_t clearType, uint16_t XnIdLength);
     928              : 
     929              :     namespace CcuV2 {
     930              :         void Nop(CcuInstr* instr);
     931              : 
     932              :         void LoadSqeArgsToX(
     933              :             CcuInstr* instr, uint16_t xnId, uint16_t sqeArgsId, uint16_t setCKEId = 0, uint16_t setCKEMask = 0);
     934              :         void
     935              :         LoadImdToXn(CcuInstr* instr, uint16_t xnId, uint64_t immediate, uint16_t setCKEId = 0, uint16_t setCKEMask = 0);
     936              :         void ClearX(
     937              :             CcuInstr* instr, uint16_t xnId, uint16_t xmId, uint16_t xnIdMode = 0, uint16_t xmIdMode = 0,
     938              :             uint16_t setCKEId = 0, uint16_t setCKEMask = 0);
     939              :         void LoadXFromMem(
     940              :             CcuInstr* instr, uint16_t dst, uint16_t src, uint16_t srcToken, uint16_t len,
     941              :             const CacheConfig& cacheConfig, uint16_t setCKEId, uint16_t setCKEMask);
     942              :         void StoreXToMem(
     943              :             CcuInstr* instr, uint16_t dst, uint16_t dstToken, uint16_t src, uint16_t len,
     944              :             const CacheConfig& cacheConfig, uint16_t setCKEId, uint16_t setCKEMask);
     945              :         void HSCBStoreXToMem(
     946              :             CcuInstr* instr, uint16_t dst, uint16_t src, uint16_t len, const CacheConfig& cacheConfig,
     947              :             uint16_t setCKEId, uint16_t setCKEMask);
     948              : 
     949              :         void Assign(CcuInstr* instr, uint16_t result, uint16_t operand, uint16_t setCKEId = 0, uint16_t setCKEMask = 0);
     950              :         void
     951              :         AssignI(CcuInstr* instr, uint16_t result, uint64_t operand, uint16_t setCKEId = 0, uint16_t setCKEMask = 0);
     952              : 
     953              :         void
     954              :         Add(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     955              :             uint16_t setCKEMask = 0);
     956              :         void AddI(
     957              :             CcuInstr* instr, uint16_t result, uint16_t operand, uint16_t imm, uint16_t setCKEId = 0,
     958              :             uint16_t setCKEMask = 0);
     959              :         void
     960              :         Sub(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     961              :             uint16_t setCKEMask = 0);
     962              :         void SubI(
     963              :             CcuInstr* instr, uint16_t result, uint16_t operand, uint16_t imm, uint16_t setCKEId = 0,
     964              :             uint16_t setCKEMask = 0);
     965              :         void
     966              :         Mul(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     967              :             uint16_t setCKEMask = 0);
     968              :         void MulI(
     969              :             CcuInstr* instr, uint16_t result, uint16_t operand, uint16_t imm, uint16_t setCKEId = 0,
     970              :             uint16_t setCKEMask = 0);
     971              : 
     972              :         void
     973              :         And(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     974              :             uint16_t setCKEMask = 0);
     975              :         void
     976              :         Or(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     977              :            uint16_t setCKEMask = 0);
     978              :         void
     979              :         Xor(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     980              :             uint16_t setCKEMask = 0);
     981              :         void Not(CcuInstr* instr, uint16_t result, uint16_t operand, uint16_t setCKEId = 0, uint16_t setCKEMask = 0);
     982              : 
     983              :         void
     984              :         SLL(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     985              :             uint16_t setCKEMask = 0);
     986              :         void
     987              :         SRL(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     988              :             uint16_t setCKEMask = 0);
     989              :         void
     990              :         SLA(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     991              :             uint16_t setCKEMask = 0);
     992              :         void
     993              :         SRA(CcuInstr* instr, uint16_t result, uint16_t operand1, uint16_t operand2, uint16_t setCKEId = 0,
     994              :             uint16_t setCKEMask = 0);
     995              : 
     996              :         void Loop(
     997              :             CcuInstr* instr, uint16_t startInstrId, uint16_t endInstrId, uint16_t iterNum, uint16_t offset,
     998              :             uint16_t contextId);
     999              :         void LoopGroup(
    1000              :             CcuInstr* instr, uint16_t startLoopInstrId, uint16_t loopGroupConfig, uint16_t resOffset,
    1001              :             uint16_t xnOffset);
    1002              :         void Jump(
    1003              :             CcuInstr* instr, uint16_t relTarInstrXnId, uint16_t conditionXnId, uint16_t expectedXnId,
    1004              :             uint16_t conditionType);
    1005              :         void Wait(CcuInstr* instr, uint16_t conditionXnId, uint16_t expectedXnId, uint16_t conditionType);
    1006              :         void Fence(CcuInstr* instr);
    1007              :         void SetCKE(
    1008              :             CcuInstr* instr, uint16_t setCKEId, uint16_t setCKEMask, uint16_t waitCKEId, uint16_t waitCKEMask,
    1009              :             uint16_t clearType);
    1010              :         void ClearCKE(
    1011              :             CcuInstr* instr, uint16_t clearCKEId, uint16_t clearMask, uint16_t waitCKEId, uint16_t waitCKEMask,
    1012              :             uint16_t clearType);
    1013              : 
    1014              :         void TransLocMemToLocMS(
    1015              :             CcuInstr* instr, uint16_t ms, uint16_t src, uint16_t srcToken, uint16_t len, uint16_t offset,
    1016              :             uint16_t setCKEId, uint16_t setCKEMask, const CacheConfig& cacheConfig);
    1017              :         void TransLocMSToLocMem(
    1018              :             CcuInstr* instr, uint16_t dst, uint16_t dstToken, uint16_t ms, uint16_t len, uint16_t offset,
    1019              :             uint16_t setCKEId, uint16_t setCKEMask, const CacheConfig& cacheConfig);
    1020              :         void TransLocMemToLocMem(
    1021              :             CcuInstr* instr, uint16_t dst, uint16_t dstToken, uint16_t src, uint16_t srcToken, uint16_t len,
    1022              :             uint16_t usedMSId, uint16_t usedMSNum, uint16_t setCKEId, uint16_t setCKEMask,
    1023              :             const CacheConfig& srcCacheConfig, const CacheConfig& dstcacheConfig);
    1024              :         void TransMem(
    1025              :             CcuInstr* instr, uint16_t dst, uint16_t dstToken, uint16_t src, uint16_t srcToken, uint16_t len,
    1026              :             uint16_t channel, const TransMemNotifyInfo& notify, const TransMemReduceInfo& reduce,
    1027              :             const TransMemConfig& config, uint16_t setCKEId, uint16_t setCKEMask);
    1028              :         void SyncWtX(
    1029              :             CcuInstr* instr, const TransMemNotifyInfo& notify, uint16_t channelId, uint16_t setCKEId,
    1030              :             uint16_t setCKEMask);
    1031              :         void SyncWtX(
    1032              :             CcuInstr* instr, uint16_t dst, uint16_t dstToken, uint16_t xn, uint16_t channelId,
    1033              :             const TransMemNotifyInfo& notify, uint16_t setCKEId, uint16_t setCKEMask);
    1034              :         void SyncAtX(
    1035              :             CcuInstr* instr, uint16_t dstAddr, uint16_t dstToken, uint16_t srcId, uint16_t channelId, uint16_t setCKEId,
    1036              :             uint16_t setCKEMask);
    1037              :         void ReduceAdd(
    1038              :             CcuInstr* instr, const uint16_t* ms, uint16_t count, uint16_t castEn, uint16_t dataType, uint16_t setCKEId,
    1039              :             uint16_t setCKEMask, uint16_t XnIdLength);
    1040              :         void ReduceMax(
    1041              :             CcuInstr* instr, const uint16_t* ms, uint16_t count, uint16_t dataType, uint16_t setCKEId,
    1042              :             uint16_t setCKEMask, uint16_t XnIdLength);
    1043              :         void ReduceMin(
    1044              :             CcuInstr* instr, const uint16_t* ms, uint16_t count, uint16_t dataType, uint16_t setCKEId,
    1045              :             uint16_t setCKEMask, uint16_t XnIdLength);
    1046              :         void RelJmp(CcuInstr* instr, uint16_t targetXnId, uint32_t jmpInstrId, uint16_t xn0, uint16_t xn1);
    1047              :         std::string ParseInstrV2(const CcuInstr* instr);
    1048              :     }; // namespace CcuV2
    1049              : 
    1050              : }; // namespace CcuRep
    1051              : }; // namespace hcomm
    1052              : 
    1053              : #endif // CCU_MICROCODE_H
        

Generated by: LCOV version 2.0-1