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

Generated by: LCOV version 2.0-1