diff options
author | Pavel V. Shatov (Meister) <meisterpaul1@yandex.ru> | 2020-02-03 22:43:48 +0300 |
---|---|---|
committer | Pavel V. Shatov (Meister) <meisterpaul1@yandex.ru> | 2020-02-03 22:43:48 +0300 |
commit | f2598e0ec96852ced07cff5a6baa91b0ff1dc00f (patch) | |
tree | 1cc1aed57c637851d218742eb84897ddf4d58a0d | |
parent | 58ad4d95d6de1f62bb3664e3782d8f6ae9c691f0 (diff) |
Improved debugging options:
* flush console after each ladder iteration for smoother progress output
* ability to truncate internal powering ladder loop at desired step (this will
only work when using simulation mode, obviously)
-rw-r--r-- | rtl/modexpng_io_manager.v | 21 | ||||
-rw-r--r-- | rtl/modexpng_io_manager_debug.vh | 2 |
2 files changed, 21 insertions, 2 deletions
diff --git a/rtl/modexpng_io_manager.v b/rtl/modexpng_io_manager.v index fdbc4af..2b71779 100644 --- a/rtl/modexpng_io_manager.v +++ b/rtl/modexpng_io_manager.v @@ -345,6 +345,14 @@ module modexpng_io_manager // // Ladder Init/Step Logic // + +`ifdef MODEXPNG_ENABLE_DEBUG +//`define DEFINE_MODEXPNG_TRUNCATE_LADDER XXX /*specify step index to abort ladder*/ +`ifdef DEFINE_MODEXPNG_TRUNCATE_LADDER +localparam [BIT_INDEX_W-1:0] MODEXPNG_TRUNCATE_LADDER = `DEFINE_MODEXPNG_TRUNCATE_LADDER; +`endif +`endif + reg ladder_d_r; reg ladder_p_r; reg ladder_q_r; @@ -360,8 +368,8 @@ module modexpng_io_manager wire [ OP_ADDR_W -1:0] ladder_index_msb = ladder_index[BIT_INDEX_W-1-: OP_ADDR_W]; wire [ WORD_MUX_W -1:0] ladder_index_lsb = ladder_index[ WORD_MUX_W-1-:WORD_MUX_W]; wire ladder_index_is_zero = ladder_index == BIT_INDEX_ZERO; - - always @(posedge clk) + + always @(posedge clk) begin // if (io_fsm_state_next == IO_FSM_STATE_LATENCY_PRE1) begin // @@ -378,6 +386,15 @@ module modexpng_io_manager end // end + // +`ifdef MODEXPNG_ENABLE_DEBUG +`ifdef DEFINE_MODEXPNG_TRUNCATE_LADDER + if ((io_fsm_state_next == IO_FSM_STATE_STOP) && opcode_is_ladder_step && (ladder_index == MODEXPNG_TRUNCATE_LADDER)) + ladder_done_r <= 1'b1; +`endif +`endif + // + end // diff --git a/rtl/modexpng_io_manager_debug.vh b/rtl/modexpng_io_manager_debug.vh index e94ec67..3d50cc6 100644 --- a/rtl/modexpng_io_manager_debug.vh +++ b/rtl/modexpng_io_manager_debug.vh @@ -36,6 +36,8 @@ always @(posedge clk) if (opcode_is_ladder_init) begin $display("[step] | D | P | Q"); $display("-------+---+---+---"); + $fflush; end else if (opcode_is_ladder_step) $display("[%4d] | %d | %d | %d", ladder_index, ladder_d_r, ladder_p_r, ladder_q_r); + $fflush; end |