aboutsummaryrefslogtreecommitdiff
path: root/rtl/microcode/ecdsa_uop.vh
diff options
context:
space:
mode:
authorPavel V. Shatov (Meister) <meisterpaul1@yandex.ru>2021-04-12 17:21:47 +0300
committerPavel V. Shatov (Meister) <meisterpaul1@yandex.ru>2021-04-12 17:21:47 +0300
commit2eef856e1dec9244e41e4732cde4381b66772fb0 (patch)
treed0cc5ecad2303cbcd0c834dcaf8f6cb1ba1ff3e5 /rtl/microcode/ecdsa_uop.vh
parent21cc313097a670403d5740177e20209b1f0388ae (diff)
Microcode redesigned for Montgomery ladder approach
Diffstat (limited to 'rtl/microcode/ecdsa_uop.vh')
-rw-r--r--rtl/microcode/ecdsa_uop.vh120
1 files changed, 60 insertions, 60 deletions
diff --git a/rtl/microcode/ecdsa_uop.vh b/rtl/microcode/ecdsa_uop.vh
index cebec26..b0ac1f4 100644
--- a/rtl/microcode/ecdsa_uop.vh
+++ b/rtl/microcode/ecdsa_uop.vh
@@ -1,6 +1,6 @@
//======================================================================
//
-// Copyright (c) 2018, NORDUnet A/S All rights reserved.
+// Copyright (c) 2018, 2021 NORDUnet A/S All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
@@ -30,23 +30,28 @@
//
//======================================================================
+
+//
+// Debug Switch (should be turned off for synthesis)
+//
+//`define CRYPTECH_DEBUG_ECDSA
+
+
localparam integer UOP_ADDR_WIDTH = 9; // 2 ^ 9 = max 512 instructions
localparam integer UOP_DATA_WIDTH = 6 + 1 + 3 * 6; // opcode + banks + 3 * operand (2 * src + dst)
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_PREPARE = 9'd000;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_DOUBLE = 9'd004;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD = 9'd025;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD_AT_INFINITY = 9'd053;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD_SAME_X_SAME_Y = 9'd057;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD_SAME_X = 9'd061;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD_REGULAR = 9'd065;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_K0 = 9'd069;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_K1 = 9'd073;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CONVERT = 9'd077;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CONVERT_AT_INFINITY = 9'd081;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CONVERT_REGULAR = 9'd084;
-localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_INVERT = 9'd087;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_PREPARE = 9'd000;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_DOUBLE_R0 = 9'd007;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_DOUBLE_R1 = 9'd029;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD = 9'd051;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD_R0_AT_INFINITY = 9'd084;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD_R1_AT_INFINITY = 9'd088;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_ADD_REGULAR = 9'd092;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_K0 = 9'd096;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CYCLE_K1 = 9'd103;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_CONVERT = 9'd110;
+localparam [UOP_ADDR_WIDTH-1:0] UOP_OFFSET_INVERT = 9'd113;
localparam [5:0] UOP_OPCODE_CMPZ = 6'b000001;
localparam [5:0] UOP_OPCODE_COPY = 6'b000010;
@@ -66,52 +71,47 @@ localparam [5:0] UOP_OPERAND_CONST_DELTA = 6'd02;
localparam [5:0] UOP_OPERAND_CONST_GX = 6'd03;
localparam [5:0] UOP_OPERAND_CONST_GY = 6'd04;
-localparam [5:0] UOP_OPERAND_CONST_HX = 6'd05;
-localparam [5:0] UOP_OPERAND_CONST_HY = 6'd06;
-
-localparam [5:0] UOP_OPERAND_CYCLE_RX = 6'd07;
-localparam [5:0] UOP_OPERAND_CYCLE_RY = 6'd08;
-localparam [5:0] UOP_OPERAND_CYCLE_RZ = 6'd09;
-
-localparam [5:0] UOP_OPERAND_CYCLE_SX = 6'd10;
-localparam [5:0] UOP_OPERAND_CYCLE_SY = 6'd11;
-localparam [5:0] UOP_OPERAND_CYCLE_SZ = 6'd12;
-
-localparam [5:0] UOP_OPERAND_CYCLE_A = 6'd13;
-localparam [5:0] UOP_OPERAND_CYCLE_A2 = 6'd14;
-localparam [5:0] UOP_OPERAND_CYCLE_B = 6'd15;
-localparam [5:0] UOP_OPERAND_CYCLE_C = 6'd16;
-localparam [5:0] UOP_OPERAND_CYCLE_C2 = 6'd17;
-localparam [5:0] UOP_OPERAND_CYCLE_C2_2 = 6'd18;
-localparam [5:0] UOP_OPERAND_CYCLE_D = 6'd19;
-localparam [5:0] UOP_OPERAND_CYCLE_E = 6'd20;
-localparam [5:0] UOP_OPERAND_CYCLE_F = 6'd21;
-localparam [5:0] UOP_OPERAND_CYCLE_G = 6'd22;
-localparam [5:0] UOP_OPERAND_CYCLE_H = 6'd23;
-localparam [5:0] UOP_OPERAND_CYCLE_J = 6'd24;
-
-localparam [5:0] UOP_OPERAND_CYCLE_Z2 = 6'd25;
-
-localparam [5:0] UOP_OPERAND_CYCLE_T1 = 6'd26;
-localparam [5:0] UOP_OPERAND_CYCLE_T2 = 6'd27;
-localparam [5:0] UOP_OPERAND_CYCLE_T3 = 6'd28;
-localparam [5:0] UOP_OPERAND_CYCLE_T4 = 6'd29;
-
-localparam [5:0] UOP_OPERAND_INVERT_R1 = 6'd30;
-localparam [5:0] UOP_OPERAND_INVERT_R2 = 6'd31;
-
-localparam [5:0] UOP_OPERAND_INVERT_X2 = 6'd32;
-localparam [5:0] UOP_OPERAND_INVERT_X3 = 6'd33;
-localparam [5:0] UOP_OPERAND_INVERT_X6 = 6'd34;
-localparam [5:0] UOP_OPERAND_INVERT_X12 = 6'd35;
-localparam [5:0] UOP_OPERAND_INVERT_X15 = 6'd36;
-localparam [5:0] UOP_OPERAND_INVERT_X30 = 6'd37;
-localparam [5:0] UOP_OPERAND_INVERT_X32 = 6'd38;
-localparam [5:0] UOP_OPERAND_INVERT_X60 = 6'd39;
-localparam [5:0] UOP_OPERAND_INVERT_X120 = 6'd40;
-
-localparam [5:0] UOP_OPERAND_INVERT_A2 = 6'd41;
-localparam [5:0] UOP_OPERAND_INVERT_A3 = 6'd42;
+localparam [5:0] UOP_OPERAND_CYCLE_R0X = 6'd05;
+localparam [5:0] UOP_OPERAND_CYCLE_R0Y = 6'd06;
+localparam [5:0] UOP_OPERAND_CYCLE_R0Z = 6'd07;
+
+localparam [5:0] UOP_OPERAND_CYCLE_R1X = 6'd08;
+localparam [5:0] UOP_OPERAND_CYCLE_R1Y = 6'd09;
+localparam [5:0] UOP_OPERAND_CYCLE_R1Z = 6'd10;
+
+localparam [5:0] UOP_OPERAND_CYCLE_SX = 6'd11;
+localparam [5:0] UOP_OPERAND_CYCLE_SY = 6'd12;
+localparam [5:0] UOP_OPERAND_CYCLE_SZ = 6'd13;
+
+localparam [5:0] UOP_OPERAND_CYCLE_TX = 6'd14;
+localparam [5:0] UOP_OPERAND_CYCLE_TY = 6'd15;
+localparam [5:0] UOP_OPERAND_CYCLE_TZ = 6'd16;
+
+localparam [5:0] UOP_OPERAND_CYCLE_T1 = 6'd17;
+localparam [5:0] UOP_OPERAND_CYCLE_T2 = 6'd18;
+localparam [5:0] UOP_OPERAND_CYCLE_T3 = 6'd19;
+localparam [5:0] UOP_OPERAND_CYCLE_T4 = 6'd20;
+
+localparam [5:0] UOP_OPERAND_CYCLE_T5 = 6'd21;
+localparam [5:0] UOP_OPERAND_CYCLE_T6 = 6'd22;
+localparam [5:0] UOP_OPERAND_CYCLE_T7 = 6'd23;
+localparam [5:0] UOP_OPERAND_CYCLE_T8 = 6'd24;
+
+localparam [5:0] UOP_OPERAND_INVERT_R1 = 6'd25;
+localparam [5:0] UOP_OPERAND_INVERT_R2 = 6'd26;
+
+localparam [5:0] UOP_OPERAND_INVERT_X2 = 6'd27;
+localparam [5:0] UOP_OPERAND_INVERT_X3 = 6'd28;
+localparam [5:0] UOP_OPERAND_INVERT_X6 = 6'd29;
+localparam [5:0] UOP_OPERAND_INVERT_X12 = 6'd30;
+localparam [5:0] UOP_OPERAND_INVERT_X15 = 6'd31;
+localparam [5:0] UOP_OPERAND_INVERT_X30 = 6'd32;
+localparam [5:0] UOP_OPERAND_INVERT_X32 = 6'd33;
+localparam [5:0] UOP_OPERAND_INVERT_X60 = 6'd34;
+localparam [5:0] UOP_OPERAND_INVERT_X120 = 6'd35;
+
+localparam [5:0] UOP_OPERAND_INVERT_A2 = 6'd36;
+localparam [5:0] UOP_OPERAND_INVERT_A3 = 6'd37;
localparam [5:0] UOP_OPERAND_DONTCARE = 6'dX;