From 7cbc1fec6f39e377a8d945c3aad183b4cffeadd3 Mon Sep 17 00:00:00 2001 From: "Pavel V. Shatov (Meister)" Date: Mon, 15 Oct 2018 15:54:47 +0300 Subject: Incorporated latest microcode from the C model. Passes all the test vectors from the RFC. Needs minor cleanup. --- bench/tb_base_point_multiplier.v | 71 +++++-- rtl/ed25519_microcode.v | 422 +++++++++++++++++++++++++++++++++++---- rtl/ed25519_multiplier.v | 121 +++++++++-- rtl/ed25519_uop.v | 17 +- 4 files changed, 544 insertions(+), 87 deletions(-) diff --git a/bench/tb_base_point_multiplier.v b/bench/tb_base_point_multiplier.v index 7d8de3b..f4a60ae 100644 --- a/bench/tb_base_point_multiplier.v +++ b/bench/tb_base_point_multiplier.v @@ -152,6 +152,18 @@ module tb_base_point_multiplier; $display("1. Q = d * G..."); test_base_point_multiplier(ED25519_D_HASHED_LSB_1, ED25519_Q_Y_1); + $display("2. Q = d * G..."); + test_base_point_multiplier(ED25519_D_HASHED_LSB_2, ED25519_Q_Y_2); + + $display("3. Q = d * G..."); + test_base_point_multiplier(ED25519_D_HASHED_LSB_3, ED25519_Q_Y_3); + + $display("4. Q = d * G..."); + test_base_point_multiplier(ED25519_D_HASHED_LSB_4, ED25519_Q_Y_4); + + $display("5. Q = d * G..."); + test_base_point_multiplier(ED25519_D_HASHED_LSB_5, ED25519_Q_Y_5); + /* print result */ if (ok) $display("tb_base_point_multiplier: SUCCESS"); else $display("tb_base_point_multiplier: FAILURE"); @@ -174,6 +186,7 @@ module tb_base_point_multiplier; reg [255:0] k_shreg; reg [255:0] qy_shreg; reg qy_ok; + reg [255:0] qy_shreg_rev; integer w; @@ -223,28 +236,46 @@ module tb_base_point_multiplier; /* wait for operation to complete */ while (!rdy) #`CLOCK_PERIOD; -// /* read result */ -// for (w=0; w