From 12f542441df41621e012b3699693a9e3a438cb6d Mon Sep 17 00:00:00 2001 From: Raphael Jacquot Date: Fri, 15 Mar 2019 11:35:33 +0100 Subject: [PATCH] pipeline rstk_ptr calculations for push --- saturn_bus.v | 2 +- saturn_regs_pc_rstk.v | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/saturn_bus.v b/saturn_bus.v index ef70996..57f8e08 100644 --- a/saturn_bus.v +++ b/saturn_bus.v @@ -202,7 +202,7 @@ always @(posedge i_clk) begin end `ifdef SIM - if (cycle_ctr == 148) begin + if (cycle_ctr == 202) begin bus_halt <= 1'b1; $display("BUS %0d: [%d] enough cycles for now", phase, cycle_ctr); end diff --git a/saturn_regs_pc_rstk.v b/saturn_regs_pc_rstk.v index dd91074..8a6919b 100644 --- a/saturn_regs_pc_rstk.v +++ b/saturn_regs_pc_rstk.v @@ -219,9 +219,9 @@ always @(posedge i_clk) begin // o_reload_pc <= 1'b1; reg_PC <= jump_relative ? jump_next_offset + jump_base : jump_next_offset; if (i_push_pc) begin - $write(" ( push %5h => RSTK[%0d] )", reg_PC, reg_rstk_ptr + 3'd1); - reg_RSTK[(reg_rstk_ptr + 3'o1)&3'o7] <= reg_PC; - reg_rstk_ptr <= reg_rstk_ptr + 3'd1; + $write(" ( push %5h => RSTK[%0d] )", reg_PC, rstk_ptr_to_push_at); + reg_RSTK[rstk_ptr_to_push_at] <= reg_PC; + reg_rstk_ptr <= rstk_ptr_to_push_at; end $write("\n"); end