Skip to content

Commit

Permalink
Merge pull request #24 from hungalab/features/enhance_lat_gdb_#22_#23
Browse files Browse the repository at this point in the history
Features/enhance lat gdb #22 #23
  • Loading branch information
tkojima0107 authored Jul 4, 2020
2 parents a5329fd + d0d8b71 commit 511447e
Show file tree
Hide file tree
Showing 36 changed files with 956 additions and 77 deletions.
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ SOURCES = cpu.cc cpzero.cc devicemap.cc \
routerinterface.cc routerinterface.h router.cc router.h \
accelerator.h accelerator.cc \
remoteram.h remoteram.cc cma.h cma.cc cmamodules.cc cmamodules.h \
cmaAddressMap.h dbuf.h dbuf.cc snacc.cc snacc.h snacccore.c snacccore.h \
snaccAddressMap.h snaccmodules.c snaccmodules.h
cmaAddressMap.h dbuf.h dbuf.cc snacc.cc snacc.h snacccore.cc snacccore.h \
snaccAddressMap.h snaccmodules.cc snaccmodules.h \
debugutils.cc debugutils.h

OBJECTS = cpu.$(OBJEXT) cpzero.$(OBJEXT) devicemap.$(OBJEXT) \
mapper.$(OBJEXT) options.$(OBJEXT) range.$(OBJEXT) \
Expand All @@ -58,7 +59,8 @@ OBJECTS = cpu.$(OBJEXT) cpzero.$(OBJEXT) devicemap.$(OBJEXT) \
routerinterface.${OBJEXT} router.${OBJEXT} \
remoteram.${OBJEXT} accelerator.${OBJEXT} \
cma.${OBJEXT} cmamodules.${OBJEXT} dbuf.${OBJEXT} \
snacc.${OBJEXT} snacccore.${OBJEXT} snaccmodules.${OBJEXT}
snacc.${OBJEXT} snacccore.${OBJEXT} snaccmodules.${OBJEXT} \
debugutils.${OBJEXT}

LDADD = libopcodes_mips/libopcodes_mips.a

Expand Down Expand Up @@ -144,15 +146,15 @@ vmips.o: vmips.cc clock.h task.h types.h config.h \
testdev.h stub-dis.h libopcodes_mips/bfd.h libopcodes_mips/ansidecl.h \
libopcodes_mips/symcat.h libopcodes_mips/dis-asm.h rommodule.h \
interactor.h rs232c.h routerinterface.h remoteram.h accelerator.h \
cma.h snacc.h dmac.h
cma.h snacc.h dmac.h debugutils.h

deviceint.o: deviceint.cc deviceint.h intctrl.h types.h config.h \
vmips.h

debug.o: debug.cc debug.h deviceexc.h accesstypes.h types.h config.h \
remotegdb.h cpu.h \
vmips.h mapper.h range.h \
excnames.h cpzeroreg.h options.h
excnames.h cpzeroreg.h options.h debugutils.h

remotegdb.o: remotegdb.cc remotegdb.h types.h config.h

Expand Down Expand Up @@ -237,22 +239,26 @@ routerinterface.o: routerinterface.cc routerinterface.h\
router.o: router.cc router.h vmips.h options.h

accelerator.o: accelerator.h accelerator.cc \
range.h router.h error.h options.h vmips.h
range.h router.h error.h options.h vmips.h debugutils.h

remoteram.o: remoteram.cc remoteram.h accelerator.h memorymodule.h
remoteram.o: remoteram.cc remoteram.h accelerator.h \
memorymodule.h debugutils.h

dbuf.o: dbuf.h dbuf.cc range.h types.h fileutils.h vmips.h options.h

cma.o: cma.cc cma.h accelerator.h dbuf.h accesstypes.h\
types.h cmamodules.h cmaAddressMap.h
types.h cmamodules.h cmaAddressMap.h debugutils.h

cmamodules.o: cmamodules.h cmamodules.cc cmaAddressMap.h range.h \
dbuf.h accelerator.h

snacc.o: snacc.h snacc.cc dbuf.h snaccAddressMap.h snaccmodules.h
snacc.o: snacc.h snacc.cc dbuf.h snaccAddressMap.h snaccmodules.h \
debugutils.h

snacccore.o: snacccore.h snacccore.cc vmips.h options.h \
snaccmodules.h snaccAddressMap.h

snaccmodules.o: snaccmodules.h snaccmodules.cc snaccAddressMap.h \
accesstypes.h
accesstypes.h

debugutils.o: debugutils.cc debugutils.h devicemap.h vmips.h mapper.h
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ VMIPSから備わっているオプションに関しては[VMIPSのドキュメ
* dcachebnum: データキャッシュのブロック数 (数値)
#### メモリアクセス関連
* mem_bandwidth: メモリバンド幅 (ワード数を指定する) (数値)
* bus_latency: 内部バスにおける遅延サイクル数 (数値)
* bus_latency: バスアクセス権獲得後にメモリモジュールに要求が到達するまでのサイクル数 (数値)
* exmem_latency: 外部メモリにおける遅延サイクル数 (数値)

#### ルータ関連
* vcbufsize: virtual channelごとのバッファサイズ (数値)
* routermsg: ルータにおけるメッセージ表示有効化 (flag)
Expand All @@ -77,7 +78,7 @@ VMIPSから備わっているオプションに関しては[VMIPSのドキュメ
* accelerator1: 1番目のアクセラレータ (文字列)
* accelerator2: 2番目のアクセラレータ (文字列)

#### SNACC向けオプション
#### SNACC用オプション
* snacc_sram_latency: オンチップSRAMのレイテンシ (数値)
* snacc_inst_dump: コアで実行した命令をダンプする (文字列: 形式 "(チップID,コアID)")
* snacc_mad_debug: コアのmadユニットでの計算を表示する (文字列: 形式 "(チップID,コアID)")
Expand All @@ -89,3 +90,4 @@ VMIPSから備わっているオプションに関しては[VMIPSのドキュメ
* cacheprof: キャッシュアクセス数、ミス率など (bool)
* routerprof: 転送フリット数など (bool)
* exmemprof: 外部メモリへのアクセス数 (bool)

3 changes: 2 additions & 1 deletion accelerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "router.h"
#include "types.h"
#include "range.h"
#include "debugutils.h"

#define DONE_NOTIF_ADDR 0x00000
#define DMAC_NOTIF_ADDR 0x00001
Expand Down Expand Up @@ -107,7 +108,7 @@ class NetworkInterfaceConfig : public Range {
};

//abstract class for accelerator top module
class CubeAccelerator {
class CubeAccelerator : public DebuggerClient {
private:
//data to/from router
bool iready[VCH_SIZE];
Expand Down
85 changes: 83 additions & 2 deletions cma.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "cma.h"
#include "debugutils.h"

using namespace CMAComponents;

Expand All @@ -17,7 +18,7 @@ CMA::CMA(uint32 node_ID, Router* upperRouter)
imem = new DoubleBuffer(CMA_IMEM_SIZE, CMA_IWORD_MASK);

// const regs
const_reg = new ConstRegCtrl(CMA_CONST_SIZE, pearray);
const_reg = new ConstRegCtrl(CMA_CONST_SIZE * 2, pearray);

// Data manipulator
ld_unit = new LDUnit(CMA_PE_ARRAY_WIDTH, &dbank, pearray);
Expand All @@ -37,6 +38,10 @@ CMA::CMA(uint32 node_ID, Router* upperRouter)
// Microcontroller
mc = new MicroController(imem, ld_unit, st_unit, &mc_done);

//for debugger
debug_op = DBG_CMD_NOP;
resp_data = 0;

}

CMA::~CMA()
Expand Down Expand Up @@ -117,4 +122,80 @@ void CMA::core_step()
mc_working = false;
mc->reset();
}
}
}

void CMA::send_commnad(uint32 cmd, uint32 arg) {
uint8 func, mod, offset;
__cmd_parser(cmd, debug_op, func, mod, offset);
switch (debug_op) {
case DBG_CMD_SETTRG_OP:
trgr_arg = arg;
trgr_cnd = func;
trgr_mod = mod;
trgr_offset = offset;
break;
case DBG_CMD_WRITE_OP:
debug_store(mod, offset, arg);
break;
case DBG_CMD_READ_OP:
resp_data = debug_fetch(mod, offset);
break;
default:
debug_op = DBG_CMD_NOP;
}
}

bool CMA::isTriggered()
{
uint32 mod_val = debug_fetch(trgr_mod, trgr_offset);
fprintf(stderr, "mod(%d, %d) %X arg %X\n", trgr_mod, trgr_offset, mod_val, trgr_arg);
return __compare(mod_val, trgr_arg, trgr_cnd);
}

uint32 CMA::get_dbg_data()
{
return resp_data;
}

uint32 CMA::debug_fetch(uint8 mod, uint8 offset)
{
switch (mod) {
case CMA_DEBUG_MOD_PC:
return mc->debug_fetch_pc();
case CMA_DEBUG_MOD_RF:
return mc->debug_fetch_regfile(offset);
case CMA_DEBUG_MOD_LR:
return pearray->debug_fetch_launch(offset);
case CMA_DEBUG_MOD_GR:
return pearray->debug_fetch_gather(offset);
case CMA_DEBUG_MOD_ALU_L:
case CMA_DEBUG_MOD_ALU_R:
case CMA_DEBUG_MOD_ALU_O:
return pearray->debug_fetch_ALU(offset, mod);
default:
return 0;
}
}

void CMA::debug_store(uint8 mod, uint8 offset, uint32 data)
{
switch (mod) {
case CMA_DEBUG_MOD_PC:
mc->debug_store_pc(data);
break;
case CMA_DEBUG_MOD_RF:
mc->debug_store_regfile(offset, data);
break;
case CMA_DEBUG_MOD_LR:
pearray->debug_store_launch(offset, data);
break;
case CMA_DEBUG_MOD_GR:
pearray->debug_store_gather(offset, data);
break;
case CMA_DEBUG_MOD_ALU_L:
case CMA_DEBUG_MOD_ALU_R:
case CMA_DEBUG_MOD_ALU_O:
return pearray->debug_store_ALU(offset, mod, data);
break;
}
}
15 changes: 15 additions & 0 deletions cma.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "cmaAddressMap.h"
#include "dbuf.h"


class DeviceExc;
class CubeAccelerator;
class MemoryModule;
Expand All @@ -34,16 +35,30 @@ class CMA : public CubeAccelerator {
bool mc_working;
bool done_notif;

//for debug
uint8 trgr_cnd, trgr_mod, trgr_offset;
uint8 debug_op;
uint32 trgr_arg;
uint32 resp_data;
uint32 debug_fetch(uint8 mod, uint8 offset);
void debug_store(uint8 mod, uint8 offset, uint32 data);

public:
CMA(uint32 node_ID, Router* upperRouter);
~CMA();

void setup();
void core_step();
void core_reset();

const char *accelerator_name() { return "CMA"; }

CMAComponents::ControlReg *ctrl_reg;

//for debuger
virtual void send_commnad(uint32 cmd, uint32 arg);
virtual bool isTriggered();
virtual uint32 get_dbg_data();
};


Expand Down
Loading

0 comments on commit 511447e

Please sign in to comment.