[Cryptech-Commits] [core/rng/trng] 01/01: Cleanup and fixes of calculations.

git at cryptech.is git at cryptech.is
Wed Apr 1 11:24:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

joachim at secworks.se pushed a commit to branch master
in repository core/rng/trng.

commit d9758bce9e4a4078db00b34780ac0d23c8c8ae92
Author: Joachim Strömbergson <joachim at secworks.se>
Date:   Wed Apr 1 13:24:51 2015 +0200

    Cleanup and fixes of calculations.
---
 src/rtl/trng_csprng.v      | 22 +++++++++++-----------
 src/rtl/trng_csprng_fifo.v |  2 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/rtl/trng_csprng.v b/src/rtl/trng_csprng.v
index 79f7afa..e8cdc44 100644
--- a/src/rtl/trng_csprng.v
+++ b/src/rtl/trng_csprng.v
@@ -81,16 +81,16 @@ module trng_csprng(
   localparam CIPHER_KEYLEN256  = 1'b1; // 256 bit key.
   localparam CIPHER_MAX_BLOCKS = 64'h1000000000000000;
 
-  localparam CTRL_IDLE  = 4'h0;
-  localparam CTRL_SEED0 = 4'h1;
-  localparam CTRL_NSYN  = 4'h2;
-  localparam CTRL_SEED1 = 4'h3;
-  localparam CTRL_INIT0 = 4'h4;
-  localparam CTRL_INIT1 = 4'h5;
-  localparam CTRL_NEXT0 = 4'h6;
-  localparam CTRL_NEXT1 = 4'h7;
-  localparam CTRL_MORE  = 4'h8;
-  localparam CTRL_CANCE = 4'hf;
+  localparam CTRL_IDLE   = 4'h0;
+  localparam CTRL_SEED0  = 4'h1;
+  localparam CTRL_NSYN   = 4'h2;
+  localparam CTRL_SEED1  = 4'h3;
+  localparam CTRL_INIT0  = 4'h4;
+  localparam CTRL_INIT1  = 4'h5;
+  localparam CTRL_NEXT0  = 4'h6;
+  localparam CTRL_NEXT1  = 4'h7;
+  localparam CTRL_MORE   = 4'h8;
+  localparam CTRL_CANCEL = 4'hf;
 
   localparam DEFAULT_NUM_ROUNDS = 5'h18;
   localparam DEFAULT_NUM_BLOCKS = 64'h1000000000000000;
@@ -260,7 +260,7 @@ module trng_csprng(
           num_rounds_reg      <= DEFAULT_NUM_ROUNDS;
           num_blocks_low_reg  <= DEFAULT_NUM_BLOCKS[31 : 0];
           num_blocks_high_reg <= DEFAULT_NUM_BLOCKS[63 : 32];
-          tmp_read_data_reg   <= 32'h00000000;
+          read_data_reg       <= 32'h00000000;
           csprng_ctrl_reg     <= CTRL_IDLE;
         end
       else
diff --git a/src/rtl/trng_csprng_fifo.v b/src/rtl/trng_csprng_fifo.v
index 70c0e1f..e4abc26 100644
--- a/src/rtl/trng_csprng_fifo.v
+++ b/src/rtl/trng_csprng_fifo.v
@@ -57,7 +57,7 @@ module trng_csprng_fifo(
   //----------------------------------------------------------------
   localparam FIFO_ADDR_BITS = 2;
   localparam FIFO_ADDR_MAX  = FIFO_ADDR_BITS - 1;
-  localparam FIFO_MAX       = (2 >> FIFO_ADDR_BITS) - 1;
+  localparam FIFO_MAX       = (2 ** FIFO_ADDR_BITS) - 1;
 
   localparam WR_IDLE    = 0;
   localparam WR_WAIT    = 1;



More information about the Commits mailing list