aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rtl/keywrap.v55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/rtl/keywrap.v b/src/rtl/keywrap.v
index cc6f8ac..53deaaf 100644
--- a/src/rtl/keywrap.v
+++ b/src/rtl/keywrap.v
@@ -321,45 +321,48 @@ module keywrap #(parameter ADDR_BITS = 13)
api_rd_delay_new = 32'h0;
// api_mux
- if (address[(ADDR_BITS - 1)])
- tmp_read_data = core_api_rd_data;
- else
- tmp_read_data = api_rd_delay_reg;
+ if (core_ready)
+ if (address[(ADDR_BITS - 1)])
+ tmp_read_data = core_api_rd_data;
+ else
+ tmp_read_data = api_rd_delay_reg;
if (cs)
begin
if (we)
begin
- // Write access
- if (address == {{PAD{1'h0}}, ADDR_CTRL})
+ if (core_ready)
begin
- init_new = write_data[CTRL_INIT_BIT];
- next_new = write_data[CTRL_NEXT_BIT];
- read_new = write_data[CTRL_READ_BIT];
- write_new = write_data[CTRL_WRITE_BIT];
- end
+ if (address == {{PAD{1'h0}}, ADDR_CTRL})
+ begin
+ init_new = write_data[CTRL_INIT_BIT];
+ next_new = write_data[CTRL_NEXT_BIT];
+ read_new = write_data[CTRL_READ_BIT];
+ write_new = write_data[CTRL_WRITE_BIT];
+ end
- if (address == {{PAD{1'h0}}, ADDR_CONFIG})
- config_we = 1'h1;
+ if (address == {{PAD{1'h0}}, ADDR_CONFIG})
+ config_we = 1'h1;
- if (address == {{PAD{1'h0}}, ADDR_RLEN})
- rlen_we = 1'h1;
+ if (address == {{PAD{1'h0}}, ADDR_RLEN})
+ rlen_we = 1'h1;
- if (address == {{PAD{1'h0}}, ADDR_A0})
- a0_we = 1'h1;
+ if (address == {{PAD{1'h0}}, ADDR_A0})
+ a0_we = 1'h1;
- if (address == {{PAD{1'h0}}, ADDR_A1})
- a1_we = 1'h1;
+ if (address == {{PAD{1'h0}}, ADDR_A1})
+ a1_we = 1'h1;
- if (address == {{PAD{1'h0}}, ADDR_MSTATUS})
- mstatus_we = 1'h1;
+ if (address == {{PAD{1'h0}}, ADDR_MSTATUS})
+ mstatus_we = 1'h1;
- if ((address >= {{PAD{1'h0}}, ADDR_KEY0}) &&
- (address <= {{PAD{1'h0}}, ADDR_KEY7}))
- key_we = 1'h1;
+ if ((address >= {{PAD{1'h0}}, ADDR_KEY0}) &&
+ (address <= {{PAD{1'h0}}, ADDR_KEY7}))
+ key_we = 1'h1;
- if (address[(ADDR_BITS - 1)])
- core_api_we = 1'h1;
+ if (address[(ADDR_BITS - 1)])
+ core_api_we = 1'h1;
+ end
end // if (we)
else
begin