|
|
@@ -34,6 +34,8 @@ module host_i2c_register_bank (
|
|
|
);
|
|
|
reg [7:0] staging [0:31];
|
|
|
reg [31:0] written_mask;
|
|
|
+ reg bad_value_seen;
|
|
|
+ reg [7:0] bad_value_index;
|
|
|
reg pending_commit;
|
|
|
reg [7:0] pending_command;
|
|
|
reg [15:0] snapshot_base;
|
|
|
@@ -59,7 +61,7 @@ module host_i2c_register_bank (
|
|
|
|
|
|
always @(posedge clk or negedge rst_n) begin
|
|
|
if (!rst_n) begin
|
|
|
- written_mask <= 0; pending_commit <= 0; pending_command <= 0;
|
|
|
+ written_mask <= 0; bad_value_seen <= 0; bad_value_index <= 0; pending_commit <= 0; pending_command <= 0;
|
|
|
response_valid <= 0; response_ok <= 0; response_command <= 0;
|
|
|
response_status <= 0; response_detail <= 0; snapshot_length <= 0;
|
|
|
snapshot_base <= 0; manual_wr_en <= 0; manual_wr_addr <= 0;
|
|
|
@@ -75,6 +77,9 @@ module host_i2c_register_bank (
|
|
|
manual_wr_en <= 1;
|
|
|
manual_wr_addr <= write_address[4:0];
|
|
|
manual_wr_data <= write_data;
|
|
|
+ end else if (!bad_value_seen) begin
|
|
|
+ bad_value_seen <= 1'b1;
|
|
|
+ bad_value_index <= write_address[7:0] - 8'h00;
|
|
|
end
|
|
|
end
|
|
|
if (command_strobe) begin
|
|
|
@@ -84,6 +89,8 @@ module host_i2c_register_bank (
|
|
|
if (command_data == 8'h01) begin
|
|
|
if (hard_protect) begin
|
|
|
response_ok <= 0; response_status <= 4; response_detail <= 0;
|
|
|
+ end else if (bad_value_seen) begin
|
|
|
+ response_ok <= 0; response_status <= 3; response_detail <= bad_value_index;
|
|
|
end else if (written_mask != 32'hFFFFFFFF) begin
|
|
|
response_ok <= 0; response_status <= 2; response_detail <= 0;
|
|
|
end else begin
|
|
|
@@ -103,7 +110,7 @@ module host_i2c_register_bank (
|
|
|
response_status <= manual_commit_ok ? 0 : 4;
|
|
|
response_detail <= 0;
|
|
|
response_valid <= 1;
|
|
|
- if (manual_commit_ok) written_mask <= 0;
|
|
|
+ if (manual_commit_ok) begin written_mask <= 0; bad_value_seen <= 0; end
|
|
|
end
|
|
|
end
|
|
|
end
|