Skip to content

Commit

Permalink
#3764: Pack launch msg fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-tenstorrent committed Jul 10, 2024
1 parent e642070 commit 2583943
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tt_metal/hw/inc/dev_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ constexpr uint32_t RUN_SYNC_MSG_ALL_TRISCS_GO = 0x80808000;
constexpr uint32_t RUN_SYNC_MSG_ALL_GO = 0x80808080;
constexpr uint32_t RUN_SYNC_MSG_ALL_SLAVES_DONE = 0;

// Launch message packing masks and shifts
constexpr uint8_t DISPATCH_CORE_X_MASK = 0x0F;
constexpr uint8_t DISPATCH_CORE_X_SHIFT = 0;
constexpr uint8_t DISPATCH_CORE_Y_MASK = 0x0F;
constexpr uint8_t DISPATCH_CORE_Y_SHIFT = 4;

constexpr uint8_t DISPATCH_MODE_MASK = 0x0F;
constexpr uint8_t DISPATCH_MODE_SHIFT = 0;
constexpr uint8_t BRISC_NOC_ID_MASK = 0x0F;
constexpr uint8_t BRISC_NOC_ID_SHIFT = 4;

inline __attribute__((always_inline)) uint8_t launchMsgFieldPack (uint8_t field, uint8_t value, uint8_t mask, uint8_t shift){
return (field & ~(mask << shift) | ((value & mask) << shift));
}

inline __attribute__((always_inline)) uint8_t launchMsgFieldUnPack (uint8_t field, uint8_t mask, uint8_t shift){
return ((field >> shift) & mask);
}
struct ncrisc_halt_msg_t {
volatile uint32_t resume_addr;
volatile uint32_t stack_save;
Expand Down

0 comments on commit 2583943

Please sign in to comment.