aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2015-07-17 06:10:46 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2015-07-17 06:10:46 +0200
commitd4e6d2b54157a15f33d3ab82d4a7e49857094270 (patch)
treee4d72fcd13ea4915fcad1212e2dbfc172a4d7099
parent0de1938751121fdb08b859e47569d8168c586ec9 (diff)
Since state is digest having separate addresses for writing state is superflous. Captain slow.
-rw-r--r--src/rtl/sha256.v41
-rw-r--r--src/tb/tb_sha256.v16
2 files changed, 16 insertions, 41 deletions
diff --git a/src/rtl/sha256.v b/src/rtl/sha256.v
index 5e733bd..7afa3f8 100644
--- a/src/rtl/sha256.v
+++ b/src/rtl/sha256.v
@@ -533,28 +533,28 @@ module sha256(
block15_we = 1;
end
- ADDR_STATE0:
+ ADDR_DIGEST0:
state0_we = 1;
- ADDR_STATE1:
+ ADDR_DIGEST1:
state1_we = 1;
- ADDR_STATE2:
+ ADDR_DIGEST2:
state2_we = 1;
- ADDR_STATE3:
+ ADDR_DIGEST3:
state3_we = 1;
- ADDR_STATE4:
+ ADDR_DIGEST4:
state4_we = 1;
- ADDR_STATE5:
+ ADDR_DIGEST5:
state5_we = 1;
- ADDR_STATE6:
+ ADDR_DIGEST6:
state6_we = 1;
- ADDR_STATE7:
+ ADDR_DIGEST7:
state7_we = 1;
default:
@@ -713,31 +713,6 @@ module sha256(
tmp_read_data = digest_reg[31 : 0];
end
-
- ADDR_STATE0:
- tmp_read_data = digest_reg[255 : 224];
-
- ADDR_STATE1:
- tmp_read_data = digest_reg[223 : 192];
-
- ADDR_STATE2:
- tmp_read_data = digest_reg[191 : 160];
-
- ADDR_STATE3:
- tmp_read_data = digest_reg[159 : 128];
-
- ADDR_STATE4:
- tmp_read_data = digest_reg[127 : 96];
-
- ADDR_STATE5:
- tmp_read_data = digest_reg[95 : 64];
-
- ADDR_STATE6:
- tmp_read_data = digest_reg[63 : 32];
-
- ADDR_STATE7:
- tmp_read_data = digest_reg[31 : 0];
-
default:
begin
tmp_error = 1;
diff --git a/src/tb/tb_sha256.v b/src/tb/tb_sha256.v
index b6916cd..47b0308 100644
--- a/src/tb/tb_sha256.v
+++ b/src/tb/tb_sha256.v
@@ -545,14 +545,14 @@ module tb_sha256();
$display("*** TC%01d - Restore state test started.", tc_ctr);
// Write state.
- write_word(ADDR_STATE0, state[255 : 224]);
- write_word(ADDR_STATE1, state[223 : 192]);
- write_word(ADDR_STATE2, state[191 : 160]);
- write_word(ADDR_STATE3, state[159 : 128]);
- write_word(ADDR_STATE4, state[127 : 096]);
- write_word(ADDR_STATE5, state[095 : 0064]);
- write_word(ADDR_STATE6, state[063 : 0032]);
- write_word(ADDR_STATE7, state[031 : 000]);
+ write_word(ADDR_DIGEST0, state[255 : 224]);
+ write_word(ADDR_DIGEST1, state[223 : 192]);
+ write_word(ADDR_DIGEST2, state[191 : 160]);
+ write_word(ADDR_DIGEST3, state[159 : 128]);
+ write_word(ADDR_DIGEST4, state[127 : 096]);
+ write_word(ADDR_DIGEST5, state[095 : 0064]);
+ write_word(ADDR_DIGEST6, state[063 : 0032]);
+ write_word(ADDR_DIGEST7, state[031 : 000]);
// Process block.
write_block(block);