From f0cd9e4e8bc1e1b109fff627c75527ee7195c82e Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Tue, 6 Oct 2020 18:48:26 +0200 Subject: add some debugging facility inside the cpu --- design/stack_machine.v | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'design') diff --git a/design/stack_machine.v b/design/stack_machine.v index 687168a..e6030e4 100644 --- a/design/stack_machine.v +++ b/design/stack_machine.v @@ -655,6 +655,42 @@ module stack_machine_new r1 <= r0; `SET_PC(r1); end + + if (first_execution_tick) begin + `DBG(("r0: %x r1: %x", r0, r1)); + `DBG(("CPU: Executing %0s instruction", + store ? "store (kind?)" : + load ? "load (kind?)" : + instr_halt ? "halt" : + instr_nop ? "nop" : + instr_swap ? "swap" : + instr_set_sp ? "set_sp" : + instr_jump ? "jump" : + instr_add_sp ? "add_sp" : + instr_tee ? "tee" : + instr_get_frame ? "get_frame" : + instr_const ? "const" : + instr_call ? "call" : + instr_add ? "add" : + instr_sub ? "sub" : + instr_udiv ? "udiv" : + instr_mul ? "mul" : + instr_drop ? "drop" : + instr_eq ? "eq" : + instr_lt ? "lt" : + instr_ult ? "ult" : + instr_le ? "le" : + instr_ule ? "ule" : + instr_gt ? "gt" : + instr_ugt ? "ugt" : + instr_ge ? "ge" : + instr_uge ? "uge" : + instr_ret ? "ret" : + instr_cond_jump ? "cond_jump" : + instr_cond_jump_n ? "cond_jump_n" : + set_im ? "im" : + "unknown")); + end // if (first_execution_tick) end // case: STEP_EXECUTING endcase // case (step) end // else: !if(RST_I) -- cgit v1.2.3