From de671fff1909422683861f4b8ae05fff02f59e03 Mon Sep 17 00:00:00 2001 From: Paul Keller Date: Tue, 18 Jun 2024 15:41:26 +0000 Subject: [PATCH] #8602: Remove some dead code from address map --- .../common_runtime_address_map.h | 34 ------------- tt_metal/hw/inc/risc_common.h | 51 ------------------- 2 files changed, 85 deletions(-) diff --git a/tt_metal/hostdevcommon/common_runtime_address_map.h b/tt_metal/hostdevcommon/common_runtime_address_map.h index 2851acd7ef2..6b4e8ae68fd 100644 --- a/tt_metal/hostdevcommon/common_runtime_address_map.h +++ b/tt_metal/hostdevcommon/common_runtime_address_map.h @@ -80,40 +80,6 @@ constexpr static std::uint32_t PRINT_BUFFER_IDLE_ER = PRINT_BUFFER_START; // Idl constexpr static std::uint32_t RING_BUFFER_ADDR = PRINT_BUFFER_START + PRINT_BUFFER_MAX_SIZE; constexpr static std::uint32_t RING_BUFFER_SIZE = 128; -// Breakpoint regions -constexpr static std::uint32_t NCRISC_BREAKPOINT = PRINT_BUFFER_START; -constexpr static std::uint32_t TRISC0_BREAKPOINT = NCRISC_BREAKPOINT + 4; -constexpr static std::uint32_t TRISC1_BREAKPOINT = TRISC0_BREAKPOINT + 4; -constexpr static std::uint32_t TRISC2_BREAKPOINT = TRISC1_BREAKPOINT + 4; -constexpr static std::uint32_t BRISC_BREAKPOINT = TRISC2_BREAKPOINT + 4; - -// Frame pointer addresses for breakpoint... first create macros -// since I need them for inline assembly -#define NCRISC_SP_MACRO (BRISC_BREAKPOINT + 4) -#define TRISC0_SP_MACRO (NCRISC_SP_MACRO + 4) -#define TRISC1_SP_MACRO (TRISC0_SP_MACRO + 4) -#define TRISC2_SP_MACRO (TRISC1_SP_MACRO + 4) -#define BRISC_SP_MACRO (TRISC2_SP_MACRO + 4) - -// Brekapoint call line number macros -#define NCRISC_BP_LNUM_MACRO (BRISC_SP_MACRO + 4) -#define TRISC0_BP_LNUM_MACRO (NCRISC_BP_LNUM_MACRO + 4) -#define TRISC1_BP_LNUM_MACRO (TRISC0_BP_LNUM_MACRO + 4) -#define TRISC2_BP_LNUM_MACRO (TRISC1_BP_LNUM_MACRO + 4) -#define BRISC_BP_LNUM_MACRO (TRISC2_BP_LNUM_MACRO + 4) - -constexpr static std::uint32_t NCRISC_SP = NCRISC_SP_MACRO; -constexpr static std::uint32_t TRISC0_SP = TRISC0_SP_MACRO; -constexpr static std::uint32_t TRISC1_SP = TRISC1_SP_MACRO; -constexpr static std::uint32_t TRISC2_SP = TRISC2_SP_MACRO; -constexpr static std::uint32_t BRISC_SP = BRISC_SP_MACRO; - -constexpr static std::uint32_t NCRISC_BP_LNUM = NCRISC_BP_LNUM_MACRO; -constexpr static std::uint32_t TRISC0_BP_LNUM = TRISC0_BP_LNUM_MACRO; -constexpr static std::uint32_t TRISC1_BP_LNUM = TRISC1_BP_LNUM_MACRO; -constexpr static std::uint32_t TRISC2_BP_LNUM = TRISC2_BP_LNUM_MACRO; -constexpr static std::uint32_t BRISC_BP_LNUM = BRISC_BP_LNUM_MACRO; - constexpr static std::uint32_t L1_UNRESERVED_BASE = (((RING_BUFFER_ADDR + RING_BUFFER_SIZE) - 1) | (32 - 1)) + 1; constexpr static std::uint32_t ERISC_L1_UNRESERVED_BASE = L1_UNRESERVED_BASE; // Start of unreserved space diff --git a/tt_metal/hw/inc/risc_common.h b/tt_metal/hw/inc/risc_common.h index ecf7dc2bc34..755161b2b30 100644 --- a/tt_metal/hw/inc/risc_common.h +++ b/tt_metal/hw/inc/risc_common.h @@ -148,57 +148,6 @@ void risc_init() { } #endif // !defined(COMPILE_FOR_TRISC) -inline void breakpoint_(uint32_t line) { - /* - When called, writes the stack pointer to a known location - in memory (unique for each core) and then hangs until the - user explicitly continues - */ - uint32_t BREAKPOINT; - uint32_t LNUM; - volatile tt_l1_ptr uint32_t* bp; - volatile tt_l1_ptr uint32_t* lnum; - -#define MACRO_SP_AUX(SP) #SP -#define MACRO_SP(SP) MACRO_SP_AUX(SP) - -// Need to use macros for inline assembly in order to create a string literal -#if defined(COMPILE_FOR_NCRISC) - asm("li t0, " MACRO_SP(NCRISC_SP_MACRO)); - BREAKPOINT = NCRISC_BREAKPOINT; - LNUM = NCRISC_BP_LNUM; -#elif defined(COMPILE_FOR_BRISC) - asm("li t0, " MACRO_SP(BRISC_SP_MACRO)); - BREAKPOINT = BRISC_BREAKPOINT; - LNUM = BRISC_BP_LNUM; -#elif COMPILE_FOR_TRISC == 0 - asm("li t0, " MACRO_SP(TRISC0_SP_MACRO)); - BREAKPOINT = TRISC0_BREAKPOINT; - LNUM = TRISC0_BP_LNUM; -#elif COMPILE_FOR_TRISC == 1 - asm("li t0, " MACRO_SP(TRISC1_SP_MACRO)); - BREAKPOINT = TRISC1_BREAKPOINT; - LNUM = TRISC1_BP_LNUM; -#elif COMPILE_FOR_TRISC == 2 - asm("li t0, " MACRO_SP(TRISC2_SP_MACRO)); - BREAKPOINT = TRISC2_BREAKPOINT; - LNUM = TRISC2_BP_LNUM; -#endif - - // Write '1' to breakpoint location so that this core keeps - // busy looping until host releases it - asm("sw sp, 0(t0)"); - bp = reinterpret_cast(BREAKPOINT); - bp[0] = 1; - - lnum = reinterpret_cast(LNUM); - lnum[0] = line; - - while (bp[0] == 1); -} - -#define breakpoint() breakpoint_(__LINE__); - // Helper function to wait for a specified number of cycles, safe to call in erisc kernels. #if defined(COMPILE_FOR_ERISC) #include "erisc.h"