|
|
@@ -261,16 +261,16 @@ module prod2u_6400_v2_tb;
|
|
|
$display("PASS: SSR1, SSR2, SSR4 are constant 1'b1");
|
|
|
end
|
|
|
|
|
|
- // Check 2: Build and send SET_ALL (32 bytes)
|
|
|
- // PTC 0..23 = 50%, Front 0..3 = 40%, Rear 0..3 = 60%
|
|
|
+ // Check 2: Build and send SET_ALL (43 bytes: 35 PTC + 4 Front + 4 Rear)
|
|
|
+ // PTC 0..34 = 50%, Front 0..3 = 40%, Rear 0..3 = 60%
|
|
|
frame_bytes[0] = 8'hA5;
|
|
|
frame_bytes[1] = 8'h5A;
|
|
|
frame_bytes[2] = 8'h01; // SET_ALL
|
|
|
- frame_bytes[3] = 8'd32; // LEN
|
|
|
- for (i = 0; i < 24; i = i + 1) frame_bytes[4 + i] = 8'd50;
|
|
|
- for (i = 0; i < 4; i = i + 1) frame_bytes[28 + i] = 8'd40;
|
|
|
- for (i = 0; i < 4; i = i + 1) frame_bytes[32 + i] = 8'd60;
|
|
|
- frame_len = 36;
|
|
|
+ frame_bytes[3] = 8'd43; // LEN
|
|
|
+ for (i = 0; i < 35; i = i + 1) frame_bytes[4 + i] = 8'd50;
|
|
|
+ for (i = 0; i < 4; i = i + 1) frame_bytes[39 + i] = 8'd40;
|
|
|
+ for (i = 0; i < 4; i = i + 1) frame_bytes[43 + i] = 8'd60;
|
|
|
+ frame_len = 4 + 43;
|
|
|
|
|
|
$display("Sending SET_ALL via CON12 TTL...");
|
|
|
rx_count = 0;
|
|
|
@@ -301,8 +301,8 @@ module prod2u_6400_v2_tb;
|
|
|
rs232_rx_count = 0;
|
|
|
uart_send_frame(frame_len);
|
|
|
|
|
|
- // Expect GET_ACK (6 bytes: A5 5A 82 00 F5 60) + GET_DATA (89 bytes: A5 5A 42 53 ... CRC) = 95 bytes total
|
|
|
- while (rx_count < 95) @(posedge clk);
|
|
|
+ // Expect GET_ACK (6 bytes: A5 5A 82 00 F5 60) + GET_DATA (100 bytes: A5 5A 42 5E ... CRC) = 106 bytes total
|
|
|
+ while (rx_count < 106) @(posedge clk);
|
|
|
|
|
|
// Check GET_ACK
|
|
|
if (rx_bytes[0] !== 8'hA5 || rx_bytes[1] !== 8'h5A ||
|
|
|
@@ -316,41 +316,41 @@ module prod2u_6400_v2_tb;
|
|
|
|
|
|
// Check GET_DATA header
|
|
|
if (rx_bytes[6] !== 8'hA5 || rx_bytes[7] !== 8'h5A ||
|
|
|
- rx_bytes[8] !== 8'h42 || rx_bytes[9] !== 8'd83) begin
|
|
|
+ rx_bytes[8] !== 8'h42 || rx_bytes[9] !== 8'd94) begin
|
|
|
$display("FAIL: GET_DATA header incorrect: %02h %02h %02h %02h",
|
|
|
rx_bytes[6], rx_bytes[7], rx_bytes[8], rx_bytes[9]);
|
|
|
failures = failures + 1;
|
|
|
end else begin
|
|
|
- $display("PASS: Received GET_DATA (42 53)");
|
|
|
+ $display("PASS: Received GET_DATA (42 5E, 94 bytes)");
|
|
|
|
|
|
- // Verify PTC duties (offsets 10..33) match 50
|
|
|
- for (i = 0; i < 24; i = i + 1) begin
|
|
|
+ // Verify PTC duties (offsets 10..44) match 50
|
|
|
+ for (i = 0; i < 35; i = i + 1) begin
|
|
|
if (rx_bytes[10 + i] !== 8'd50) begin
|
|
|
$display("FAIL: PTC[%0d] = %0d, expected 50", i, rx_bytes[10 + i]);
|
|
|
failures = failures + 1;
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- // Verify Front fan duties (offsets 34..37) match 40
|
|
|
+ // Verify Front fan duties (offsets 45..48) match 40
|
|
|
for (i = 0; i < 4; i = i + 1) begin
|
|
|
- if (rx_bytes[34 + i] !== 8'd40) begin
|
|
|
- $display("FAIL: FrontFan[%0d] = %0d, expected 40", i, rx_bytes[34 + i]);
|
|
|
+ if (rx_bytes[45 + i] !== 8'd40) begin
|
|
|
+ $display("FAIL: FrontFan[%0d] = %0d, expected 40", i, rx_bytes[45 + i]);
|
|
|
failures = failures + 1;
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- // Verify Rear fan duties (offsets 38..41) match 60
|
|
|
+ // Verify Rear fan duties (offsets 49..52) match 60
|
|
|
for (i = 0; i < 4; i = i + 1) begin
|
|
|
- if (rx_bytes[38 + i] !== 8'd60) begin
|
|
|
- $display("FAIL: RearFan[%0d] = %0d, expected 60", i, rx_bytes[38 + i]);
|
|
|
+ if (rx_bytes[49 + i] !== 8'd60) begin
|
|
|
+ $display("FAIL: RearFan[%0d] = %0d, expected 60", i, rx_bytes[49 + i]);
|
|
|
failures = failures + 1;
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- // Verify CT sensor unwritten channels 9..26 (offsets 66+9..66+26 = 75..92) are 0xFF
|
|
|
+ // Verify CT sensor unwritten channels 9..26 (offsets 77+9..77+26 = 86..103) are 0xFF
|
|
|
for (i = 9; i < 27; i = i + 1) begin
|
|
|
- if (rx_bytes[66 + i] !== 8'hFF) begin
|
|
|
- $display("FAIL: CT[%0d] (offset %0d) = %02h, expected 0xFF", i, 66 + i, rx_bytes[66 + i]);
|
|
|
+ if (rx_bytes[77 + i] !== 8'hFF) begin
|
|
|
+ $display("FAIL: CT[%0d] (offset %0d) = %02h, expected 0xFF", i, 77 + i, rx_bytes[77 + i]);
|
|
|
failures = failures + 1;
|
|
|
end
|
|
|
end
|
|
|
@@ -366,8 +366,8 @@ module prod2u_6400_v2_tb;
|
|
|
end
|
|
|
|
|
|
// Check 5: Broadcast verification - RS-232 TX received same GET_ACK/GET_DATA as TTL TX
|
|
|
- if (rs232_rx_count < 95) begin
|
|
|
- $display("FAIL: RS-232 TX did not receive full broadcast reply (%0d < 95)", rs232_rx_count);
|
|
|
+ if (rs232_rx_count < 106) begin
|
|
|
+ $display("FAIL: RS-232 TX did not receive full broadcast reply (%0d < 106)", rs232_rx_count);
|
|
|
failures = failures + 1;
|
|
|
end else if (rs232_rx_bytes[0] !== 8'hA5 || rs232_rx_bytes[1] !== 8'h5A ||
|
|
|
rs232_rx_bytes[2] !== 8'h82) begin
|
|
|
@@ -381,11 +381,11 @@ module prod2u_6400_v2_tb;
|
|
|
frame_bytes[0] = 8'hA5;
|
|
|
frame_bytes[1] = 8'h5A;
|
|
|
frame_bytes[2] = 8'h01; // SET_ALL
|
|
|
- frame_bytes[3] = 8'd32;
|
|
|
- for (i = 0; i < 24; i = i + 1) frame_bytes[4 + i] = 8'd70;
|
|
|
- for (i = 0; i < 4; i = i + 1) frame_bytes[28 + i] = 8'd30;
|
|
|
- for (i = 0; i < 4; i = i + 1) frame_bytes[32 + i] = 8'd80;
|
|
|
- frame_len = 36;
|
|
|
+ frame_bytes[3] = 8'd43;
|
|
|
+ for (i = 0; i < 35; i = i + 1) frame_bytes[4 + i] = 8'd70;
|
|
|
+ for (i = 0; i < 4; i = i + 1) frame_bytes[39 + i] = 8'd30;
|
|
|
+ for (i = 0; i < 4; i = i + 1) frame_bytes[43 + i] = 8'd80;
|
|
|
+ frame_len = 4 + 43;
|
|
|
|
|
|
$display("Sending SET_ALL via CON134 RS-232...");
|
|
|
rx_count = 0;
|
|
|
@@ -412,9 +412,9 @@ module prod2u_6400_v2_tb;
|
|
|
rs232_rx_count = 0;
|
|
|
uart_send_frame_rs232(frame_len);
|
|
|
|
|
|
- while (rs232_rx_count < 95) @(posedge clk);
|
|
|
+ while (rs232_rx_count < 106) @(posedge clk);
|
|
|
if (rs232_rx_bytes[2] !== 8'h82 || rs232_rx_bytes[8] !== 8'h42 ||
|
|
|
- rs232_rx_bytes[10] !== 8'd70 || rs232_rx_bytes[34] !== 8'd30 || rs232_rx_bytes[38] !== 8'd80) begin
|
|
|
+ rs232_rx_bytes[10] !== 8'd70 || rs232_rx_bytes[45] !== 8'd30 || rs232_rx_bytes[49] !== 8'd80) begin
|
|
|
$display("FAIL: CON134 GET_DATA values incorrect");
|
|
|
failures = failures + 1;
|
|
|
end else begin
|
|
|
@@ -462,7 +462,7 @@ module prod2u_6400_v2_tb;
|
|
|
frame_bytes[3] = 8'd0;
|
|
|
frame_len = 4;
|
|
|
uart_send_frame(frame_len);
|
|
|
- while (rx_count < 95) @(posedge clk);
|
|
|
+ while (rx_count < 106) @(posedge clk);
|
|
|
if (rx_bytes[2] !== 8'h82) begin
|
|
|
$display("FAIL: Failed to recover after inter-byte timeout");
|
|
|
failures = failures + 1;
|
|
|
@@ -475,11 +475,11 @@ module prod2u_6400_v2_tb;
|
|
|
frame_bytes[0] = 8'hA5;
|
|
|
frame_bytes[1] = 8'h5A;
|
|
|
frame_bytes[2] = 8'h01;
|
|
|
- frame_bytes[3] = 8'd32;
|
|
|
- for (i = 0; i < 24; i = i + 1) frame_bytes[4 + i] = 8'd25;
|
|
|
- for (i = 0; i < 4; i = i + 1) frame_bytes[28 + i] = 8'd55;
|
|
|
- for (i = 0; i < 4; i = i + 1) frame_bytes[32 + i] = 8'd75;
|
|
|
- frame_len = 36;
|
|
|
+ frame_bytes[3] = 8'd43;
|
|
|
+ for (i = 0; i < 35; i = i + 1) frame_bytes[4 + i] = 8'd25;
|
|
|
+ for (i = 0; i < 4; i = i + 1) frame_bytes[39 + i] = 8'd55;
|
|
|
+ for (i = 0; i < 4; i = i + 1) frame_bytes[43 + i] = 8'd75;
|
|
|
+ frame_len = 4 + 43;
|
|
|
rx_count = 0;
|
|
|
rs232_rx_count = 0;
|
|
|
uart_send_frame(frame_len); // via CON12 TTL
|
|
|
@@ -494,8 +494,8 @@ module prod2u_6400_v2_tb;
|
|
|
rx_count = 0;
|
|
|
rs232_rx_count = 0;
|
|
|
uart_send_frame_rs232(frame_len); // via CON134 RS-232
|
|
|
- while (rs232_rx_count < 95) @(posedge clk);
|
|
|
- if (rs232_rx_bytes[10] !== 8'd25 || rs232_rx_bytes[34] !== 8'd55 || rs232_rx_bytes[38] !== 8'd75) begin
|
|
|
+ while (rs232_rx_count < 106) @(posedge clk);
|
|
|
+ if (rs232_rx_bytes[10] !== 8'd25 || rs232_rx_bytes[45] !== 8'd55 || rs232_rx_bytes[49] !== 8'd75) begin
|
|
|
$display("FAIL: Cross-port switching duty mismatch");
|
|
|
failures = failures + 1;
|
|
|
end else begin
|