Skip to content

Commit

Permalink
#8602: Remove some dead code from address map
Browse files Browse the repository at this point in the history
  • Loading branch information
pgkeller committed Jun 19, 2024
1 parent 3289214 commit de671ff
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 85 deletions.
34 changes: 0 additions & 34 deletions tt_metal/hostdevcommon/common_runtime_address_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
51 changes: 0 additions & 51 deletions tt_metal/hw/inc/risc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<volatile tt_l1_ptr uint32_t*>(BREAKPOINT);
bp[0] = 1;

lnum = reinterpret_cast<volatile tt_l1_ptr uint32_t*>(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"
Expand Down

0 comments on commit de671ff

Please sign in to comment.