[NPUBINFMT] Add an NPU (i.e., arch) version in npubinfmt
authorDongju Chae <dongju.chae@samsung.com>
Thu, 23 Jul 2020 09:00:04 +0000 (18:00 +0900)
committer송욱/On-Device Lab(SR)/Staff Engineer/삼성전자 <wook16.song@samsung.com>
Mon, 27 Jul 2020 02:30:28 +0000 (11:30 +0900)
This patch adds an NPU version (e.g., v2.1.1) in npubinfmt

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
include/common/npubinfmt.h

index ea9ed54..abbc10d 100644 (file)
@@ -55,6 +55,11 @@ static inline uint64_t NPUBIN_META_TOTAL_SIZE (uint64_t magiccode) {
 #define NPUBIN_VERSION(magiccode) ((magiccode) & 0xFFULL)
 #define CHECK_NPUBIN(magiccode) (((magiccode) & ~0xFFFFFFULL) == NPUBIN_MAGICCODE)
 
+/* npubinfmt npu_version macros */
+#define NPU_VERSION_MAJOR(npu_version) ((npu_version) & 0x0000FFULL)
+#define NPU_VERSION_MINOR(npu_version) (((npu_version) & 0x00FF00ULL) >> 8)
+#define NPU_VERSION_EXTRA(npu_version) (((npu_version) & 0xFF0000ULL) >> 16)
+
 /**************************************************
  * NPU Binary Format: "Main"                      *
  **************************************************
@@ -100,6 +105,15 @@ typedef struct {
        * which is equal to NPUBIN_META_TOTAL_SIZE(magiccode).
        */
       uint64_t magiccode;     /**< npubinfmt's magiccode */
+      /**
+       * Descriptions for npu_version (64 bits)
+       *
+       *       Little-Endian Byte Order
+       *  ---------------------+----------------
+       * |  63 - 24  | 23 - 16 | 15 - 8 | 7 - 0 |
+       * |  RESERVED |  EXTRA  |  MINOR | MAJOR |
+       *  --------------------------------------
+       */
       uint64_t npu_version;
       uint64_t compiler_version;