From caf3ad473fc5325af2146274aebe2f7c66dbd63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Tue, 8 Jan 2019 09:55:33 +0100 Subject: Ported the timing fix from SHA-512 to SHA-256. The core can now run at 170 MHz in the target FPGA. --- src/rtl/sha256_w_mem.v | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/rtl/sha256_w_mem.v') diff --git a/src/rtl/sha256_w_mem.v b/src/rtl/sha256_w_mem.v index fef1205..40e1374 100644 --- a/src/rtl/sha256_w_mem.v +++ b/src/rtl/sha256_w_mem.v @@ -76,12 +76,14 @@ module sha256_w_mem( reg [5 : 0] w_ctr_new; reg w_ctr_we; + reg [31 : 0] w_reg; + reg [31 : 0] w_new; + //---------------------------------------------------------------- // Wires. //---------------------------------------------------------------- reg [31 : 0] w_tmp; - reg [31 : 0] w_new; //---------------------------------------------------------------- @@ -105,6 +107,7 @@ module sha256_w_mem( for (i = 0 ; i < 16 ; i = i + 1) w_mem[i] <= 32'h0; + w_reg <= 32'h0; w_ctr_reg <= 6'h0; end else @@ -129,6 +132,8 @@ module sha256_w_mem( w_mem[15] <= w_mem15_new; end + w_reg <= w_new; + if (w_ctr_we) w_ctr_reg <= w_ctr_new; end @@ -146,7 +151,7 @@ module sha256_w_mem( if (w_ctr_reg < 16) w_tmp = w_mem[w_ctr_reg[3 : 0]]; else - w_tmp = w_new; + w_tmp = w_reg; end // select_w -- cgit v1.2.3