one_shot.v

来自「Verilog实现mini-uart」· Verilog 代码 · 共 70 行

V
70
字号
//============================================================================
//
//        Title     : UART RECIEVER DESIGN
//        Author    : JP LIU
//
//=============================================================================
//
//        File Name      : one_shot.v
//        Module Name    : one_shot
//
//=============================================================================
//
// this module generates a one shot pulse whenever an input goes high from low
//
//          |---|   |---|   |---|   |
// _________|   |___|   |___|   |___|
//
//          |------------------------
//  ________|
//
//          |-------|
//  ________|       |________________
//
//==============================================================================

module one_shot 
(
 //INPUT PORT
 sys_rst_b,
 clk_in,
 d,
 // OUTPUT PORT
 q
);

////////////////////////////////////////////// 
//
// INPUT AND OUTPUT DECLARATION             //
//
//////////////////////////////////////////////

input  sys_rst_b;
input  clk_in;
input  d;

output q;

/////////////////////////////////////////////
//
// WIRE AND REG DECLARATION                //
//
/////////////////////////////////////////////

reg    d_del;

/////////////////////////////////////////////
//  SEQUENCAL LOGIC                        //
/////////////////////////////////////////////

// generate a delay of the input
always @(posedge clk_in or negedge sys_rst_b)
  if (~sys_rst_b) 
      d_del <= 1'b1;
  else
      d_del <= ~d;

assign q = d & d_del;

endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?