|
@@ -43,6 +43,8 @@ module prod2u_mrdimm_i2c_e2e_tb;
|
|
|
integer artifact_file;
|
|
integer artifact_file;
|
|
|
reg [7:0] payload [0:31],serial_response [0:1023];
|
|
reg [7:0] payload [0:31],serial_response [0:1023];
|
|
|
integer serial_count=0,rx_bit,transport;
|
|
integer serial_count=0,rx_bit,transport;
|
|
|
|
|
+ integer event_length,event_records,event_word;
|
|
|
|
|
+ reg [7:0] expected_event_byte;
|
|
|
reg [7:0] rx_byte;
|
|
reg [7:0] rx_byte;
|
|
|
wire selected_tx=use_ttl ? ttl_tx : rs_tx;
|
|
wire selected_tx=use_ttl ? ttl_tx : rs_tx;
|
|
|
// Decode actual 27-clock/bit TX, including every physical stop bit.
|
|
// Decode actual 27-clock/bit TX, including every physical stop bit.
|
|
@@ -185,6 +187,29 @@ module prod2u_mrdimm_i2c_e2e_tb;
|
|
|
for(i=0;i<370;i=i+1) $fdisplay(artifact_file,"%02x",serial_response[i]);
|
|
for(i=0;i<370;i=i+1) $fdisplay(artifact_file,"%02x",serial_response[i]);
|
|
|
$fclose(artifact_file);
|
|
$fclose(artifact_file);
|
|
|
end
|
|
end
|
|
|
|
|
+ // Exercise the byte-addressed event view through the production
|
|
|
|
|
+ // I2C response collector, whose fake TX accepts bytes without UART delay.
|
|
|
|
|
+ pointer(16'h0011);send(1,1);send(0,1);stop_bus();
|
|
|
|
|
+ pointer(16'h0100);send(8,1);stop_bus();
|
|
|
|
|
+ pointer(16'h0010);send(8,1);stop_bus();require_response();
|
|
|
|
|
+ reg_read(2,value);if(value!=8)$fatal(1,"EVENT_READ response command");
|
|
|
|
|
+ reg_read(5,value);event_length=value;reg_read(6,value);event_length=event_length+(value<<8);
|
|
|
|
|
+ if(event_length<17 || event_length>129 || (event_length-1)%16!=0)$fatal(1,"I2C event length");
|
|
|
|
|
+ pointer(16'h0200);start_bus();send(8'h55,1);
|
|
|
|
|
+ for(i=0;i<event_length;i=i+1)begin
|
|
|
|
|
+ receive(value,i<event_length-1);
|
|
|
|
|
+ if(i==0)begin
|
|
|
|
|
+ event_records=value;
|
|
|
|
|
+ if(value<1 || value>8 || event_length!=1+16*value)$fatal(1,"I2C event count/length mismatch");
|
|
|
|
|
+ end else begin
|
|
|
|
|
+ event_word=(i-1)>>1;
|
|
|
|
|
+ expected_event_byte=(i-1)%2 ? dut.u_motor.u_events.u_view_memory.memory[event_word][15:8] :
|
|
|
|
|
+ dut.u_motor.u_events.u_view_memory.memory[event_word][7:0];
|
|
|
|
|
+ if(value!==expected_event_byte)$fatal(1,"I2C event byte %0d shifted",i);
|
|
|
|
|
+ if(i<=16 && value!==(i==5?8'hFF:(i==6?8'd6:8'd0)))$fatal(1,"oldest reset event packing");
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+ stop_bus();$display("I2C_EVENT_RECORDS=%0d BYTES=%0d",event_records,event_length);
|
|
|
if(x_rises<10 || !dut.u_motor.ax_active[0])$fatal(1,"no sustained motion during Host/BMC/snapshot traffic");
|
|
if(x_rises<10 || !dut.u_motor.ax_active[0])$fatal(1,"no sustained motion during Host/BMC/snapshot traffic");
|
|
|
$display("ACTIVE_MOTION_STEP_RISES=%0d",x_rises);
|
|
$display("ACTIVE_MOTION_STEP_RISES=%0d",x_rises);
|
|
|
$display("prod2u_mrdimm_i2c_e2e_tb PASS");$finish;
|
|
$display("prod2u_mrdimm_i2c_e2e_tb PASS");$finish;
|