Procházet zdrojové kódy

test(mrdimm): check addressed limit history during concurrent motion and traffic

codex před 3 měsíci
rodič
revize
4537356528
1 změnil soubory, kde provedl 13 přidání a 1 odebrání
  1. 13 1
      tests/sim/prod2u_mrdimm_i2c_e2e_tb.v

+ 13 - 1
tests/sim/prod2u_mrdimm_i2c_e2e_tb.v

@@ -8,6 +8,7 @@ module prod2u_mrdimm_i2c_e2e_tb;
     assign sda=master_low ? 1'b0 : 1'bz;
     assign sda=master_low ? 1'b0 : 1'bz;
     wire [7:0] ptc;
     wire [7:0] ptc;
     wire [3:0] fan;
     wire [3:0] fan;
+    reg [2:0] lower_raw=3'b111;
     wire x_step;
     wire x_step;
     integer x_rises=0;
     integer x_rises=0;
     reg x_previous=0;
     reg x_previous=0;
@@ -24,9 +25,15 @@ module prod2u_mrdimm_i2c_e2e_tb;
     prod2u_mrdimm_top dut(.sys_clk(clk),.host_rs232_rx(rs_rx),.host_rs232_tx(rs_tx),
     prod2u_mrdimm_top dut(.sys_clk(clk),.host_rs232_rx(rs_rx),.host_rs232_tx(rs_tx),
         .host_ttl_rx(ttl_rx),.host_ttl_tx(ttl_tx),.bmc_rs232_rx(bmc_rx),.bmc_rs232_tx(),
         .host_ttl_rx(ttl_rx),.host_ttl_tx(ttl_tx),.bmc_rs232_rx(bmc_rx),.bmc_rs232_tx(),
         .host_i2c_scl(scl),.host_i2c_sda(sda),.temp_scl(temp_scl),.temp_sda(temp_sda),
         .host_i2c_scl(scl),.host_i2c_sda(sda),.temp_scl(temp_scl),.temp_sda(temp_sda),
-        .limit_lower_raw(3'b111),.limit_upper_raw(3'b000),.ptc_pwm_out(ptc),.fan_pwm_out(fan),
+        .limit_lower_raw(lower_raw),.limit_upper_raw(3'b000),.ptc_pwm_out(ptc),.fan_pwm_out(fan),
         .motor_en_n(),.x_step(x_step),.x_dir(),.y_step(),.y_dir(),.z_step(),.z_dir());
         .motor_en_n(),.x_step(x_step),.x_dir(),.y_step(),.y_dir(),.z_step(),.z_dir());
     integer half_ns=1250;
     integer half_ns=1250;
+    initial begin
+        // An opposite-direction lower edge must log the pre-zero position
+        // while the upper seek keeps running during Host/BMC traffic.
+        wait(x_rises>=3);@(negedge clk);lower_raw[0]=0;
+        repeat(20)@(negedge clk);lower_raw[0]=1;
+    end
 `include "tests/sim/i2c_master_tasks.vh"
 `include "tests/sim/i2c_master_tasks.vh"
     reg [7:0] value;
     reg [7:0] value;
     integer i;
     integer i;
@@ -165,6 +172,11 @@ module prod2u_mrdimm_i2c_e2e_tb;
             $fatal(1,"captured BMC raw/valid metadata mismatch");
             $fatal(1,"captured BMC raw/valid metadata mismatch");
         if(serial_response[16+316]!=1 || serial_response[16+317]!=0)
         if(serial_response[16+316]!=1 || serial_response[16+317]!=0)
             $fatal(1,"Z hit count above byte255 was truncated");
             $fatal(1,"Z hit count above byte255 was truncated");
+        if(serial_response[16+188]!=2 || serial_response[16+196]!=3 ||
+           serial_response[16+200]!=3 || serial_response[16+207]!=2 || serial_response[16+335]!=2)
+            $fatal(1,"addressed limit history lost pre-zero position/total/event");
+        if({serial_response[16+211],serial_response[16+210],serial_response[16+209],serial_response[16+208]}==0)
+            $fatal(1,"addressed limit history timestamp was not retained");
         if($value$plusargs("ARTIFACT_DIR=%s",artifact_dir)) begin
         if($value$plusargs("ARTIFACT_DIR=%s",artifact_dir)) begin
             artifact_file=$fopen({artifact_dir,"/prod2u-mrdimm-get-all.hex"},"w");
             artifact_file=$fopen({artifact_dir,"/prod2u-mrdimm-get-all.hex"},"w");
             if(!artifact_file) $fatal(1,"cannot write response artifact");
             if(!artifact_file) $fatal(1,"cannot write response artifact");