FSI relative addressing commands actually send a 9-bit 2's complement offset

This was discovered and verified with physical IBM POWER9 hardware, as the
OpenFSI specification is silent on the format of the relative address offset.
parent 5956d3bf
......@@ -290,11 +290,11 @@ module fsi_master_interface(
cycle_counter <= FSI_CODEWORD_TX_MSG_REL_ADR_LEN;
if (address_reg < last_address) begin
fsi_rel_address_delta_negative <= 1;
fsi_rel_address_delta = last_address - address_reg;
end else begin
fsi_rel_address_delta_negative <= 0;
fsi_rel_address_delta = address_reg - last_address;
end
// Relative delta is actually 9-bit two's complement, but fsi_rel_address_delta_negative is used as bit 8
fsi_rel_address_delta = address_reg - last_address;
end else begin
fsi_command_code <= FSI_CODEWORD_TX_MSG_ABS_ADR_DAT;
fsi_command_code_length <= FSI_CODEWORD_TX_MSG_ABS_ADR_LEN;
......
......@@ -346,9 +346,9 @@ module fsi_slave_interface(
if (fsi_command_code == FSI_CODEWORD_TX_MSG_REL_ADR_DAT) begin
if (last_address_valid) begin
if (fsi_rel_address_delta_negative) begin
address_reg <= last_address - address_reg[7:0];
address_reg = last_address - (9'h100 - address_reg[7:0]);
end else begin
address_reg <= last_address + address_reg[7:0];
address_reg = last_address + address_reg[7:0];
end
end else begin
// Relative address command used without prior absolute address command
......@@ -377,6 +377,14 @@ module fsi_slave_interface(
end
end
end
// Force lowest address bits to specification-mandated values if required
case (data_length_reg)
0: address_reg = address_reg[20:0];
1: address_reg = {address_reg[20:1], 1'b0};
2: address_reg = {address_reg[20:2], 2'b01};
default: address_reg = address_reg[20:0];
endcase
end
FSI_TRANSFER_STATE_RX08: begin
if ((fsi_command_code_length == FSI_CODEWORD_TX_MSG_TERM_LEN) && (fsi_command_code == FSI_CODEWORD_TX_MSG_TERM_DAT)) begin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment