aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2014-09-16 17:18:46 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2014-09-16 17:18:46 +0200
commit3e5ec06bd7779ee6546ffa4a921b5b8a0e1859fb (patch)
treedc38e80cae96004ae9d8ec89f289bda13b47dfca
parent8c538ac12a60b6af61d04b6a8c30ff83c105be93 (diff)
Debug fixes found during simulation. Now the trng generates data and provides an api.
-rw-r--r--src/rtl/trng.v41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/rtl/trng.v b/src/rtl/trng.v
index f296ce5..0d6b7b0 100644
--- a/src/rtl/trng.v
+++ b/src/rtl/trng.v
@@ -1,4 +1,4 @@
-//======================================================================
+ //======================================================================
//
// trng.v
// --------
@@ -50,6 +50,8 @@ module trng(
output wire [31 : 0] read_data,
output wire error,
+ output wire [7 : 0] debug,
+
output wire security_error
);
@@ -163,10 +165,9 @@ module trng(
wire [31 : 0] entropy2_data;
wire entropy2_ack;
- reg mixer_enable;
+ wire mixer_enable;
wire [511 : 0] mixer_seed_data;
wire mixer_seed_syn;
- wire mixer_seed_ack;
wire csprng_enable;
wire csprng_debug_mode;
@@ -174,6 +175,7 @@ module trng(
wire [63 : 0] csprng_num_blocks;
wire csprng_seed;
wire csprng_more_seed;
+ wire csprng_seed_ack;
wire csprng_ready;
wire csprng_error;
wire [31 : 0] csprng_rnd_data;
@@ -189,6 +191,7 @@ module trng(
assign read_data = tmp_read_data;
assign error = tmp_error;
assign security_error = 0;
+ assign debug = 0;
assign csprng_num_blocks = {csprng_num_blocks_high_reg,
csprng_num_blocks_low_reg};
@@ -197,6 +200,12 @@ module trng(
assign entropy1_enable = entropy1_enable_reg;
assign entropy2_enable = entropy2_enable_reg;
+ assign mixer_enable = enable_reg;
+
+ assign csprng_enable = enable_reg;
+ assign csprng_seed = csprng_seed_reg;
+ assign csprng_debug_mode = 0;
+
//----------------------------------------------------------------
// core instantiations.
@@ -225,7 +234,7 @@ module trng(
.seed_data(mixer_seed_data),
.seed_syn(mixer_seed_syn),
- .seed_ack(mixer_seed_ack)
+ .seed_ack(csprng_seed_ack)
);
trng_csprng csprng(
@@ -265,22 +274,22 @@ module trng(
.entropy_ack(entropy0_ack)
);
- avalance_entropy entropy1(
- .clk(clk),
- .reset_n(reset_n),
+ avalance_entropy_core entropy1(
+ .clk(clk),
+ .reset_n(reset_n),
- .enable(entropy1_enable),
+ .enable(entropy1_enable),
- .noise(avalanche_noise),
+ .noise(avalanche_noise),
- .raw_entropy(entropy1_raw),
- .stats(entropy1_stats),
+ .raw_entropy(entropy1_raw),
+ .stats(entropy1_stats),
- .enabled(entropy1_enabled),
- .entropy_syn(entropy1_syn),
- .entropy_data(entropy1_data),
- .entropy_ack(entropy1_ack)
- );
+ .enabled(entropy1_enabled),
+ .entropy_syn(entropy1_syn),
+ .entropy_data(entropy1_data),
+ .entropy_ack(entropy1_ack)
+ );
ringosc_entropy entropy2(
.clk(clk),