module level2pulse(clk,s,a);input clk,s;output a;reg temp_a;always@( posedge clk) temp_a <= s;assign a = temp_a ^ s;//S的上升下降都会生成脉冲//assign a = ~temp_a & s;//S的上升会生成脉冲//assign a = temp_a & ~s;//S的下降会生成脉冲endmodule//
module pulse(input wire CLK,input wire S,output wire A;); reg [2:0] S_dly;always @(posedge CLK) begin S_dly <= {S_dly[1:0], S};endassign A = ^S_dly[2:1];endmodule