`timescale 1ns/1ps module prod2u_p4_cdc_sync_depth_tb; reg clk = 1'b0; reg rst_n = 1'b0; reg command_start = 1'b0; reg command_dir = 1'b0; reg [15:0] command_steps = 16'd12; reg legacy_limit = 1'b0; reg legacy_force_stop = 1'b0; reg legacy_disabled = 1'b0; reg legacy_watchdog = 1'b0; wire step_out; wire dir_out; wire started_pulse; integer rises = 0; integer guard = 0; always #5 clk = ~clk; always @(posedge step_out) rises = rises + 1; prod2u_p4_axis_executor #( .DIR_SETUP_CYCLES(2), .STEP_HALF_CYCLES(2) ) dut ( .clk(clk), .rst_n(rst_n), .command_start(command_start), .command_dir(command_dir), .command_steps(command_steps), .step_out(step_out), .dir_out(dir_out), .started_pulse(started_pulse) ); initial begin repeat (3) @(negedge clk); rst_n = 1'b1; @(negedge clk); command_start = 1'b1; @(negedge clk); command_start = 1'b0; while ((rises < 12) && (guard < 128)) begin @(negedge clk); legacy_limit = ~legacy_limit; legacy_force_stop = ~legacy_force_stop; legacy_disabled = ~legacy_disabled; legacy_watchdog = ~legacy_watchdog; guard = guard + 1; end repeat (8) @(negedge clk); if ((rises != 12) || step_out || (dir_out !== 1'b0)) begin $fatal(1, "legacy unconnected safety signals affected fixed motion"); end $display("PASS: prod2u_p4_cdc_sync_depth_tb"); $finish; end endmodule