From affada8d5da7426d22035360c3674ab3b3311ab5 Mon Sep 17 00:00:00 2001 From: "Pavel V. Shatov (Meister)" Date: Thu, 3 Oct 2019 16:40:25 +0300 Subject: Reworked storage architecture (moved I/O memory to a separate module, since there's only one instance of input/output values, while storage manager has dual storage space for P and Q multipliers). Started working on microcoded layer, added input operation and modular multiplication. --- rtl/modexpng_microcode.vh | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 rtl/modexpng_microcode.vh (limited to 'rtl/modexpng_microcode.vh') diff --git a/rtl/modexpng_microcode.vh b/rtl/modexpng_microcode.vh new file mode 100644 index 0000000..af21391 --- /dev/null +++ b/rtl/modexpng_microcode.vh @@ -0,0 +1,54 @@ +localparam UOP_OPCODE_W = 4; +localparam UOP_CRT_W = 1; +localparam UOP_NPQ_W = 1; +localparam UOP_AUX_W = 1; +localparam UOP_LADDER_W = 1; +localparam UOP_SEL_W = 4 * BANK_ADDR_W; + +localparam UOP_ADDR_W = 6; // 64 instructions + +localparam [UOP_ADDR_W -1:0] UOP_ADDR_OFFSET_USING_CRT = 6'd0; +localparam [UOP_ADDR_W -1:0] UOP_ADDR_OFFSET_WITHOUT_CRT = 6'd31; + + +// 4 1 1 1 2 4*3=12 +localparam UOP_W = UOP_OPCODE_W + UOP_CRT_W + UOP_NPQ_W + UOP_AUX_W + UOP_LADDER_W + UOP_SEL_W; +// [20:17] [16] [15] [14] [13:12] [11:9][8:6][5:3][2:0] + +// OPCODE +localparam [UOP_OPCODE_W -1:0] UOP_OPCODE_STOP = 4'd0; + +localparam [UOP_OPCODE_W -1:0] UOP_OPCODE_INPUT_TO_WIDE = 4'd1; +localparam [UOP_OPCODE_W -1:0] UOP_OPCODE_INPUT_TO_NARROW = 4'd2; + +localparam [UOP_OPCODE_W -1:0] UOP_OPCODE_OUTPUT_FROM_NARROW = 4'd3; + +//localparam [UOP_OPCODE_W -1:0] UOP_OPCODE_COPY_CRT_Y2X = 4'd0; + +localparam [UOP_OPCODE_W -1:0] UOP_OPCODE_MODULAR_MULTIPLY = 4'd8; + +// CRT +localparam [UOP_CRT_W -1:0] UOP_CRT_X = 1'b0; +localparam [UOP_CRT_W -1:0] UOP_CRT_Y = 1'b1; +localparam [UOP_CRT_W -1:0] UOP_CRT_DNC = 1'bX; + +// NPQ +localparam [UOP_NPQ_W -1:0] UOP_NPQ_N = 1'b0; +localparam [UOP_NPQ_W -1:0] UOP_NPQ_PQ = 1'b1; +localparam [UOP_NPQ_W -1:0] UOP_NPQ_DNC = 1'bX; + +// AUX +localparam [UOP_AUX_W -1:0] UOP_AUX_1 = 1'b0; +localparam [UOP_AUX_W -1:0] UOP_AUX_2 = 1'b1; +localparam [UOP_AUX_W -1:0] UOP_AUX_DNC = 1'bX; + +// LADDER +localparam [UOP_LADDER_W -1:0] UOP_LADDER_00 = 2'b00; +localparam [UOP_LADDER_W -1:0] UOP_LADDER_11 = 2'b11; +localparam [UOP_LADDER_W -1:0] UOP_LADDER_D = 2'b01; +localparam [UOP_LADDER_W -1:0] UOP_LADDER_PQ = 2'b10; +localparam [UOP_LADDER_W -1:0] UOP_LADDER_DNC = 2'bXX; + + +// SEL +localparam [UOP_SEL_W -1:0] UOP_SEL_DNC_ALL = {4{BANK_DNC}}; -- cgit v1.2.3