[Cryptech-Commits] [core/math/modexpng] 87/92: 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)
git at cryptech.is
git at cryptech.is
Sat Mar 14 18:20:06 UTC 2020
This is an automated email from the git hooks/post-receive script.
paul at psgd.org pushed a commit to branch master
in repository core/math/modexpng.
commit f2598e0ec96852ced07cff5a6baa91b0ff1dc00f
Author: Pavel V. Shatov (Meister) <meisterpaul1 at yandex.ru>
AuthorDate: Mon Feb 3 22:43:48 2020 +0300
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)
---
rtl/modexpng_io_manager.v | 21 +++++++++++++++++++--
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
More information about the Commits
mailing list