|
|
@@ -67,6 +67,7 @@ module mrdimm_host_command #(
|
|
|
input wire [7:0] status_byte_in,
|
|
|
input wire [15:0] tx_payload_addr,
|
|
|
output wire [7:0] ack_payload_data,
|
|
|
+ output wire [7:0] tx_payload_data,
|
|
|
output reg tx_start,
|
|
|
output reg [7:0] tx_frame_type,
|
|
|
output reg [15:0] tx_payload_length,
|
|
|
@@ -101,6 +102,7 @@ module mrdimm_host_command #(
|
|
|
reg [7:0] ctl_flags_r;
|
|
|
reg [31:0] ctl_value_r;
|
|
|
reg [7:0] ev_max_records;
|
|
|
+ reg ctl_sent;
|
|
|
|
|
|
assign frame_ready = (state == ST_IDLE) || (state == ST_DROP);
|
|
|
assign frame_accept_enable = (state == ST_IDLE);
|
|
|
@@ -128,7 +130,7 @@ module mrdimm_host_command #(
|
|
|
reg [127:0] ack_word;
|
|
|
reg status_valid; // DATA phase carries ALL_STATUS
|
|
|
reg event_valid; // DATA phase carries EVENT_DATA
|
|
|
- reg tx_payload_data_r;
|
|
|
+ reg [7:0] tx_payload_data_r;
|
|
|
reg tx_start_or_running;
|
|
|
|
|
|
// Ring view freeze: while the EVENT payload streams, the engine holds
|
|
|
@@ -142,7 +144,7 @@ module mrdimm_host_command #(
|
|
|
(tx_payload_addr - 16'd1) >> 4 : 8'd0;
|
|
|
end
|
|
|
|
|
|
- wire [2:0] ev_byte_sel = tx_payload_addr[3:0]; // (addr-1) % 16 == addr[3:0]
|
|
|
+ wire [3:0] ev_byte_sel = tx_payload_addr[3:0] - 4'd1;
|
|
|
|
|
|
always @(posedge clk or negedge rst_n) begin
|
|
|
if (!rst_n) begin
|
|
|
@@ -155,19 +157,19 @@ module mrdimm_host_command #(
|
|
|
if (tx_start && tx_frame_type == RSP_ACK)
|
|
|
ack_word <= {96'd0, ack_detail, ack_status, ack_request};
|
|
|
if (tx_start_or_running) begin
|
|
|
- if (event_valid)
|
|
|
+ if (tx_frame_type==RSP_EVENT)
|
|
|
// addr 0: count byte; addr>=1: record bytes, and
|
|
|
// (addr-1)%16 == addr[3:0] because records are 16B
|
|
|
tx_payload_data_r <= (tx_payload_addr == 16'd0) ?
|
|
|
ev_freeze_count : ev_rd_data[ev_byte_sel*8 +: 8];
|
|
|
- else if (status_valid)
|
|
|
+ else if (tx_frame_type==RSP_STATUS)
|
|
|
tx_payload_data_r <= status_byte_in;
|
|
|
else
|
|
|
tx_payload_data_r <= ack_word[tx_payload_addr[3:0]*8 +: 8];
|
|
|
end
|
|
|
end
|
|
|
end
|
|
|
- wire [7:0] tx_payload_data = tx_payload_data_r;
|
|
|
+ assign tx_payload_data = tx_payload_data_r;
|
|
|
// Bank fake-tx ACK capture walks this mux with tx_payload_addr 0..3.
|
|
|
assign ack_payload_data = ack_word[tx_payload_addr[3:0]*8 +: 8];
|
|
|
|
|
|
@@ -189,6 +191,7 @@ module mrdimm_host_command #(
|
|
|
tx_start <= 0; tx_frame_type <= RSP_ACK; tx_payload_length <= 0;
|
|
|
transaction_done <= 0;
|
|
|
status_valid <= 0; event_valid <= 0;
|
|
|
+ ctl_sent <= 0;
|
|
|
end else begin
|
|
|
thermal_wr_en <= 0; thermal_commit <= 0; keepalive_reload <= 0;
|
|
|
snapshot_capture <= 0;
|
|
|
@@ -199,6 +202,7 @@ module mrdimm_host_command #(
|
|
|
transaction_done <= 0;
|
|
|
case (state)
|
|
|
ST_IDLE: if (frame_valid) begin
|
|
|
+ ctl_sent <= 0;
|
|
|
case (frame_type)
|
|
|
T_SET_ALL: begin
|
|
|
if (frame_length != 16'd11) begin
|
|
|
@@ -390,8 +394,9 @@ module mrdimm_host_command #(
|
|
|
state <= ST_CTL_WAIT;
|
|
|
end else payload_read_addr <= payload_read_addr + 16'd1;
|
|
|
end
|
|
|
- ST_CTL_WAIT: if (!ctl_valid) begin
|
|
|
+ ST_CTL_WAIT: if (!ctl_sent) begin
|
|
|
ctl_valid <= 1;
|
|
|
+ ctl_sent <= 1;
|
|
|
ctl_op <= ctl_op_r; ctl_axis_mask <= ctl_mask_r;
|
|
|
ctl_flags <= ctl_flags_r; ctl_value <= ctl_value_r;
|
|
|
end else if (ctl_accept) begin
|
|
|
@@ -400,7 +405,8 @@ module mrdimm_host_command #(
|
|
|
|
|
|
// ---- EVENT_CLEAR ----
|
|
|
ST_EVCLEAR_SEND: begin
|
|
|
- if (payload_read_data == 8'd0) begin
|
|
|
+ if (payload_read_data == 8'd0 ||
|
|
|
+ (payload_read_data > 8'd64 && payload_read_data != 8'hFF)) begin
|
|
|
start_ack(1'b0, T_EVCLEAR, S_BADVAL, DET_NONE);
|
|
|
end else begin
|
|
|
ev_clear_n <= 1;
|