input data_clk//认为待测数据的时候
reg pre_state;
always @(posedge sys_clk)
begin
pre_state <= data_clk;//利用reg下一个时钟才生效的特性.
if({pre_state ,data_clk} == 0x01)//0x01上升沿,0x10下降沿
begin
....
end
end
reg [2:0] SCLKr;
always @( posedge iCLK or negedge Rst_n ) begin
if( Rst_n == 1'b0 ) begin
SCLKr <= 3'b000;
end
else begin
SCLKr <= {SCLKr[1:0],SPI_SCLK};
end
end