diff options
author | Pavel V. Shatov (Meister) <meisterpaul1@yandex.ru> | 2019-10-21 12:56:30 +0300 |
---|---|---|
committer | Pavel V. Shatov (Meister) <meisterpaul1@yandex.ru> | 2019-10-21 12:56:30 +0300 |
commit | 9eac252242c69e51a38a9a88c87b564dd40b6257 (patch) | |
tree | ab6653950a7f2a811598c73f15116fa5c009ec5c /rtl/modexpng_io_manager.v | |
parent | 36339014ec3d3ad3bb4622392d5075d674e7dbeb (diff) |
Entire CRT signature algorithm works by now.
Moved micro-operations handler into a separate module file, this way we don't
have any synthesized stuff in the top-level module, just instantiations. This
is more consistent from the design partitioning point of view. Btw, Xilinx
claims their tools work better that way too, but who knows...
Added optional simulation-only code to assist debugging. Un-comment the
ENABLE_DEBUG `define in 'rtl/modexpng_parameters.vh' to use, but don't ever
try to synthesize the core with debugging enabled.
Diffstat (limited to 'rtl/modexpng_io_manager.v')
-rw-r--r-- | rtl/modexpng_io_manager.v | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/rtl/modexpng_io_manager.v b/rtl/modexpng_io_manager.v index 59f4709..da2bdac 100644 --- a/rtl/modexpng_io_manager.v +++ b/rtl/modexpng_io_manager.v @@ -52,8 +52,8 @@ module modexpng_io_manager io_out_addr, io_out_dout, - wrk_narrow_x_din_x_trunc, - wrk_narrow_x_din_y_trunc, + wrk_narrow_x_din_x_lsb, + wrk_narrow_x_din_y_lsb, ladder_steps, ladder_d, @@ -124,8 +124,8 @@ module modexpng_io_manager output [BANK_ADDR_W + OP_ADDR_W -1:0] io_out_addr; output [ WORD_W -1:0] io_out_dout; - output [ WORD_W -1:0] wrk_narrow_x_din_x_trunc; - output [ WORD_W -1:0] wrk_narrow_x_din_y_trunc; + input [ WORD_W -1:0] wrk_narrow_x_din_x_lsb; + input [ WORD_W -1:0] wrk_narrow_x_din_y_lsb; input [ BIT_INDEX_W -1:0] ladder_steps; output ladder_d; @@ -481,7 +481,7 @@ module modexpng_io_manager if (opcode_is_input_narrow && sel_crt_is_x) {narrow_x_din_x, narrow_y_din_x} <= {2{io_in_dout_mux}}; if (opcode_is_input_narrow && sel_crt_is_y) {narrow_x_din_y, narrow_y_din_y} <= {2{io_in_dout_mux}}; // - if (opcode_is_output) out_dout <= sel_crt_is_x ? wrk_narrow_x_din_x_trunc : wrk_narrow_x_din_y_trunc; + if (opcode_is_output) out_dout <= sel_crt_is_x ? wrk_narrow_x_din_x_lsb: wrk_narrow_x_din_y_lsb; // end // @@ -490,7 +490,7 @@ module modexpng_io_manager if (opcode_is_input_narrow && sel_crt_is_x && sel_in_needs_extra) {narrow_x_din_x, narrow_y_din_x} <= {2{io_in_dout_mux}}; if (opcode_is_input_narrow && sel_crt_is_y && sel_in_needs_extra) {narrow_x_din_y, narrow_y_din_y} <= {2{io_in_dout_mux}}; // - if (opcode_is_output) out_dout <= sel_crt_is_x ? wrk_narrow_x_din_x_trunc : wrk_narrow_x_din_y_trunc; + if (opcode_is_output) out_dout <= sel_crt_is_x ? wrk_narrow_x_din_x_lsb : wrk_narrow_x_din_y_lsb; // end // @@ -697,14 +697,18 @@ module modexpng_io_manager // // BEGIN DEBUG // + `ifdef MODEXPNG_ENABLE_DEBUG always @(posedge clk) // - if ((io_fsm_state == IO_FSM_STATE_STOP) && opcode_is_ladder) - $display("[%4d] / %d / %d / %d", ladder_index, ladder_d_r, ladder_p_r, ladder_q_r); - - // - // END DEBUG - // + if (io_fsm_state == IO_FSM_STATE_STOP) begin + if (opcode_is_ladder_init) begin + $display("[step] | D | P | Q"); + $display("-------+---+---+---"); + end else if (opcode_is_ladder_step) + $display("[%4d] | %d | %d | %d", ladder_index, ladder_d_r, ladder_p_r, ladder_q_r); + end + // + `endif endmodule |