Prev Problem
Next Problem

29. One Shot Pulse

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

 

Code

module rise_pulse(
  input  wire clk,
  input  wire rst,      // synchronous active-high reset
  input  wire sig_in,
  output reg  pulse
);
  reg prev;             // previous sampled value of sig_in
  wire w1;

  assign w1 = sig_in & ~prev;

  always @(posedge clk) begin
    prev <= rst ? 1'b0 : sig_in;
    pulse <= rst ? 1'b0 : w1 ;
  end
endmodule

 

Was this helpful?
Upvote
Downvote