// Testbench for SyncDetect`timescale 1ns/1psmodule MySyncDetect_tb;// Inputsreg CLK_for_FIFO;reg [15:0] DATA_from_DFIFO;reg full_from_DFIFO;reg [11:0] usedw_from_DFIFO;integer i;// Outputwire sync_detected;wire[2:0] state;// Instantiate the Unit Under Test (UUT)M2SyncDetect uut (.CLK_for_FIFO(CLK_for_FIFO),.DATA_FIR_from_DFIFO(DATA_from_DFIFO),.full_from_DFIFO(full_from_DFIFO),.usedw_from_DFIFO(usedw_from_DFIFO),.sync_detected(sync_detected),.state(state));// Clock generationinitial beginCLK_for_FIFO = 0;forever #5 CLK_for_FIFO = ~CLK_for_FIFO; // 10 ns clock periodend// Stimulusinitial begin// Initialize inputsDATA_from_DFIFO = -16'd23000;full_from_DFIFO = 0;usedw_from_DFIFO = 12'd0;// Apply test cases#100;DATA_from_DFIFO = -16'd23000; // Example datausedw_from_DFIFO = 12'd1;#20;DATA_from_DFIFO = -16'd1; // Example datausedw_from_DFIFO = 12'd2;#30;DATA_from_DFIFO = 16'h1234; // Example datausedw_from_DFIFO = 12'd3;#50;DATA_from_DFIFO = 16'hDEAD; // Example datausedw_from_DFIFO = 12'd4;// Apply test cases#10;for (i = 0; i < 5; i = i + 1) beginDATA_from_DFIFO = -16'd23000 + i; // Example data with variationfull_from_DFIFO = (i % 2 == 0) ? 1 : 0;usedw_from_DFIFO = 12'd100 + i * 10;#20;endfor (i = 0; i < 20; i = i + 1) beginDATA_from_DFIFO = -16'd23000 + i*10; // Example data with variation#20;end#50;$stop; // End simulation// Apply test cases#100;DATA_from_DFIFO = -16'd23000; // Example datausedw_from_DFIFO = 12'd1;#20;DATA_from_DFIFO = -16'd1; // Example datausedw_from_DFIFO = 12'd2;#30;DATA_from_DFIFO = 16'h1234; // Example datausedw_from_DFIFO = 12'd3;#50;DATA_from_DFIFO = 16'hDEAD; // Example datausedw_from_DFIFO = 12'd4;// Apply test cases#10;for (i = 0; i < 5; i = i + 1) beginDATA_from_DFIFO = -16'd23000 + i; // Example data with variationfull_from_DFIFO = (i % 2 == 0) ? 1 : 0;usedw_from_DFIFO = 12'd100 + i * 10;#20;endfor (i = 0; i < 20; i = i + 1) beginDATA_from_DFIFO = -16'd23000 + i*10; // Example data with variation#20;endendendmodule