aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rtl/avalanche_entropy.v48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/rtl/avalanche_entropy.v b/src/rtl/avalanche_entropy.v
index 686dd2d..aeece13 100644
--- a/src/rtl/avalanche_entropy.v
+++ b/src/rtl/avalanche_entropy.v
@@ -94,6 +94,9 @@ module avalanche_entropy(
//----------------------------------------------------------------
// Registers including update variables and write enable.
//----------------------------------------------------------------
+ reg [31 : 0] read_data_hold_reg;
+ reg [31 : 0] read_data_hold_new;
+
reg enable_reg;
reg enable_new;
reg enable_we;
@@ -104,20 +107,16 @@ module avalanche_entropy(
//----------------------------------------------------------------
wire [31 : 0] delta;
- reg [31 : 0] tmp_read_data;
- reg [31 : 0] tmp_read_data_reg;
reg tmp_error;
//----------------------------------------------------------------
// Concurrent connectivity for ports etc.
//----------------------------------------------------------------
- assign read_data = tmp_read_data_reg;
+ assign read_data = read_data_hold_reg;
assign error = tmp_error;
assign security_error = 0;
- assign entropy_enabled = enable_reg;
-
//----------------------------------------------------------------
// Core instantiation.
@@ -131,6 +130,7 @@ module avalanche_entropy(
.enable(enable_reg),
.entropy_data(entropy_data),
+ .entropy_enabled(entropy_enabled),
.entropy_valid(entropy_valid),
.entropy_ack(entropy_ack),
@@ -148,14 +148,16 @@ module avalanche_entropy(
begin
if (!reset_n)
begin
- enable_reg <= 1;
+ read_data_hold_reg <= 32'h00000000;
+ enable_reg <= 1;
end
else
begin
+ if (cs)
+ read_data_hold_reg <= read_data_hold_new;
+
if (enable_we)
- begin
- enable_reg <= enable_new;
- end
+ enable_reg <= enable_new;
end
end // reg_update
@@ -165,10 +167,10 @@ module avalanche_entropy(
//----------------------------------------------------------------
always @*
begin : api_logic
- tmp_read_data = 32'h00000000;
- tmp_error = 1'b0;
- enable_new = 0;
- enable_we = 0;
+ read_data_hold_new = 32'h00000000;
+ tmp_error = 1'b0;
+ enable_new = 0;
+ enable_we = 0;
if (cs)
begin
@@ -193,37 +195,37 @@ module avalanche_entropy(
case (address)
ADDR_NAME0:
begin
- tmp_read_data = CORE_NAME0;
+ read_data_hold_new = CORE_NAME0;
end
ADDR_NAME1:
begin
- tmp_read_data = CORE_NAME1;
+ read_data_hold_new = CORE_NAME1;
end
ADDR_VERSION:
begin
- tmp_read_data = CORE_VERSION;
+ read_data_hold_new = CORE_VERSION;
end
ADDR_CTRL:
begin
- tmp_read_data = {31'h00000000, enable_reg};
+ read_data_hold_new = {31'h00000000, enable_reg};
end
ADDR_STATUS:
begin
- tmp_read_data = {31'h00000000, entropy_valid};
+ read_data_hold_new = {31'h00000000, entropy_valid};
end
ADDR_ENTROPY:
begin
- tmp_read_data = entropy_data;
+ read_data_hold_new = entropy_data;
end
ADDR_DELTA:
begin
- tmp_read_data = delta;
+ read_data_hold_new = delta;
end
default:
@@ -235,12 +237,6 @@ module avalanche_entropy(
end // if (cs)
end // api_logic
- // register data for eim output
- always @(posedge clk)
- begin
- tmp_read_data_reg <= tmp_read_data;
- end
-
endmodule // avalanche_entropy
//======================================================================