diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2015-03-26 12:33:27 +0100 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2015-03-26 12:33:27 +0100 |
commit | 26bc2a2ffb02c9366f5e179f2a97a1221fc05d8c (patch) | |
tree | 0e322d0be150e14f996efe3a7cef243a9aa45a73 /src | |
parent | e606f92354d2e90758101fc42a404b0f6603bbbe (diff) |
Cleanup: Combined the clocked processes into one. Changed name of the data read register to reflect that it is a hold register. Fixed missing port and removed the unneeded assignment.
Diffstat (limited to 'src')
-rw-r--r-- | src/rtl/avalanche_entropy.v | 48 |
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 //====================================================================== |